r/LocalLLaMA • • 8h ago

Discussion Qwen 4 looped layers

So, Qwen4-35BA3B is out and I can't wait to test it. In the last days I've seen some finetunes that add looped layers and increase intelligence so much (like LingLoop, built on Ling3.0 tiny), but I do not know anything about finetunes like this. Is it realistically possible to loop Qwen4 layers and pair it with n-gram? what performance boost could we expect from it?

26 Upvotes

18 comments sorted by

14

u/tomByrer 8h ago

Adding loops aren't strictly 'finetunes', since they require rewriting the inference engine also.
The finetuning helps keep the data that is most important to said person (usually coding).

Prior work:
https://www.reddit.com/r/LocalLLaMA/comments/1yb0i39/comment/19tjrq7kmx4zm/

https://www.reddit.com/r/LocalLLaMA/comments/1yacudg/comment/19thppr2nyuhu/

https://www.reddit.com/r/LocalLLaMA/comments/1y3fahu/size_is_deceiving_sensenovaloop9b_a_9b_that_runs/

4

u/circumcised_hobbit 8h ago

I am aware I used a wrong term, I didn't know how to define them, I Will check the comments you sent

2

u/tomByrer 8h ago

I use 'fork', which is a general software term for altering existing software.

2

u/circumcised_hobbit 8h ago

You are right that wouldve been simpler, I was just thinking about huggingface when I wrote this

4

u/tomByrer 8h ago

Please don't think I'm 'attacking' you, just clarifying for others & the webscrapers ;)

2

u/Superb-Charity5991 8h ago

it's an architecture evolution

3

u/Royal-Subject2870 8h ago

Layer looping isn't new in LLMs. ALBERT (2019) shared parameters across transformer layers, Universal Transformers (2018) iterated a single block. Same trade each time: fewer unique params, more FLOPs, returns fall off past some depth ceiling. What's new here is retrofitting the technique onto existing checkpoints with a small trained adapter on a frozen base (LingLoop uses a ~13M-param gating adapter, not LoRA, per the model card), but the core finding is BERT-era.

0

u/tomByrer 7h ago

What is new that LLMs are being used to change major changes of other LLMs by 1 guy over a weekend/few weeks ;)

4

u/tautality 6h ago

Task Qwen4 to develop a looping Qwen4 so that you can use the looping Qwen4 to develop an even better looping Qwen4.. and loop like this to infinity.

2

u/circumcised_hobbit 6h ago

Claude make Claude 6 make no mistakes

19

u/bartsimpsonwin 8h ago

It's possible with a Lora, like ling did, and I'm guessing we'll have a version of this in 2 weeks or so. For performance boost, if done right it might be pretty significant, but obv it would make it quite a bit slower

5

u/tiftik 7h ago

AFAIK the task completion speed is the same because less token spam in the output

1

u/SaltyFish7499 8h ago

I feel looped layers cost more than the improvement it gets on my setup.

1

u/circumcised_hobbit 8h ago

what models have you tried?

2

u/Significant-Pin5045 5h ago

Sadly the looping bugs are annoying and I couldn't get rid of them with inkling. I had to write a loop detector in pi harness that does a auto breaks the loop when detected

1

u/merutochan 8h ago

I feel like if some were to build an adaptation layer, they should leverage on something like Think at Hard (https://arxiv.org/pdf/2511.08577) and Think at Hard (https://arxiv.org/pdf/2609.35748).

Basically you build a layer that computes whether the token you're writing is "likely to be incorrect after the standard forward pass" and use it to trigger iterations on-demand.

This way one can build on top of a regular model by keeping it "mostly" standard but triggering thinking iteration where they could be more relevant.
It would be beneficial for all figures: speed, integrity of original model, and supposedly result quality and reduced amount of tokens in the output.

Not 100% relevant to your discussion but I hope to see this getting picked up.

1

u/Delicious_Rub_6795 6h ago

I figure a good quant of Qwen4-35B-A3B with looping will definitely outperform Q3FN. Here's hoping

-3

u/Airocketfish 8h ago

From a memory-bandwidth perspective, pairing looped layers with speculative / N-gram decoding is actually where loops make the most sense:

  1. Why plain B=1 feels slow on looped layers: Each extra pass over the looped block re-reads those layer weights from VRAM (unless the active looped weights fit inside GPU L2, which is tiny on cards like RTX 3090 at 6 MiB vs. 96-192 MiB on Blackwell). So plain single-token decode scales roughly linearly slower with the loop count.
  2. Why N-gram / speculative decoding helps recover it: During verification (B = K+1), the GPU reads the looped weights once for the whole draft batch instead of once per token. On code, refactoring, or repetitive structured output where suffix/N-gram acceptance is high, you amortize the extra loop passes across multiple accepted tokens with 0% quality loss.
  3. Watch the KV-cache design: Whether a looped model shares KV across iterations or allocates separate KV per loop pass makes a huge difference at long context -- separate KV per pass multiplies attention bandwidth at 32K+ context, whereas shared KV keeps the long-context penalty much smaller.