DigiNews

Tech Watch by Johan Denoyer

← Back to articles

How to pack ternary numbers in 8-bit bytes

Quality: 8/10 Relevance: 9/10

Summary

The article explores packing ternary digits (trits) into 8-bit bytes to enable SIMD-friendly unpacking, proposing a practical 5-trit-per-byte scheme and a fixed-point approach to extraction. It includes code concepts for packing and unpacking, a discussion of efficiency, and references to related AI model work (TriLMs, BitNet b1.58) and llama.cpp. A C-based validation is mentioned that demonstrates lossless packing across all 243 possible trit combinations.

🚀 Service construit par Johan Denoyer