Velurex Labs

Quintrit

Run ternary (1.58-bit) language models fast on ordinary CPUs.

A command-line program, an HTTP server with a subset of the OpenAI API, and libraries for Python, C, C++ and Rust. Open source under the Apache License 2.0.

pip install quintrit

A matrix of ternary weights: 18 by 18 squares with the values -1, 0 and +1 A ternary weight matrix: violet −1, dark 0, teal +1.

Specialization

  • Encoding. Velurex encoding puts five ternary weights into one byte, and the weights are decoded without division.
  • Memory. Weights take 1.60 bits each instead of 2.00, which means up to 20 % less memory traffic per token. On a single slow core the arithmetic can become the limit.
  • Kernels. Kernels for AVX2, AVX-512 and ARM NEON are chosen when the program starts. An optional backend runs on NVIDIA GPUs of compute capability 8.0 or newer.
  • Same results. A GPU or a different instruction set changes the speed, not the result: on the same operating system the computation is bit-identical.
  • Models. GGUF files with I2_S, TQ1_0, TQ2_0 and Q2_0 weights are loaded directly, for example BitNet b1.58, Falcon3, Falcon-E, Llama 3 1.58, Ternary Bonsai and Nemotron-H.

Limits

  • Ternary models only, no ordinary 4-bit or 8-bit models.
  • Prebuilt programs exist for Linux x86-64, Linux ARM64 and Windows x86-64. macOS is not tested yet.
  • The GPU backend is built from source with the CUDA toolkit.
  • Models are not part of the project. Take them from their publishers and read their terms.