Skip to content

Commit bb23e16

Browse files
committed
docs: HHTL bucket boundary awareness — BF16 precision zones
When raw cosine is within ±0.008 of a HEEL bucket boundary, BF16 truncation can flip the bucket assignment. High precision refinement (HIP/TWIG) on the wrong bucket = confidently lost. Fix: boundary_risk metadata per centroid pair. 95% safe → fast cascade 5% uncertain → skip cascade, validate at LEAF or compute directly γ+φ golden ratio stride reduces boundary risk by placing bucket edges at irrational positions that don't align with BF16 quant steps. https://claude.ai/code/session_01ChLvBfpJS8dQhHxRD4pYNp
1 parent a8b5a0b commit bb23e16

1 file changed

Lines changed: 77 additions & 0 deletions

File tree

.claude/HANDOVER_MAVERICK_SESSION.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,3 +672,80 @@ Production pipeline:
672672
GGUF BF16 → CLAM → table + ICC correction (from ONNX calibration) → corrected table
673673
The ICC absorbs the BF16 truncation error because it was calibrated against f32.
674674
```
675+
676+
---
677+
678+
## HHTL Bucket Boundary Awareness (BF16 precision zones)
679+
680+
### The problem
681+
682+
```
683+
f32 truth: cos = 0.0034 (barely positive, region A)
684+
BF16: cos = -0.0039 (sign flipped, region B)
685+
686+
HEEL assigns region B (WRONG).
687+
HIP refines within B (precisely wrong).
688+
TWIG gives exact position in B (exquisitely wrong).
689+
690+
High precision on the wrong answer is worse than
691+
low precision on the right answer.
692+
```
693+
694+
### The fix: boundary_risk metadata
695+
696+
```rust
697+
pub struct HhtlEntry {
698+
pub heel: u8,
699+
pub hip: [u8; 3],
700+
pub twig: [i16; 17],
701+
pub boundary_risk: u8, // 0=safe, 255=on bucket edge
702+
}
703+
```
704+
705+
For each centroid pair:
706+
- Compute distance of raw cosine from nearest HEEL bucket boundary
707+
- If within BF16 truncation range (±0.008): boundary_risk = HIGH
708+
- HIGH risk → skip cascade, go straight to LEAF validation
709+
- LOW risk → cascade is safe, proceed normally
710+
711+
95% of pairs are safely inside their buckets. 5% need validation.
712+
Pay LEAF cost only for the uncertain 5%.
713+
714+
### γ+φ reduces boundary risk
715+
716+
Golden ratio stride ensures bucket boundaries DON'T align with
717+
BF16 quantization steps. Irrational boundary positions = fewer
718+
values landing exactly on edges = fewer LEAF validations.
719+
720+
### Reconstruction awareness per level
721+
722+
```
723+
HEEL (8 bits): can reconstruct: which quadrant (reliable if boundary_risk < 128)
724+
cannot reconstruct: precise distance (too coarse)
725+
726+
HIP (24 bits): can reconstruct: cluster membership (reliable within bucket)
727+
cannot reconstruct: sub-cluster ranking if bucket was wrong
728+
729+
TWIG (272 bits): can reconstruct: full L1 distance (if bucket was correct)
730+
cannot reconstruct: anything if HEEL bucket flipped
731+
732+
LEAF (16K bits): can reconstruct: everything (ground truth at BF16 precision)
733+
cannot reconstruct: f32 precision (BF16 truncation is permanent)
734+
```
735+
736+
### The chain of trust with boundary awareness
737+
738+
```
739+
For each centroid pair (i, j):
740+
1. Compute raw cosine from BF16 source
741+
2. Measure distance to nearest bucket boundary
742+
3. If safe (>0.008 from boundary):
743+
→ HEEL → HIP → TWIG cascade (fast path, 95% of pairs)
744+
4. If uncertain (<0.008 from boundary):
745+
→ Mark boundary_risk = HIGH
746+
→ Skip HEEL/HIP, compute TWIG directly from raw cosine
747+
→ Or: validate via LEAF if available
748+
5. ICC profile: calibrate the fast-path results against ONNX f32
749+
→ The 5% uncertain pairs get individual correction
750+
→ The 95% safe pairs get bulk correction via transfer curve
751+
```

0 commit comments

Comments
 (0)