Horon

Quantized Semantic Storage (TQ1.9)

Status: shipped in format v4 (gFile v0.7.0) · opt-in at file creation · default OFF is byte-identical to v2/v3 output.

What it is

An opt-in on-disk encoding for semantic coordinates: user dims (16+) are stored as TQ1.9 balanced-ternary fixed-point — 2 bytes per dimension instead of 16 — and the reserved GACL region (dims 0–15) is elided entirely unless the file has GACL enabled (in which case it stays full-width Q64.64, so access-control semantics remain exact).

TQ1.9 is gMath's TritQ1_9 encoding: an i16 holding value × 3⁹ (scale 19 683), range ±29524/19683 ≈ ±1.49987, uniform step 1/19683 ≈ 5.08 × 10⁻⁵ (~4.3 decimal digits). Horon owns the Q64.64 ↔ TQ1.9 conversion (src/quant.rs) because gMath provides no direct FixedPoint encoder; the scale constant is imported from gMath and the rounding rule (round-half-away-from-zero) matches TritQ1_9::from_rational. Ties are exact in both directions (divisors 2⁶⁴ and 19683 share no factor with the ½-step), and quantize(dequantize(q)) == q for every one of the 59 049 valid raw values — pinned by an exhaustive test.

Sizes (40-dim file, production catalog shape)

layout tail bytes/entry vs 640 B
v2/v3 full-width 640
v4 quantized, GACL off 48 13.3×
v4 quantized, GACL on 304 2.1×

The tail appears in three record types (snapshot entry, INSERT, SET_SEMANTIC), so the same ratio applies to temporal trajectory records: a 40-dim SET_SEMANTIC payload drops from 640 B to 48 B.

Honest note on the original estimate: the "8× smaller" estimate assumed uniform quantization of all dims. Reserved-region elision beats it (13.3×) for non-GACL files; GACL files get only 2.1× because their access bands deliberately stay full-width. The hoped-for "zero-multiply distance kernels" do not exist in g_math for distances (only dot products, behind an inference feature that requires rayon) — no kernel claim ships with quantization.

The contract

Where quantization lives (and doesn't)

Entirely at the Horon serialization edge. NodeEntry / WalEntry hold full-width canonical bytes in memory; encoding to the 2-byte layout happens only in write_to, decoding only in read_from (parameterized by SemLayout, src/quant.rs). Consequences, all by construction:

Format

Rejected forks (design decisions, 2026-07-11)

  1. Uniform 2 B for all dims incl. GACL bands — simplest, exactly the estimated 8×, but access-band edges would move by up to 2.5 × 10⁻⁵, making access decisions quantization-dependent. Access is exact-compare semantics, not ranking-grade. Rejected.
  2. User dims 2 B, reserved always full-width — access exact, but only 2.1× on catalog-shaped files; the headline claim dies. Rejected.
  3. Through-stack i16 dims in the engine — 8× RAM too, future quantized kernels; but changes the engine's alignment contract and decode choke point for a kernel that doesn't exist yet. Deferred, not rejected — revisit if RAM or benchmarks demand.
  4. Saturate on out-of-range — never blocks a write, but silently flattens any pipeline emitting values beyond ±1.5. Rejected for the honesty of the failure mode.
  5. Re-quantize-on-compact migration — in-place format mutation of live files, durability tests and a downgrade story, paid before any file needs migrating. Creation-time opt-in only; the compaction hook (geofile.rs pad block) remains the place to add it if a real file ever needs converting.

Known limits