Skip to content

Record: Residual Input Mixing + mixed int6 GPTQ + grouped TTT + MLP 3.5x - #790

Open
danialht wants to merge 1 commit into
openai:mainfrom
danialht:main
Open

danialht wants to merge 1 commit into
openai:mainfrom
danialht:main

Conversation

@danialht

@danialht danialht commented Mar 26, 2026 •

Copy link
Copy Markdown

val_bpb: 1.1172 (mean over 3 seeds with TTT evaluation, stride=64)

artifact: 15.5 MB (mean over 3 seeds)

TLDR Changes

  • in my previous submission (PR Record: Residual Input Mixing + mixed int6 GPTQ + grouped TTT + MLP 3.5x #615) there was a bug, which is now fixed: GPTQ calibration time is now counted as a part of training time, meaning that the 600s constraint does affects it. In order to incorporate that, the training loop's wall clock time was lowered a few seconds so that the total time would stay under 600s.

  • Changed TTT from a flat optimizer to grouped AdamW (separating params in two groups: matrices and control weights) with stronger matrix/head adaptation, while restoring standard clipping and removing the per-chunk warmup.

  • Changed Architecture: Making Residual Connections Denser, Changed block input formation so each transformer block now sees a learned mix of the current stream, earlier block outputs, and the original x0, instead of only the simpler local x/x0 residual mix. This gives the model a denser residual path and lets each block reuse longer-range intermediate features directly.

Results

Seed Steps final val_loss final val_bpb Artifact
1337 6034 1.8869 1.1176 15.3 MB
42 6031 1.8856 1.1168 15.9 MB
2025 6033 1.8863 1.1172 15.4 MB

val_bpb mean: 1.1172

val_bpb std: 0.0003

val_loss mean: 1.8863

More Details

  • Architecture: 11L, 512d, Mixed residuals each layer from 2 previous layers, MHA 8/8, MLP 3.5x (1792), BigramHash 8192, XSA all layers

  • Quantization: mixed int6 per-row GPTQ (clip_range=15) + Early QAT (threshold 0.5) + EMA 0.997

  • TTT: Legal score-first AdamW, chunk=131072, last 2 blocks plus control params unfrozen

Reproduce

SEED=42 \
SWA_ENABLED=0 \
torchrun --standalone --nproc_per_node=8 /path/to/train_gpt.py

@MatoTeziTanka

Copy link
Copy Markdown

Community Review — Record: Residual Input Mixing + mixed int6 GPTQ + grouped TTT + MLP 3.5x

Compliance: LOOKS CLEAN — legal score-first-per-chunk TTT (PR #1413 pattern)

PR #790 — Mix Residuals + GPTQ + BigramHash8192 + TTT

Author: danialht (Danial Hosseintabar)
Submission name: Mix Residuals + GPTQ + TTT score first + grouped AdamW + BigramHash-8192
val_bpb: 1.1172
Head SHA: 2f04110


Check 1: N-gram family bug (CLOSE trigger)

BigramHashEmbedding.bigram_hash (line 450–456) hashes ONLY input tokens:

out[..., 0] = mod
out[..., 1:] = torch.bitwise_xor(36313 * t[..., 1:], 27191 * t[..., :-1]) % mod

The hash at position i uses t[i] (current input) and t[i-1] (previous input). The target token at position i is t[i+1] and is never referenced here. The forward() method passes input_ids (not target_ids) to self.bigram(). This is legal BigramHash — no target leakage. CLEAN.

Check 2: Pre-Quant TTT bug (CLOSE trigger)

The submission name explicitly says "legal score-first grouped-AdamW TTT," and the code confirms it. eval_val_sliding_ttt (line 706) implements a strict two-phase per-chunk loop:

  • Phase 1 (lines 800–830): base_model.eval() + torch.inference_mode() — scores the current chunk, accumulates loss/bpb for reporting. No gradients, no parameter updates.
  • Phase 2 (lines 832–866): Only fires if not is_last_chunk and ttt_epochs > 0 — trains on the current chunk's tokens to prepare for future chunks. The last chunk is never trained on.

Scoring always precedes any weight update for those positions. This matches the legal pattern from PR #1413. CLEAN.

Verdict: LOOKS CLEAN — legal TTT implementation matching the PR #1413 (dexhunter) pattern: each chunk scored under torch.no_grad() before optimizer.step(), with is_last_chunk guard preventing adaptation on the final scored chunk.

Recommendation to @cocohearts @valerio-oai @0hq @yuzhougu-oai @notapplica: MERGE pending the usual record-track checks (3-seed validation, under-16MB artifact cap, ≤600s train + ≤600s eval on 8×H100 SXM). TTT implementation follows the legal score-first discipline.


Reviewed by @MatoTeziTanka — The Agora. Compliance audit via LLM agent (Sonnet) reviewing full train_gpt.py source, cross-checked against deterministic AST classifier. If this review misread your code, please call it out so I can re-audit manually.

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.

2 participants