Skip to content

Server flags for looped models: --recurrent-loops, --recurrent-kv-cache - #60

Merged
rromenskyi merged 3 commits into
mainfrom
dory-loops
Nov 7, 2026
Merged

rromenskyi merged 3 commits into
mainfrom
dory-loops

Conversation

@rromenskyi

Copy link
Copy Markdown

Dory runs its recurrent block `n_recurrent_loops` times per token (trained for 1-4, default 2). These flags override the model's config at load so a client (LLMTray) can pick the loop count without editing config.json.

  • `--recurrent-loops N` (1-4) and `--recurrent-kv-cache per_loop|last_loop`, both default to the model's config.
  • Passed through `load(model_config=...)`; `BaseModelArgs.from_dict` drops the keys for every other model.
  • `last_loop` output depends on prefill chunking: earlier loops read the last loop's KV for earlier chunks. Checked on the tiny config: trim + re-feed matches prefill in the same chunks exactly (diff 0); one-chunk vs two-chunk differs in last_loop only. The help says so.

Tests: `tests/test_looped_model_config.py` (flags → overrides, range check, override reaches the model and its cache count, forward runs). test_models/test_server failures in my local venv are the same 10 on main (older MLX there).

Reviews: codex (no bugs), muse (the last_loop chunking note above).

🤖 Generated with Claude Code

Roman Romenskyi and others added 3 commits November 7, 2026 14:27
…cache

Dory's recurrent block runs n_recurrent_loops times per token (trained for
1-4). The flags override the model's config at load; left out, the config
stays as it is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rromenskyi
rromenskyi merged commit f55e2f9 into main Nov 7, 2026
2 checks passed
@rromenskyi
rromenskyi deleted the dory-loops branch November 7, 2026 22:07
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