Research & Papers

NativeTernary: A Self-Delimiting Binary Encoding with Unary Run-Length Hierarchy Markers for Ternary Neural Network Weights, Structured Data, and General Computing Infrastructure

New binary format compresses BitNet b1.58's ternary weights and adds document structure for just 2 bits per boundary.

Deep Dive

Researcher Maharshi Savdhariya has introduced NativeTernary, a novel binary encoding scheme designed to solve a critical gap in the AI hardware stack. While models like BitNet b1.58 have proven that large language models can run on ternary weights (values of -1, 0, or +1), there has been no native, efficient way to store or transmit these models in binary form. NativeTernary directly addresses this by partitioning the 2-bit pair space: three combinations represent the ternary values, and one reserved pair (like {11}) acts as a structural delimiter. This foundational design allows the format to be both compact and directly interpretable by hardware with minimal overhead.

The paper's central technical contribution is its method for encoding semantic hierarchy. It uses a simple yet powerful principle: a sequence of N consecutive delimiter pairs marks a boundary of level N. This means a word boundary costs 2 bits, a sentence 4 bits, a paragraph 6 bits, and so on, with cost proportional to the rarity of the boundary. This elegantly embeds document structure directly into the data stream. The author presents several variants, including one optimized for ultra-low-power systems by using {00} as the delimiter to minimize transistor switching activity.

Savdhariya outlines a vision for a "ternary-native" computing infrastructure that could leverage this encoding without requiring hardware changes. Potential applications are vast, spanning from storing ternary neural network weights and hierarchical text to edge computing, IoT telemetry, and financial tick data. The decoder's simplicity—a 10-line, stateless state machine—makes it highly resilient to bitstream corruption and ideal for embedded systems. A patent has been filed in India, and a C implementation is forthcoming, with plans for v2 to include benchmarks against formats like GGUF.

Key Points
  • Encodes ternary values (-1,0,+1) in 2-bit pairs with a reserved delimiter for structure, solving BitNet b1.58's storage gap.
  • Marks semantic hierarchy (word, sentence, paragraph) using unary run-length encoding, costing only 2-10 bits per boundary.
  • Features a 10-line stateless decoder, enabling efficient use in edge IoT, automotive, and medical devices without hardware changes.

Why It Matters

Enables efficient deployment of next-gen 1-bit LLMs on resource-constrained devices, from satellites to sensors, by drastically reducing model size and adding intelligent data structure.