Skip to content

About

Loop adapter for any model: recurrent-depth looping, verifier-gated data, cheap adapter training

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

Repository files navigation

loop-anything

Loop adapter for any model: give any transformer recurrent depth by running its middle layers again — with a small trained adapter, base weights frozen.

Idea

A transformer gets one trip through its layers per token. Looping reuses the middle layers for a second (or third) pass with the same weights, so a token gets more sequential reasoning without more parameters and without writing more chain-of-thought tokens.

What it buys (shown on DeepSeek-V4.1-Flash with a 132 MB adapter): more accuracy on reasoning tasks, fewer thinking tokens, faster answers — trained on a single 96 GB GPU for under $50.

Scope

Works for reasoning: code, math, multi-step lookup, agentic tasks. Does not add knowledge — looping cannot make a model know more than its weights store. Knowledge and factual recall do not benefit.

Recipe (model-agnostic)

  1. Pick a model, a task family, and an automatic verifier (unit tests for code, reference answers for math).
  2. Let the base model sample many solutions per problem.
  3. Keep only the ones the verifier accepts (rejection sampling); prefer shorter thinking traces.
  4. Train a small loop adapter on the kept traces, base frozen.
  5. Evaluate on held-out problems and compare against the unlooped base — same task set, same scoring.

References

  • Thinking Machines, Inkling 2 Mini — looped transformer, middle 12 of 24 layers run 3 times.
  • Z.ai, GLM-5.4 — 28 layers looped twice, converted from a pre-trained base via continued training.
  • jasontitus/dsv41-loop-eval — 132 MB loop adapter on DeepSeek-V4.1-Flash, LiveCodeBench gains with 27% fewer thinking tokens.

Layout

  • loop_anything/ — Python package: loop.py (pass scheduling), adapter.py (adapter layout), data/ (sample / verify / filter), train/ (adapter training), eval/ (held-out eval), serve/ (inference-side loop support, e.g. vLLM plugin).
  • configs/models/ — per-model loop configs (prelude/core/coda split, passes). configs/tasks/ — per-task configs (problem source, verifier, eval split).
  • data/ — generated data (not committed). adapters/ — trained adapter registry (configs + reports, weights on HF).
  • benchmarks/ — eval harnesses and results. docs/ — design, data recipe, training, evaluation. examples/, scripts/, tests/ — TBD with the first implementation.
  • Repo conventions in AGENTS.md. Docs layout follows yetone/magpie (docs/ guides + docs/subsystems/ one doc per subsystem); issue templates and CI under .github/.

Status

Empty skeleton. Roadmap and first target model TBD.

About

Loop adapter for any model: recurrent-depth looping, verifier-gated data, cheap adapter training

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages