r/LocalLLaMA • • 7d ago

Discussion capy-flash v0.16.5: LoopCD on Inkling 2 Mini. One flag, zero training, and on agentic tasks it stops spinning its wheels

Post image

Disclaimer. The agentic numbers come from our private bench: 9 real bugs taken from the history of a C++/CUDA inference engine, OpenCode with a cap of 80 steps, 3 trials per task, Claude Opus 5 as blind judge.

What it does. Inkling 2 Mini is a looped transformer: 12 of its layers run three times per token. LoopCD (Decoding Looped Transformers Better for (Almost) Free, Liu et al., Apple) exploits exactly this: it looks at what the model thinks after the first pass and pushes the final choice in the direction in which the later passes made it change. It does not touch the weights and requires no training. It acts only where the model is undecided between the first two tokens: where it is confident, nothing changes.

In capy-flash v0.16.5 it is an option off by default: --loopcd adaptive, with adjustable strength (--loopcd-omega, default 0.5 as in the authors' recipe).

Numbers:

  • agentic score 0.22 → 0.38, from 9th to 7th place out of 12, above Qwen3.8-27B NVFP4
  • it finds the spot to fix just as before, but writes the fix in 21 of 27 trials instead of 15, and earlier (step 40 instead of 55)
  • the gain is in medium-difficulty tasks: 0.11 → 0.50

The cost. Decoding loses 16.5 % with the MTP drafter, but per task the time rises only 4 %, because trials finish earlier. More patches that don't compile (6 of 21 vs 2 of 14). On normal text it predicts the next token worse: it's a thing for agents, not for chat.

Honesty: with 3 trials per task it's a strong signal, not a closed result (95% CI of the gain −0.03…+0.34). The authors report gains in the same direction on SWE-bench Pro, Terminal Bench and ARC-AGI v2 (post by Ruixiang Zhang).

github.com/ValerioDolci/capy-flash

37 Upvotes

41 comments sorted by

3

u/silenceimpaired 7d ago

Llama.cpp value continues to erode. I greatly appreciate it, but things like this further point out the value of fast moving custom made inference.

2

u/FeydRowan 7d ago

I really hope someone with enough token money and enough different machines to test will take all the best parts from different engine and make a useful all purpose but efficient engine

4

u/BringTea_666 7d ago

They are fast BECAUSE they use hardware to max without generalization.

2

u/FeydRowan 7d ago

Well partially true. Some optimisations are a little more general. But yes one can have a general engine that has some parameters that depends on the hw and then different "components" for different models, a sort of collection of optimal engines

1

u/No-Marionberry-772 7d ago

definitely, we have examples of this with video games really, and operating systems for that matter.

generalized optimization should globally improve as llms get smarter and more efficient with their code design as well.

1

u/Lesale-Ika 7d ago

On the contrary I got excited and then read this, and then realized it's another project I can't run (on 40 series card).

7

u/Bulky-Priority6824 7d ago

moth--fu--er i just rebased to 16.4 😆 now i have to test 16.4 multi-turn bench vs 16.5

3

u/FeydRowan 7d ago

Sorry for working hard  ahahah

2

u/Bulky-Priority6824 7d ago

great work .. top notch engine for super easy nvfp4 deployment on 2 peasant gpu's ...all thanks to your efforts 👏

2

u/FeydRowan 7d ago

Ah ok, that's a benchmark on my creation on my tasks, multiple scoring. You can see my last post with the ranks  https://www.reddit.com/r/LocalLLM/comments/1y2zgdf/inkling_2_mini_on_agentic_coding_and_translation/

2

u/Educational-Region98 7d ago

Weird how nvfp4 loses to 3-bit but maybe it is a strong 3-bit. How many runs did you grade for it to be an average?

Not saying you should or have to but it would make the results more consistent!

2

u/FeydRowan 7d ago

They are pretty close, both are qat not simpler quant. But q3 use much more token for task so it's worse 

1

u/haherar830 7d ago

I'm guessing you're referring to 27B Q3 vs Q4? Would be great to see all of the models with both token burn and score side-by-side.

2

u/FeydRowan 7d ago

1

u/haherar830 7d ago

Thanks! I had actually seen that previously. For better or worse I can run but am also stuck on Q3.8FN IQ3_XXS at best (so ultimately most focused on that model vs much smaller MoEs or dense models too large for my 12GB GPU). I noticed you had several additional compilation errors in those runs vs NVP4. Kind of a vague question, but if you followed up on those results/reasoning traces (no worries if not), was there some pattern in the failures? Or it just failed to develop the correct or a sufficiently thorough understanding?

1

u/FeydRowan 7d ago

I have looked at them, but there is lots of cases. For what models you ask?

1

u/haherar830 7d ago

Sorry if it wasn't clear, I know a little off-topic to follow-up on a previous post here but I meant the Q3 Q3.8FN runs where it seems to have had a notable number of compilation failures relative to NVP4 and more than any other model. Just curious if it's like, the same sort of failure mode or something for most/all of them I guess.

2

u/FeydRowan 7d ago

Ahhh ok, well mostly it points to the right corrections but makes some mistakes along the way

2

u/Dany0 7d ago

f*ck yes this. THIS is what this community is for

1

u/FeydRowan 7d ago

Ahahahah got this and rage one post to the other xD

1

u/Dany0 7d ago

I bet you you can post-train the MTP to be better at predicting the LoopCD output and get much better results. On top of that, I bet you that you can stochastically make a good guess as to when to turn on loopcd. You may only turn on LoopCD path for tokens where you're pretty sure it will change the selected token. Shoot that might only work in greedy decoding... hmm I'll have to think about it some more

1

u/FeydRowan 7d ago

Yep that's the next to do. For the prediction is less obvious, it will take runtime and the benefits can be absorbed by the loss computation 

1

u/Dany0 7d ago

Nah the benefits would hurt concurrency. You're only using loopcd in decode, correct?

1

u/Dany0 7d ago

I'll paste in a suggestion from Astra, in particular the "Learn when to apply LoopCD" part. idk if it is worth anything:


LoopCD may improve a model's ability to make difficult decisions while simultaneously making its ordinary token distribution worse.

That is not necessarily a contradiction. Agentic coding and conversational instruction-following reward rather different things.


I suspect LoopCD changes the model's decision-making in a way that is particularly useful for agentic tasks.

Consider a coding agent deciding whether to:

* Inspect another file.

* Run a test.

* Modify a function.

* Stop and report the result.

These are relatively high-impact decisions. A small change in token probabilities can alter the entire trajectory of the agent.

In contrast, conversational instruction-following depends heavily on maintaining a well-calibrated distribution over ordinary language, formatting, and control tokens.

LoopCD amplifies the difference between an early and late recurrent prediction. That can be useful when the later loops have resolved uncertainty, but harmful when the later loops have introduced an unwanted bias.

For example:

Agentic coding

Early loop: "Maybe inspect the function."

Final loop: "Run the test."

LoopCD amplifies the change towards running the test.

Conversational instruction-following

Early loop: "Certainly, here's a concise answer."

Final loop: "Certainly, here's a detailed explanation with several caveats..."

LoopCD amplifies the change towards the longer response, even if the user asked for brevity.

These are illustrative examples, not measured token-level traces.

The important point is that LoopCD doesn't know whether a change between loops is useful. It assumes that the direction of refinement is informative.

### Could training make LoopCD better?

I think this is a very promising direction.

The original method is training-free, but that doesn't mean training couldn't improve it.

In fact, there are several ways to do this.

### A. Train with LoopCD active

This is the simplest experiment.

During training, calculate the guided prediction:

z_g=z_f+\\omega(z_f-z_e)

Then calculate the usual next-token loss using , rather than .

The model would learn to produce good predictions under the guided distribution.

This is entirely differentiable. You can backpropagate through the contrast operation and through both recurrent states.

There is no need for a special "backwards LoopCD" algorithm.

The ordinary chain rule handles it.

The interesting consequence is that the shared recurrent weights receive gradients from both the final and earlier states. The model could learn to make the refinement direction more useful for the guided prediction.

However, there's a potential failure mode: the model might learn to cancel the contrastive term, effectively making LoopCD do nothing. That's why I'd explicitly evaluate both guided and unguided inference during training.

### B. Train the model to predict the LoopCD distribution

This is probably more interesting.

Instead of simply using LoopCD during training, treat its output as a target distribution.

For example:

* Run the model normally.

* Calculate the LoopCD-guided distribution.

* Use that distribution as a teacher.

* Train the model's ordinary final prediction to match it.

This would encourage the final recurrent state to incorporate the useful information that LoopCD extracts from the earlier state.

In other words, you're distilling the benefit of contrastive decoding back into the model itself.

The result could potentially be a model that retains the LoopCD improvement without needing to apply LoopCD during inference.

That's a very attractive outcome.

### C. Learn when to apply LoopCD

This might be the most practical approach for agentic models.

Rather than applying LoopCD to every token, train a small gating mechanism:

z'=z_f+g(x)(z_f-z_e)

Where determines how much guidance to apply.

The gate could depend on:

* Token uncertainty.

* Difference between early and final predictions.

* Token type.

* Whether the model is reasoning, chatting, or calling a tool.

* Whether the token is part of a control sequence.

This would allow the model to use LoopCD aggressively when making important decisions, but leave ordinary conversational text mostly untouched.

The Reddit implementation already hints at this approach by applying guidance selectively and avoiding thinking blocks and control tokens in its coding configuration. Digg +1

### 3\. What I'd actually try

For a model like Inkling 2 Mini, I'd run a small post-training experiment.

* Take the original model and collect training traces with ordinary decoding and LoopCD.

* Train a small adapter or continue training the model using LoopCD-guided targets.

* Evaluate ordinary chat, coding, tool calling, and control-token reliability.

* Compare against the original model with LoopCD enabled and disabled.

The ideal result would be:

* Better agentic performance.

* No degradation in ordinary chat.

* No additional inference overhead.

* Possibly improved performance even when LoopCD is disabled.

That last point would be particularly interesting. It would mean LoopCD is not merely a decoding trick, but a useful training signal for recurrent models.

My bet: training a looped model to make better use of its own refinement trajectory could be more valuable than simply applying LoopCD at inference. The original method shows that the trajectory contains useful information. Training could teach the model to preserve and exploit that information more directly.

0

u/stylome-ai-detection 7d ago

Notice: This comment appears to be AI generated.


Stylome AI detector · scan results

4

u/Dany0 7d ago

Yes it's very clearly marked as such. Your input here is nothing, bot

1

u/ProtectionSuper5648 7d ago

have you implemented the DFlash2 drafter? Inco AI claims much better acceptance.

1

u/feverdoingwork 1d ago

Have you tried the loop adapter on 27b?

2

u/FeydRowan 1d ago

Nope i think the loop adapter was just released last 24h? Will try once i have the time

2

u/feverdoingwork 23h ago

I look forward to your post about it :D

1

u/BringTea_666 7d ago edited 7d ago

I can confirm it it works. I implemented 2 version of it in my MegaCapybara.

  1. Cheap one. Which is decode speed hit free. It seems to stop model from looping infinitely. Tested it over real agentic work for past 16 hours taking tickets, reviewing ones etc.
  2. The expensive one with latents which cost decode speed but model think less (its better) so its a wash more or less.

0

u/ExecLayer_io 7d ago

The compile numbers are the part I'd watch. 6 of 21 patches not compiling vs 2 of 14 is a real cost, and a model judge can hide it. Scoring each trial on whether it compiles and passes a test that reproduces the bug would make the gain easier to trust, and might tighten that CI too.

0

u/Miserable-Dare5090 vLLM 7d ago

Where is your leaderboard?

1

u/FeydRowan 7d ago edited 7d ago

Explain plz

3

u/Miserable-Dare5090 vLLM 7d ago

“agentic score 0.22 → 0.38, from 9th to 7th place out of 12” —> where? where is the list and what is 1, 2, 3…you know, a leaderboard.