Skip to content

Add opt-in LoopCD for Inkling-2-Mini - #851

Open
DanielWit wants to merge 3 commits into
incoai:mainfrom
DanielWit:loop-cd
Open

DanielWit wants to merge 3 commits into
incoai:mainfrom
DanielWit:loop-cd

Conversation

@DanielWit

@DanielWit DanielWit commented Nov 25, 2026 •

Copy link
Copy Markdown

What this adds

  • --loop-cd enables loop-wise contrastive decoding for Inkling-2-Mini. It is off by default, and unsupported models are rejected when the flag is set. A model profile list keeps support explicit.
  • Re-ranks the target’s next-token logits using a first-loop readout (expert − 0.2 × amateur) and a 0.1 expert plausibility threshold. The DFlash drafter and score-only requests are unchanged.

This is an experimental adaptation of Yu et al.: the first-loop readout skips Inkling’s coda. It does not reproduce the coda-based adaptive method.

Apple Silicon results

The benchmark runner used for these measurements is available on the fork but is not part of this PR.

24 GB Mac, unsloth/Inkling-2-Mini-GGUF:UD-IQ1_S, one lane, 2K context, DFlash enabled in both modes. Speed uses a separate fixed 256-token workload. Accuracy is greedy on the same 100 GSM8K questions, with a 768-token output cap.

Metric Off On
Median decode speed 54.26 tok/s 49.44 tok/s (−8.9%)
Speed-test draft acceptance 34.6% 29.2%
GSM8K correct 82/100 90/100
GSM8K token-cap stops without a parseable answer 15 8
GSM8K completed, parseable wrong answers 2 2
GSM8K completed, unparseable answers 1 0

All nine improvements were baseline cap hits that became correct answers; the sole regression was a correct baseline answer that hit the cap with LoopCD. The baseline’s only uncapped parse failure was 400/11 vs. the gold 36, so fraction parsing does not explain the gain. This is evidence of more correct completions at the tested budget, not of better reasoning at a higher budget.

Same questions at a 1,536-token cap (4K context)

Metric Off On
GSM8K correct 93/100 95/100
GSM8K token-cap stops without a parseable answer 3 1
GSM8K completed, unparseable answers 1 1
GSM8K parseable wrong answers 3 3
Median decode speed (256-token probe) 52.96 tok/s 48.10 tok/s (−9.2%)
Speed-test draft acceptance 34.6% 29.2%

The per-request logs show that both improvements were baseline cap hits with no visible answer: question 821 finished correctly in 827 generated tokens with LoopCD, and 505 in 1,445. Neither mode solved 255 before the cap. Both completed 93 with the same unparsed fraction (400/11, gold 36) and gave the same three parseable wrong answers. There were no regressions. The gap shrank from 8 to 2 points as the output budget increased; it still measures more correct completions within the budget, not corrected answers on problems both modes completed.

Time to a correct answer

LoopCD decoded fewer tokens per second in the fixed-length speed test, but on some questions both modes got right, it generated substantially fewer tokens and finished sooner end to end:

GSM8K question Generated tokens (off → on) Wall time (off → on)
61 807 → 268 11.18 s → 4.23 s
696 1,269 → 473 17.95 s → 8.16 s
206 844 → 349 11.41 s → 4.93 s
146 602 → 942 7.81 s → 13.55 s

These are examples, not an aggregate latency result. The two truncation rescues above are separate from this comparison.

Validation and open items

  • CLI tests, C++ syntax checks, and architecture checks passed. Real-model generation was exercised on Mac, and the LoopCD sampling test passed with Metal GPU validation enabled.
  • The full Metal suite stopped at IQ4_NL gguf-projection failures, which also reproduced on main. Failure counts varied between runs; prefill failures were observed only on loop-cd in these runs, and the cause is unknown.

Proof this PR
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@DanielWit
DanielWit marked this pull request as ready for review November 25, 2026 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant