본문으로 건너뛰기

Novel Contributions

This page documents what TinyLoop contributes that is genuinely new, what adapts known ideas to the weight-shared setting, and where credit is due to prior work. We distinguish three categories:

  • Novel — no prior work we're aware of proposes this
  • Novel mechanism — the concept exists but the weight-shared implementation is new and eliminates constraints the original had
  • Looped-specific adaptation — the concept exists in standard transformers; we adapt it to exploit weight sharing

Novel: Deterministic Cross-Iteration Error Cancellation

What it is. When the same INT4 weight is used L times across loop iterations, we alternate the rounding direction: even iterations use standard round-to-nearest, odd iterations apply a sign-bit correction. Quantization errors cancel in pairs.

Error scaling:

MethodError growthWho can do it
Naive INT4O(L)Any architecture
Stochastic roundingO(√L)Looped only
Deterministic cancellationO(1)Looped only

Why this is novel. Extensive literature on adaptive rounding exists — AdaRound, GPTQ, VQRound — but all optimize rounding decisions for weights used once. No prior work exploits the fact that a weight-shared architecture reuses the same weight L times, enabling deliberate alternation so errors cancel deterministically. The closest work, ERQ, iteratively corrects quantization error within a single forward pass but across different weights, not the same weight across iterations.

API. TINYLOOP_CANCEL_ROUND=1 (requires v5 .tinyloop file with sign_bit channel).


Novel: Per-Iteration Safety Check

What it is. After each loop iteration during decode, the runtime computes the FP32 residual L2 norm. If it exceeds a threshold, generation aborts immediately. This gives L chances to catch exploding or degenerate hidden states per token, vs 1 in standard transformers.

Why this is novel. Parcae analyzes looped transformer stability through spectral norm constraints during training. Parallel Loop Transformer uses residual norms for layer-skipping decisions. Neither deploys a runtime abort mechanism that monitors the residual at each iteration and terminates generation. TinyLoop's safety check is a deployed safety feature, not a training-time analysis.

API. model.generate(..., safety_check=True, safety_norm_threshold=50.0)


Novel Mechanism: Store-h KV Cache

What it is. Instead of storing K and V per layer, store the pre-QKV hidden state h and reconstruct K = W_k · h, V = W_v · h at attention time. Since W_k and W_v are shared across iterations, this works without extra parameters.

Related work. DeepSeek MLA compresses KV cache into a latent vector and reconstructs via learned up-projection matrices. Both MLA and store-h eliminate full KV storage. The key difference: MLA requires trained compression/decompression matrices (W_DKV and W_UK/W_UV). Store-h requires nothing extra — the reconstruction uses the existing shared QKV weight that the model already has. This is only possible because weight sharing means W_k is the same matrix at every iteration.

Result. Up to 78% KV VRAM saving (INT4-h mode) with no extra parameters.


Novel Mechanism: Rewind Speculation

What it is. When a low-depth draft (L=2) is rejected by a high-depth verify (L=8), check whether an intermediate depth (L=4) would have agreed with the verify. If so, future drafts can target L=4 instead of re-running L=8.

Related work. HiSpec (Oct 2025) uses early-exit models for hierarchical verification — conceptually similar but requires separate models at each depth tier. Speculative Speculative Decoding (ICLR 2026) explores fallback strategies for multi-speculator systems. TinyLoop's rewind uses the same weights at every depth — no separate models, no extra memory, no training. The intermediate L=4 computation reuses the exact same weight matrices as L=2 and L=8.

Result. 88.9% rewind hit rate measured on H100 / 2B INT4.


Novel Mechanism: Per-Token L Scheduling

What it is. During a single decode call, vary the loop depth per token: first N tokens at L=2 (cheap warmup), remaining tokens at L=8 (full quality).

Related work. LoopFormer (Feb 2026, ICLR 2026) introduces elastic-depth looped transformers with budget-conditioned inference. Their limitation section explicitly states: "global (sequence-level) rather than instance/token-adaptive budgeting." Universal Transformer uses ACT for adaptive depth but requires a trained halting mechanism. TinyLoop's L scheduling is simpler — a config-driven per-token depth ramp during decode, no training required. The per-token granularity within a single decode sequence is new.

Result. Warmup tokens decode ~3.3× faster on H100.


Novel Insight: LoRA Amplification

What it is. A rank-r LoRA adapter applied to the loop block contributes L times during the forward pass, making PEFT L× more parameter-efficient than on a standard transformer.

Why this matters. In a 24-layer standard transformer, LoRA on one layer affects 1/24 of the computation. In TinyLoop at L=8, LoRA on the loop block affects 100% of the loop computation — the adapter runs at every iteration. At our measured 2B model: 16,384 params (0.03 MB) control 8 full iterations of compute.

Related work. Standard LoRA (Hu et al., 2022) applies adapters to individual layers. LoRA-FA freezes adapter A to halve memory. Neither considers the amplification effect of weight sharing: a single adapter on the shared block implicitly becomes a "multi-layer" adapter applied at every depth. This is a free property of the architecture, not a technique.

Result. At L=16, 16K LoRA params control 16× more compute than the same params on a standard transformer layer.


Looped-Specific Adaptation: Self-Speculative Decoding

What it is. Use L=2 as the draft model and L=8 as the verifier, with the same weights.

Prior work. Draft & Verify (Zhang et al., 2024) introduced self-speculative decoding for standard transformers via layer skipping. The concept of using one model for both draft and verify is not new. TinyLoop's contribution is the mechanism: depth variation via the loop count knob, which is cleaner than layer skipping because it doesn't require decisions about which layers to skip — you simply run fewer iterations of the same block.

Result. 2.77× throughput on H100 / 407M, zero extra parameters.


Summary

FeatureNoveltyKey differentiator
Deterministic error cancellationNovelNo prior work on alternating rounding across reused weights
Per-iteration safety checkNovelDeployed runtime abort, not training-time analysis
Store-h KV cacheNovel mechanismLike MLA but no extra projection matrices needed
Rewind speculationNovel mechanismLike HiSpec but same weights, no extra models
Per-token L schedulingNovel mechanismLike LoopFormer but per-token, not per-sequence
Dual-bit weight swapNovelNo prior work on per-iteration bit-width selection with shared weights
L-aware batchingNovelNo prior work on per-request depth in a single batch with shared weights
Dynamic-L inferenceNovel capabilityL=2..64 from one model — per-request, per-token depth
LoRA amplificationNovel insightRank-r LoRA on loop block is L× more parameter-efficient
Triple-bit weight swapNovel mechanismINT8/INT2/INT4 per-iteration bit selection
Self-speculative decodingAdaptationLike Draft & Verify but via depth knob, not layer skip