APR-NLP-006 // apr-v2-trie

Interpolated 4-Gram Language Model

Compact KenLM-inspired interpolated 4-gram language model for fast perplexity scoring and OCR/ASR beam rescoring.

Interpolated 4-Gram Language Model architecture poster

Runtime: Loading .apr...

Inference: --

Artifact Format
apr-v2-trie
Parameters
240K 4-gram entries
Family
nlp

CLI Execution & Inspection

$ apr run ngram-language-model --score "pure rust deterministic builds"
$ apr inspect ngram-language-model.apr --verify-sha256

Mathematical Formulation

Chain-Rule Perplexity

PPL(W)=exp(-1N∑i=1NlnP(wi∣wi-3…wi-1))

Numerical Contract

Probability distribution sums to 1.0 over vocabulary; perplexity monotonically improves from 1-gram to 4-gram.