How to pack ternary numbers in 8-bit bytes
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.