2026-09-22: Inco Hacks Native: DFlash 2 Speculation & SSM Prefix Ladders in sanctum-mlx

Inco AI recently unveiled their high-speed local inference optimizations (“Inco Splash” / DFlash 2) demonstrating speculative block decoding on Apple Silicon. Rather than adopting third-party runtimes or LM Studio wrappers, Sanctum engineering integrated these advancements directly into our native Rust Cathedral engine (sanctum-mlx) under strict Sanctum doctrine.
1. Architectural Geometry & Inco Drafter Integration
Section titled “1. Architectural Geometry & Inco Drafter Integration”Inco’s draft architecture pairs with Qwen3.8-27B-4bit using a 5-layer sliding-window drafter trained against target layer taps [5, 19, 33, 47, 61]:
- Model:
incoai/Qwen3.8-27B-DFlash2(3.84 GBmodel.safetensors) - Block Size: 8 tokens (1 target verify token + 7 speculative proposal tokens)
- Taps Geometry: 5 target layers (
[5, 19, 33, 47, 61]),hidden_size: 5120,intermediate_size: 17408,head_dim: 128 - Memory Footprint: Quantized in memory to 4-bit (
SANCTUM_MLX_DFLASH2_BITS=4), reducing drafter footprint to ~1.2 GiB with negligible (-1.7%) acceptance degradation.
<!-- haus.sanctum.mlx.plist --><key>SANCTUM_MLX_DFLASH2_BITS</key><string>4</string><key>SANCTUM_MLX_DFLASH2_BLOCK</key><string>8</string><key>SANCTUM_MLX_DFLASH2_DIR</key><string>/Users/neo/.cache/huggingface/hub/models--incoai--Qwen3.8-27B-DFlash2/snapshots/main</string><key>SANCTUM_MLX_SSM_LADDER</key><string>4</string>2. Root-Cause Analysis: The Zero-Cache-Hit Hybrid Gate Bug
Section titled “2. Root-Cause Analysis: The Zero-Cache-Hit Hybrid Gate Bug”During multi-turn agentic evaluations, sanctum-mlx logs exhibited zero cache hits:
hybrid gate discarded a reusable prefix requested_lcp=53 discarded=53prompt-cache q8 path prefix_cached=0 cache_hit_ratio=0.0The Flaw
Section titled “The Flaw”- SSM Ladder Checkpoint Gate: Prompts under 2048 tokens execute in a single prefill chunk (
chunk_end == prompt_len). Insampling.rs,capture_ssm_checkpointcontainedif boundary >= suffix_len { return; }. This meant no checkpoint was ever stored in single-chunk prompts. - Decode Completion Boundary: When generation concluded, the prompt-cache slot saved its final recurrent state at
prompt_len + completion_len. - Turn 2 Divergence: On Turn 2, the shared prompt prefix matched
prompt_len. But becauselcp < saved_lenandslot.ladderwas empty, the hybrid gate discarded the reusable prefix and forced a total cold-start. - FP16 Pathway Asymmetry: While Q8 had ladder retention hooks, the FP16 streaming and sync pathways were passing throwaway
&mut Vec::new()ladder buffers and overwriting saved slots withladder: Vec::new().
The Remedy
Section titled “The Remedy”- Multi-Depth Boundary Checkpoint: In
sampling.rs, updatedcapture_ssm_checkpointso that whendepth > 1(e.g.SANCTUM_MLX_SSM_LADDER=4), the prompt boundary (boundary == suffix_len) is recorded into the ladder. - Unified FP16 & Q8 Gating: Implemented
gate_fp16_with_laddersymmetric withgate_q8_with_ladder, seedingladder_for_savefromprior.ladderand restoring recurrent state checkpoints on prefix branches across both sync and streaming paths.
3. Production Verification & Live Benchmarks
Section titled “3. Production Verification & Live Benchmarks”With sanctum-mlx live on :1337, consecutive multi-turn queries were evaluated against the updated engine:
# Turn 1: Initial Promptbs=8 accepted=7 committed=8 completion_tokens=9 # 7/7 proposed tokens accepted in 1 round!q8 KV kept_tokens=53 ladder=1
# Turn 2: Multi-Turn Continuationladder resume: recurrent state restored at an exact earlier boundary requested_lcp=53 resumed_at=43 recovered=43prefix_cached=43 cache_hit_ratio=0.5890 # 58.9% Cache Hit Ratio!bs=8 accepted=5 committed=6 completion_tokens=6
# Turn 3: Streaming Multi-Turn Follow-upladder resume: recurrent state restored at an exact earlier boundary requested_lcp=78 resumed_at=73 recovered=73prompt-cache q8 streaming path prefix_cached=73 cache_hit_ratio=0.7228 # 72.3% Cache Hit Ratio!| Metric | Before Fix | Inco DFlash2 + SSM Ladder |
|---|---|---|
| Speculative Block Proposals | None / Single-Step | Block Size 8 (7 drafts/pass) |
| Draft Acceptance Peak | N/A | 7 of 7 tokens accepted |
| Multi-Turn Cache Hit Ratio | 0.0% (Cold restart every turn) | 58.9% – 72.3% Instant Resume |
| Python Dependency | None (Rust native) | 0% Python (Pure Rust + Metal) |
The Inco inference optimizations are fully operational on Apple Silicon under native Sanctum doctrine, integrated directly into Sanctum MLX alongside the Carmack Optimization.