kenlm

Self-contained static binaries of the fastest n-gram language model toolkit — download, run, done.

Download for your platform Read the tutorials

CPU-only · pthreads + memory-resident sort · no GPU is ever required

Latest: v0.1.0 · kenlm @ kpu · musl vs glibc

About this site (credits)

kenlm is an open-source n-gram language model toolkit written by Kenneth Heafield (first released 2011; see Heafield 2011). Its canonical home is github.com/kpu/kenlm; that's where kenlm is developed, maintained, and bug-fixed.

This site — github.com/ljh-sh/kenlm — is only a static-build distribution. We don't own, rebrand, or maintain kenlm; we just compile it as fully self-contained static binaries for every major platform so you can download and use it without a toolchain.

For questions, bug reports, and contributions → please go to the upstream project.

Download v0.1.0

Every archive is a fully self-contained, statically-linked binary. No system libraries to install. Works on any Linux distro (Alpine, Debian, Ubuntu, RHEL, Arch…), macOS, or Windows.

Detecting your platform…

linux · x86_64 · musl
kenlm-x86_64-linux-musl.tar.gz
~3.7 MB lmplz · runs on Alpine & every Linux
Download .tar.gz · sha256
linux · aarch64 · musl
kenlm-aarch64-linux-musl.tar.gz
~3.9 MB lmplz · Alpine-native, ARM64 Linux
Download .tar.gz · sha256
linux · x86_64 · glibc
kenlm-x86_64-linux-gnu.tar.gz
~4.2 MB lmplz · glibc-static (universal Linux)
Download .tar.gz · sha256
linux · aarch64 · glibc
kenlm-aarch64-linux-gnu.tar.gz
~4.1 MB lmplz · ARM64 Linux, glibc
Download .tar.gz · sha256
macos · Apple Silicon
kenlm-aarch64-macos.tar.gz
~1.6 MB lmplz · macOS 11+
Download .tar.gz · sha256
windows · x64 · /MT
kenlm-x86_64-windows.zip
~0.9 MB lmplz · Win10+
Download .zip · sha256
windows · ARM64
kenlm-aarch64-windows.zip
~0.9 MB lmplz · Windows-on-ARM
Download .zip · sha256

SHA256SUMS · release notes · all releases

5-minute quick start

If you just want to score text or train a model, you don't need to read anything else:

tar xzf kenlm-x86_64-linux-musl.tar.gz
cp kenlm-x86_64-linux-musl/bin/* /usr/local/bin/

cat > corpus.txt <<'EOF'
the cat sat on the mat
the cat ran fast and far
the dog sat down by the door
a small cat and a small dog
the cat and the dog sat together
EOF

lmplz -o 3 --discount_fallback < corpus.txt > model.arpa
build_binary model.arpa model.bin
echo "the cat sat" | query model.bin
# Perplexity including OOVs:	3.49

That's the whole pipeline. The full tutorials cover vocabulary pruning, memory tuning, C++ embedding, batch scoring, and reading every byte of kenlm output.

Tutorials

Beginner · 5 minutes

Train your first language model. Install the binaries, run lmplz, build_binary, and query on a tiny corpus, then learn what every line of output means.

Read the beginner tutorial →

Intermediate · tuning & integration

Order, memory, discounting, vocabulary pruning, quantization, mmap, C++ embedding, batch scoring, real-world recipes for re-ranking and perplexity evaluation.

Read the tuning tutorial →

What's in v0.1.0

Seven platform targets, all built natively on GitHub Actions and verified to run on their target OS:

targetrunnerlinkage
x86_64-linux-gnuubuntu-latestglibc fully static
aarch64-linux-gnuubuntu-24.04-armglibc fully static
x86_64-linux-muslubuntu-latest + alpinemusl-static, verified on Alpine
aarch64-linux-muslubuntu-24.04-arm + alpinemusl-static, ARM64 Linux
aarch64-macosmacos-14macos static Boost, system libc++
x86_64-windowswindows-latest + vcpkgwin static CRT, /MT
aarch64-windowswindows-11-arm + vcpkgwin Windows-on-ARM

The Linux builds ship as both glibc-static and musl-static so one archive works on every Linux distro — Alpine, Debian/Ubuntu, RHEL, Arch. The musl build is verified by running its smoke test inside Alpine on CI.

See musl-vs-glibc comparison for the bench numbers (musl is ~10 % smaller on x86_64) and the reasoning behind shipping both.