Run eight official NCM checkpoints on Apple Silicon: Sudoku easy/medium/hard, TinyStories, XSum, WMT14 and LM1B small/medium. CPU FP32 inference; weights and decoding rules are unchanged.
- Sudoku: 2.39× faster, measured over 384 boards; bitwise-identical codes, reconstructions, decoder logits and answers on all 6,000 test boards.
- WMT14: 1.36× faster, measured over five paired runs.
- Text models: 6.2–22.4% less parameter/buffer storage, not total process RAM. No speedup is claimed for TinyStories, XSum or LM1B.
Tested on an M1 MacBook Pro with 8 GB unified memory, macOS 14.0, Python 3.13.1 ARM64 and PyTorch 2.8.0. Timings exclude loading and warmup; text timings use batch 1 with both implementations resident.
python3.13 -m venv .venv
.venv/bin/python -m pip install -r requirements.txt
.venv/bin/python -m pip install .
.venv/bin/python scripts/download.py --model tinystories
.venv/bin/ncm-text --model tinystories --n 2 --output results.jsonThe downloader accepts tinystories, xsum, wmt14, lm1b-small, lm1b-medium and sudoku. Download the chosen model first, then run:
.venv/bin/ncm-text --model xsum --text "Your article here." --output results-xsum.json
.venv/bin/ncm-text --model wmt14 --text "Ein kurzer deutscher Satz." --output results-wmt14.json
.venv/bin/ncm-sudoku --difficulty hard --n 32 --output results-sudoku.jsonXSum accepts up to 512 source tokens; WMT14 up to 96. Text defaults: batch 1, four threads, seed 42. Batch 2 and conditional --cfg 1 are also validated. These research checkpoints are not chat assistants.
Downloads are revision-pinned and hash-checked. The complete supported set occupies about 5.1 GB. LM1B large exceeds our paired-validation budget on an 8 GB Mac; OpenWebText has no checkpoint in the pinned release.
git clone https://github.com/HazyResearch/ncm.git upstream-ncm
git -C upstream-ncm checkout c70274273f489abc73832b2b98584a8483b6b203
.venv/bin/python scripts/validate.py --model xsum --n 16
.venv/bin/python scripts/validate.py --model sudoku --n 0 --batch-size 8 --threads 4Recorded evidence covers 176 sampled text outputs: TinyStories 32, XSum 48, WMT14 48, LM1B small 32 and medium 16. Codes, reconstructions, generator/decoder logits, sampling probabilities, RNG state and text match the original CPU reference exactly (torch.equal). Actual CLI outputs are checked separately. This establishes parity on those cases, not exhaustive task quality or equality across devices. Revalidate other environments and settings.
The runtime reuses reconstruction buffers, removes training-only statistics and shares frozen codebooks. Prefix caching is enabled only for Sudoku and WMT14. Use upstream for training.
Based on the pinned upstream commit above, under the MIT code license. Weights and datasets retain their own terms. Cite Kumbong et al., Next-Concept Modeling using CITATION.cff; identify this port as NCM Mac 0.3.0 with the Git commit used.