Skip to content

Commit e41ea81

Browse files
committed
Add GGUF-isolation warning to f16 section — prevent calibration confusion
Adds clear table + warning at top of f16 block: - F16 (5-bit exp, 10-bit mant) ≠ BF16 (8-bit exp, 7-bit mant) - F16 is for sensors/audio/ARM interchange - BF16 pipeline (above) is for GGUF model weight calibration - Other sessions must NOT use f16_to_f32_ieee754 for GGUF hydration No code changes. Documentation only. https://claude.ai/code/session_017ZN5PNEf8boFBgorUZVrFU
1 parent 8878ff2 commit e41ea81

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

src/simd_avx512.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2360,6 +2360,22 @@ mod bf16_tests {
23602360
// ════════════════════════════════════════════════════════════════════════════
23612361
// F16 (IEEE 754 Half-Precision) — via F16C instructions (stable since Rust 1.68)
23622362
//
2363+
// ⚠️ THIS IS NOT FOR GGUF/MODEL WEIGHT CALIBRATION ⚠️
2364+
//
2365+
// This f16 is for: sensor data, audio, ARM interchange, memory-efficient storage.
2366+
// For GGUF model weights → use the BF16 pipeline above (bf16_to_f32_batch etc.)
2367+
//
2368+
// ┌─────────┬──────┬──────────┬──────────┬────────────┬─────────────────┐
2369+
// │ Format │ Bits │ Exponent │ Mantissa │ Range │ Use case │
2370+
// ├─────────┼──────┼──────────┼──────────┼────────────┼─────────────────┤
2371+
// │ BF16 │ 16 │ 8 (b127) │ 7 bits │ ±3.4e38 │ GGUF weights │
2372+
// │ F16 │ 16 │ 5 (b15) │ 10 bits │ ±65504 │ Sensors, audio │
2373+
// │ F32 │ 32 │ 8 (b127) │ 23 bits │ ±3.4e38 │ Compute │
2374+
// └─────────┴──────┴──────────┴──────────┴────────────┴─────────────────┘
2375+
//
2376+
// f32→f16 narrowing: 23-bit mantissa → 10-bit = 13 bits lost.
2377+
// Max RNE error: ±0.5 ULP of f16 result (≈ 0.05% relative).
2378+
//
23632379
// IEEE 754 binary16: 1 sign + 5 exponent + 10 mantissa
23642380
// Range: ±65504, precision: ~3.3 decimal digits
23652381
// Subnormals: ±5.96×10⁻⁸ minimum positive

0 commit comments

Comments
 (0)