Thinking in Place (TiP)

No weights here. This is an inference method for llama.cpp, applied to a GGUF you already have. Hugging Face lists it as a model because it has no repository type for methods. Code: GitHub · Windows build: v1.0 · Paper: DOI 10.5281/zenodo.24507288

Upgrade the model you already run. No bigger download, no retraining, no extra weights: one variable, and a frozen model thinks harder when the question is hard. 92 → 103 of 108 checkable reasoning items on a 9B. It costs time (about 2× per token) and nothing else.

One token through the model: attention blocks are re-applied, each pass pulled back to its own input

Training-free recurrent depth for hybrid attention / state-space models, as a llama.cpp patch.

Correct answers, single pass versus Thinking in Place: 83.3 to 98.1 percent and 87.0 to 92.6 percent on a reasoning set, 78.5 to 84.8 percent on MATH-500 levels 4-5, 97.5 to 96.0 percent on GSM8K

The patch modifies the inference graph so that a frozen, pretrained model re-applies its own full-attention blocks several times per generated token, each time pulled back toward the block's original input. You keep your GGUF and set one variable.

The mechanism in four lines

s_0     = block input                         (the anchor)
in_t    = (1 - beta) * s_t + beta * s_0       (t > 0)
s_{t+1} = Block(in_t)                         (attention + FFN)
R(l) = max(1, round(N·√(l/l_max)))            beta = 1 - φ⁻¹ / N

Only full-attention layers loop. Recurrent (gated-delta-net) layers run once. Only predicting passes loop; prompt processing is single-pass.

Use

Windows + NVIDIA, no build needed: download the two archives from the v1.0 release (program, and the CUDA 12 runtime if you do not have the CUDA toolkit), unzip them into the same folder, then run set TIP_N=8 followed by llama-server.exe -m model.gguf -c 8192 -ngl 99. The binary was checked on one machine only (RTX 4070); reports from other setups are welcome.

Apply patch/thinking-in-place-vs-llama.cpp-af5c583.diff to llama.cpp at commit af5c583, build as usual, then:

TIP_N=8 ./llama-server -m model.gguf -c 8192 -ngl 99

Unset TIP_N and you get stock llama.cpp, with identical output. Every setting is documented in TIP.md.

What it buys

The loop helps where a single pass is fragile, and only there. Nine reasoning items with a checkable answer, six variants each, temperature 0, on a 9B model at its shipped quantization (Q5) and one step lower (Q4):

Model Single pass TIP_N=8
Q5 47/54 50/54
Q4 45/54 53/54
Both 92/108 103/108

Paired item by item, the loop wins 13 answers and loses 2 (exact two-sided p = 0.007). Seven of the nine items are at ceiling in both settings; the gain comes from the two items the single pass gets wrong most often. Two quantization steps lower, where the model degenerates, the loop recovers nothing: it reaches a capacity that is there, it does not replace one that is gone.

On public benchmarks, same model: GSM8K (first 200 test questions) is saturated, 195 against 192, nothing to recover; on MATH-500 levels 4–5 with a numeric answer (158 questions) the loop goes from 124 (78.5%) to 134 (84.8%), 19 answers won against 9 lost (p = 0.087). No gain where the model is already right, a gain where it is not.

What it supports

Area Status
Models Qwen hybrids in llama.cpp, dense and mixture-of-experts. Tested: Qwen 3.8 27B, Qwen 3.5 35B, Qwythos 9B, Ornith 9B and 35B. Other architectures untested
Hardware GPU, CPU-only, MoE experts in host memory (--n-cpu-moe), MoE expert cache (--moe-cache-mib)
Speculative decoding draft-mtp and draft-dflash return the same text as the loop alone, 2.3 to 2.6 times faster
Parallel slots 4 and 8 slots, dense and MoE
MoE routing under the loop two modes: frozen at the first iteration (default) or re-decided at every iteration

Cost

At about 13,500 tokens of context, without speculative decoding:

Model Single pass TIP_N=8
9B 16.2 ms/token 34.4 ms/token (×2.1)
35B MoE, experts of 16 layers on CPU 18.5 ms/token 31.4 ms/token (×1.7)

Time per token is linear in the number of block evaluations. With draft-mtp the 9B at TIP_N=8 runs at 81 tokens/s, faster than the single pass without speculation (59 tokens/s).

Evidence

Claim Basis
Loop off is identical to unpatched llama.cpp same text and first-token log-probabilities, dense and MoE
The loop executes exactly the scheduled iterations 0.49 ms per block evaluation across three budgets
Sampling temperature is not amplified 3,024 positions replayed along identical prefixes; same gap at T = 0, 0.7 and 1.0
No repetition collapse in long generations 1,400-token generations, T = 0, 0.7 and 1.0
The loop does not move a quantized model's probabilities closer to the original same distance with and without the loop, dense and MoE
sqrt schedule at budget 8 ≈ uniform budget 12, at about half the loop compute paper, internal blind panels, small n
Iterate settles in about three iterations paper, per-layer probes
Reasoning benefit when the model actually deliberates paper, two models, a handful of items
Frozen and free MoE routing behave differently paper, full outputs read side by side, one run per mode and prompt

Apart from the two public benchmarks above, the quality results are internal evaluations, on one architecture and quantized checkpoints; holdout replication is pending.

Intended use

  • Trading inference time for a more settled reading on existing checkpoints, without touching the weights.
  • Research on recurrent depth as a pure inference-time operator: schedule, anchor strength, convergence, expert routing under iteration.

Limits

  • The loop amplifies what the base configuration does, good or bad. It does not repair an unstable setup.
  • Too many iterations make results worse.
  • No benefit on tasks whose difficulty lies in reading the prompt.
  • One architecture (Qwen hybrids), five checkpoints.

How this was made

Research, code and writing were carried out with AI assistance. The author designed the mechanism and directed the experiments, and has read the results, the generated outputs and the conclusions, for which he takes responsibility. The prose was drafted with AI assistance and has not been reviewed word by word by the author.

How this differs from trained looped models

Trained looped models learn a block that is meant to be re-applied. Thinking in Place needs no training: it works on checkpoints that already exist, block by block, with an anchor and a depth schedule. The two can be combined.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support