LFM2-350M-Cascadia-ternary3

A 354M-parameter model that generates text in 278 MB of RAM from a binary depending only on libc, libm and libgomp.

Weights are stored as a spline manifold plus per-band lookup tables, with codebook indices packed five trits to a byte β€” 0.60 bytes per weight. A standalone C runtime multiplies by them in the compressed domain, so no dense weight matrix is ever built and resident memory stays at package size.

Base model LiquidAI/LFM2-350M
Parameters 354M
Checkpoint β†’ package 676 MB β†’ 218 MB (3.15x)
Bits per weight 5.09
Resident memory 278 MB
Perplexity vs checkpoint +3.54% (95% CI [1.011x, 1.060x], t = +2.85)
Runtime dependencies libc, libm, libgomp

Quality

Perplexity measured against the uncompressed bf16 checkpoint on the same tokens, paired per token so that sub-percent differences are resolvable:

perplexity
LiquidAI/LFM2-350M (bf16) 195.37
This package (ternary-3) 202.28
Result +3.54% (95% CI [1.011x, 1.060x], t = +2.85)

4,088 paired tokens, FineWeb-Edu, 512-token windows. Pairing cuts the standard error 5.3x versus comparing two independent means, which is what makes this resolution achievable at this sample size.

Usage

This package is executed by the Cascadia C runtime. It is not a drop-in transformers checkpoint.

git clone https://github.com/EntroMorphic/cassie && cd cassie
cmake -S src/c -B build -DCMAKE_BUILD_TYPE=Release && cmake --build build -j

huggingface-cli download ZTFlynn/LFM2-350M-Cascadia-ternary3 --local-dir ./pkg

./build/cascadia_generate ./pkg 512 --chat "Explain gradient descent."
./build/cascadia_generate ./pkg 256 --temp 0.8 --top-p 0.9 --seed 42 \
    --prompt "The three laws of thermodynamics are"

Sampling is --temp / --top-k / --top-p / --seed; the default is greedy and seed-reproducible. Generation stops at <|im_end|>, so max_new is a ceiling rather than a target.

Python

from transformers import AutoModelForCausalLM
from cascadia import load_compressed

model = AutoModelForCausalLM.from_pretrained("LiquidAI/LFM2-350M", dtype="bfloat16")
model, stats = load_compressed(model, "./pkg", model_id="LiquidAI/LFM2-350M")
print(stats["dense_bytes"] / stats["compressed_bytes"])

The Python path keeps weights compressed in RAM and serves as the reference implementation. The C runtime is the performant one.

Performance

Measured on NVIDIA Jetson Thor, 14 CPU threads, batch 1, greedy:

Decode 3.0 tok/s (333 ms/token)
Prefill 46–80 tok/s
Load 0.26–0.48 s
Peak RSS 278 MB
Kernel 0.774 ns/weight

Peak RSS equals steady state β€” nothing expands at load.

Requirements

  • 512 MB RAM minimum
  • CPU with NEON (aarch64) or a generic C fallback
  • OpenMP for multithreading

What is in the package

file contents
weights.bin 216 MB β€” compressed tensors
manifest.json per-tensor geometry and offsets
aux.bin RMSNorm scales, conv kernels, architecture constants
tokenizer.bin vocabulary, merges, Unicode tables

The format is specified in docs/package_format.md and machine-checked against every package.

How it works

For each weight matrix, a B-spline surface is fitted to capture large-scale structure. Each weight is assigned to one of 32 bands by its spline value, and a k-means codebook is learned per band over the residuals. The top 0.5% of errors are stored exactly as f32. Codebook indices are packed in base 3, five trits per byte, since 3⁡ = 243 fits in a byte.

Reconstruction is W = spline(j,c) + codebook[band][index], evaluated inside the matvec so the matrix is never materialised.

Because the spline captures dynamic range, the residual tables need no per-block scale factors β€” the lookup is a pure table read.

Limitations

  • Executed by the Cascadia C runtime, not by transformers directly.
  • Tuned and validated for LFM2-family architectures.
  • Batch-1 CPU inference; throughput suits batch and edge workloads rather than high-concurrency serving.
  • Greedy and sampled decoding are supported; beam search is not.

Acknowledgements

This work was deeply inspired by Magneato/deepseek-r1-qwen-7b-lutc, which demonstrated LUT-cascade compression of a 7B model at 5.45 bits per weight. The Guanaco LUT cascade architecture β€” no-scale residuals, variable bit rate, and f32 outlier preservation β€” is the foundation this builds on. Cascadia combines that architecture with a spline manifold for band selection and a Harmonic Collapse step that eliminates per-block scale factors entirely. Our thanks to Magneato for publishing the approach and the weights that made it concrete.

Base model: LiquidAI/LFM2-350M by Liquid AI, used under the LFM Open License.

Citation

@software{cascadia,
  title  = {Cascadia: Spline Manifold LUT Compression for Language Models},
  author = {Josserand-Austin, Tripp},
  year   = {2026},
  url    = {https://github.com/EntroMorphic/cassie}
}

License

Inherits the LFM Open License of the base model. The Cascadia compression tooling and runtime are in the repository.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for ZTFlynn/LFM2-350M-Cascadia-ternary3

Quantized
(41)
this model