Accepted to Transactions on Machine Learning Research (TMLR)

MacroCoT: Shorter Chains via Macro Transitions Constant-Factor Compression for Chain-of-Thought Counter Simulation

1University of Surrey, UK 2Louisiana State University 3University of Oklahoma 4Computational Intelligence and Operations Laboratory, Bangladesh

Correspondence: a.wasi@surrey.ac.uk

Equal-count machine on input aaaaaabbbbbb. Each base token is one counter update. Pick a macro order to bundle k steps into one token.

k =
base trace (one token per transition)
macro trace

2.9–3.7×shorter traces at the largest macro order tested (GPU, six tasks)
≥ 0.96exact match on every test split, including inputs up to 2× the training length
3.0×lower measured latency on comparison, from 16.4 ms (k = 1) to 5.4 ms (k = 3)
15 / 1,554reachable macro tokens versus the worst-case bound (mod 3, k = 4)

Abstract

Chain-of-thought (CoT) constructions that make transformers Turing complete typically simulate a counter machine, one transition per generated token, making autoregressive length proportional to the simulated runtime. Since serial generation is a key computational cost, we ask whether this length can be reduced while preserving the recognized language and the generalization properties of the simulation.

We introduce two machine rewrites with exact recognition guarantees. First, order k macro transitions combine k reachable base transitions into one token. We prove that the resulting guards retain the per-counter threshold structure, determinism is preserved, and a run of length T is compressed to about T/k steps for fixed k, a constant factor reduction that leaves the asymptotic serial complexity unchanged, with a vocabulary bounded by the base vocabulary raised to k. Second, base b counting compresses monotone decrement bursts by processing b counter units per token. Both rewrites remain within the same CoT counter programming class, allowing the base construction's length generalization result to transfer under its assumptions.

Experiments on six synthetic counter machine tasks, including equal-count and three-sum arithmetic verification, show that transformers trained on compressed traces retain length generalization under moderate compression while achieving the predicted reductions in trace length, and that this retention degrades once compression becomes large relative to the counting range. We observe corresponding reductions in generation latency, attention operations, and key value cache size. We further characterize reachable vocabulary growth and quantify the associated data scaling cost.

Method: change the machine, not the transformer

The CoT construction writes one token per counter-machine transition, so the trace is as long as the run. We rewrite the simulated machine so it takes fewer, larger steps, and we prove the rewritten machine stays inside the CoT counter programming class. The transformer architecture and the compilation result are unchanged.

rewrite 1

Order-k macro transitions

Every reachable block of k consecutive base transitions becomes one macro token.

  • Effect: the sum of the k counter updates.
  • Guard: the conjunction of the k guards, each shifted by the updates before it. This is still a per-counter interval test.
  • Length: exactly ⌈T/k⌉ tokens for a run of T base steps.
inc inc inc dec dec dec → [inc×3] [dec×3]
rewrite 2

Base-b counting

A monotone decrement burst that removes V units one at a time is rewritten to remove b units per token.

  • Full blocks: ⌊V/b⌋ tokens, each with guard “counter ≥ b”.
  • Remainder: at most one block for the units left over.
  • Composition: applied with macro order k, positions fall by about b×k.
dec × 17 → [−4] [−4] [−4] [−4] [−1]
Order-k macro transitions collapse a base trace. Each block of up to k base transitions becomes one macro token, so T base steps become ⌈T/k⌉ tokens. The number of positions falls by k while the trace bit-length stays flat, because a macro alphabet of size up to |Δ|k needs about k times as many bits per token.
Base-b counting shrinks a decrement burst. A decrement of mass V emits V unit tokens in the base machine and ⌈V/b⌉ block tokens in base b. This speedup composes with macro order to give a factor of about bk.

Guarantees

The rewrites are exact. Each result below holds for any deterministic guarded-update counter machine.

Lemma 1Canonical guard

A macro guard is equivalent to a per-counter interval constraint ℓi ≤ xi ≤ hi, so composing transitions stays within the threshold guards of the base construction.

Lemma 2Determinism preserved

If the base machine is deterministic, so is the order-k macro machine: exactly one macro token is enabled at each reachable configuration.

Theorem 1Macro speedup

On an input where the base machine halts after T steps, the macro machine halts after exactly ⌈T/k⌉ steps in the same halting state, and it recognizes the same language.

Proposition 1Vocabulary bound

The macro vocabulary satisfies |Δ(k)| ≤ ∑r=1..k |Δ|r. For single-successor loops the reachable vocabulary grows linearly in k (Proposition 3).

Proposition 4Preserved expressibility

The macro machine is a CoT counter program, so the same construction compiles it into a transformer, and length generalization guarantees for the base machine transfer under the same assumptions.

Prop. 5 & Cor. 2Base-b speedup

A burst of mass V takes ⌈V/b⌉ tokens instead of V. Combined with macro order k, counting-dominated runs shrink by about a factor of bk.

Compression keeps length generalization

A four-layer transformer (width 128, about 5.3×105 parameters, no positional encoding) is trained on 5,000 compressed traces with inputs up to length 64, then tested on in-range inputs (EM0) and on longer inputs up to length 96 (EM1) and 128 (EM2).

Compression and length generalization at GPU scale. Interactive view of Table 1 of the paper. Choose a task to see mean trace length and exact match on each test split across macro orders. One seed per configuration.
Compression and length generalization at CPU scale. Earlier small-model runs covering both rewrites. Accuracy remains high over a moderate compression regime and degrades for the most aggressive settings, for example mod 3 at b = 4 (EM2 = 0.10).

Fewer positions, lower generation cost

Compression removes serial positions, not information. For the generated trace, decode steps and key-value cache scale as 1/c and attention operations as about 1/c2, where c is the compression factor. The fixed input prefix is not compressed, so end-to-end savings are smaller when the prefix dominates.

Positions fall, information does not. Predicted generated-trace costs as the compression factor increases, with the trace information held fixed.
TaskSettingMean traceLatency (ms)Attention FLOPsKV bytesVocabulary
comparisonk = 117.2116.408.02×10417,6219
comparisonk = 28.797.952.20×1049,00212
comparisonk = 36.005.381.08×1046,14415
mod 3b = 132.8333.092.84×10533,62111
mod 3b = 217.1715.747.98×10417,57814
mod 3b = 49.428.332.51×1049,64220

Forced-length greedy generation on one CPU core; attention FLOPs and KV bytes count the generated trace portion. From k = 1 to k = 3 on comparison, latency falls 3.0× and attention operations 7.5×.

Generation cost under compression. Measured latency tracks the number of generated positions, while generated-trace attention operations fall approximately quadratically in the compression factor.

The price: a wider vocabulary

Each macro token is a new symbol the model must learn. The worst-case vocabulary grows exponentially in k, but the reachable vocabulary in the studied machines grows about linearly. A wider alphabet still needs more training data.

Reachable macro vocabulary. At k = 4 the general bound is 1,554 against 15 reachable tokens for mod 3, and 11,110 against 63 for unary mult. For parity and mod 3 the reachable counts are exactly 2(k+1) and 3(k+1).
Data scaling with macro order. On parity, exact match on the longest split rises with training-set size for every order. At 60 examples, k = 4 reaches 0.44, while all orders reach 1.00 with enough data.

Scope and limitations

BibTeX

@article{wasi2026shorter,
  title   = {Shorter Chains via Macro Transitions: Constant-Factor
             Compression for Chain-of-Thought Counter Simulation},
  author  = {Wasi, Azmine Toushik and Islam, MD Shafikul and
             Ahsan, Md Manjurul},
  journal = {Transactions on Machine Learning Research},
  year    = {2026},
  url     = {https://openreview.net/forum?id=HGmCGa0Q3O}
}