Skip to content

Invalid submissions due to information leakage during TTT #402

Open

Description

@leloykun

Don't train on eval tokens your model hasn't scored yet!


"Proper" TTT goes like this:

  1. For each 1 <= t <= T:
    1.1. Score on eval token t
    1.2. Adapt weights based on eval token <= t

What y'all are doing is something like this:

  1. For each 1 <= t <= T:
    1.1. Adapt weights based on eval token <= t
  2. For each 1 <= t <= T:
    2.1. Score on eval token t

But this is equivalent to appending the eval tokens to the training tokens and switching training strategies before eval! Also see: #152 (comment)


Potentially invalid submissions:

PR comment status
#136 TTT on half of the batch; eval on full batch [ ] open
#152 TTT on all eval tokens before evaluation [x] closed
#254 TTT on multiple parts of eval sequence for multiple epochs [ ] open
#264 TTT before eval [ ] open
#338 TTT on multiple parts of eval sequence for multiple epochs [ ] open
#398 TTT on all eval tokens before evaluation [ ] Open
#421 TTT before evals [ ] open
#417 TTT for multiple epochs before evals [ ] open
#442 TTT before evals [ ] open

cc @0hq


Please feel free to correct me if I'm wrong.

Activity

  1. leloykun commented on Mar 22, 2026

    @leloykun
    Author

    I've also noticed that people are doing TTT on multiple parts of the evaluation sequence in parallel (via DDP rank), justifying it by only assigning each "doc" to one rank.

    I'm not sure if this is comparable to the default eval strategy where we just feed all eval tokens to the model... wdyt @0hq ?

  2. himanalot commented on Mar 22, 2026

    @himanalot

    this is clearly happening bc people are using agents to monitor/use others' prs to improve their strategies. it's had an exponentially strong trickledown effect ever since a few of them made submissions that appear good at first glance with this method of basically cheating. it's a bit odd to watch.

  3. chris-lee-mc commented on Mar 23, 2026

    @chris-lee-mc

    For those using AI coding tools, I might suggest referencing the competition requirements in CLAUDE.md or AGENTS.md so they are in every prompt submission. Good hunting!

  4. hegdeadithyak commented on Mar 23, 2026

    @hegdeadithyak

    How does TTT even make sense? I don’t think it should be allowed at all.

  5. sp00mm commented on Mar 23, 2026

    @sp00mm

    Yes! So far every sub 1.1 ish PR I've looked at is "cheating" like this. Very irritating when I'm trying to understand the true sota techniques.

  6. lukacf commented on Mar 23, 2026

    @lukacf

    this is clearly happening bc people are using agents to monitor/use others' prs to improve their strategies. it's had an exponentially strong trickledown effect ever since a few of them made submissions that appear good at first glance with this method of basically cheating. it's a bit odd to watch.

    This is exactly what is happening. I had a fully automated run get to 0.979 val BPB in a pretty convincing way (#517) only to later on closer inspection see that it really had bet all on on TTT annealing (and no, not the proper variety).
    Still, kind of informative to see the failure modes of the models. You can get a lot of experiments done quickly, but if they veer off in the wrong direction.. well it's one way to burn gpu hours. On the plus side, the same agent that did the solution also caught on that it might not be fully legit and it did that by reading this thread. I'm pretty sure I would have not noticed it had it not flagged it as I've been busy exploring the next thing for it to try...

  7. samacqua commented on Mar 23, 2026

    @samacqua
    Contributor

    This was also a conversation in the discord, so I'll try to summarize the situation here to make it abundantly clear. Here are 3 different instantiations of test-time training (TTT) I see for PRs in this repo, from least-to-most legitimate.

    Claude vibe-coded website to visualize this comment: https://samacquaviva.com/projects/ttt-clarification/

    1: Train on val, then measure loss on val

    Pseudocode:

    def eval_ttt_cheat(model, val_tokens, num_epochs):
        for epoch in range(num_epochs):
            for batch in batches(val_tokens):
                sgd_step(model, loss(model, batch))
        return mean(loss(model, batch) for batch in batches(val_tokens))

    Valid?

    No, not even close. This is literally training on test and obviously invalid. You could just init a large-enough random model and train for many epochs and your loss will be 0 because it will just memorize everything.

    2: TTT auto-regressively on token stream

    Pseudocode:

    def eval_ttt_token_stream(model, val_tokens, chunk_size, context_len):
        ttt_model = deepcopy(model)
        for ci, chunk in enumerate(chunks(val_tokens, chunk_size)):
            context = val_tokens[max(0, chunk.end - context_len) : chunk.end]
            loss_per_token = ttt_model(context)
            accumulate(loss_per_token[chunk.start_in_context:])
            sgd_step(ttt_model, mean(loss_per_token[chunk.start_in_context:]))
        return total_bpb()

    Valid?

    Well, it depends on what is the validation set supposed to measure? The validation token stream in this competition is 50k documents from fine-web concatenated together with BOS tokens starting each document. So, assuming we want to model the distribution of sequences in FineWeb, then the validation set is 50k samples from that underlying distribution. If the competition chose 10k documents or 100k documents, the expectation of the validation loss should not change: only the variance of the estimator.

    However, if we train on the whole token stream: this is not the case: we have more training data for the 100k document case, so the loss will in expectation be lower. This is clearly broken and differs from the standard definition of what an eval set is, so this should not be allowed (I think it is under current rules). You could say that the point of this competition is to model this exact token sequence (50k docs) which would make this valid, but I think that is quite unnatural.

    Another way to see why this should be disallowed: imagine you were trying to measure your model's "emergent capability", so you make an eval set of 50k examples of something the model was not trained to do (let's say multiply numbers). Then, if you did token-stream TTT at inference time and your model got non-zero accuracy, you cannot say it is an "emergent phenomenon" but rather that your model can learn to multiply numbers when trained on thousands of examples. Token-stream TTT is identical to just continuing to train for 1-epoch on the eval set and reporting the mean loss (in the first epoch losses for each batch are losses before training on them).

    3: TTT auto-regressively on each document, independently

    Pseudocode:

    def eval_ttt_docbased(model, val_tokens, chunk_size, context_len):
        for doc in split_at_BOS(val_tokens):
            eval_ttt_token_stream(model, doc, chunk_size, context_len)
        return total_bpb()

    Valid:

    Yes! The dependency graph is identical to a non-TTT case: token i in document j is only dependent on tokens i'<i in document j: there is no dependency on tokens ahead (the problem of just training on test) and no dependency between documents (the problem of doing TTT on the whole sequence).

    I think people get hung up on the fact that it is doing backprop at test-time: it is just another operator -- no different than attending to tokens or updating some hidden state. If you attend to the label token: you are leaking the answer -- it is the same for TTT. For example, see Energy-based Transformers: the entire inference procedure is backprop. Similarly, look at LLM test-time-training papers like End-to-End Test-Time Training for Long Context or Let's (not) just put things in Context: Test-Time Training for Long-Context LLMs: these papers all do case 3 here. This PR is an example reference of case 3 in this repo.

    Other notes

    @leloykun: "I've also noticed that people are doing TTT on multiple parts of the evaluation sequence in parallel (via DDP rank), justifying it by only assigning each 'doc' to one rank"

    This is just an efficiency improvement. Assuming you follow case 3 outlined above (as in this PR), then parallelizing across documents is identical to doing eval over the token stream autoregressively (since each document is independent of other documents).

    @hegdeadithyak: "How does TTT even make sense?"

    Let me know if case 3 above (and referenced papers) clear it up. I agree the first two cases are incoherent.

  8. lukacf commented on Mar 23, 2026

    @lukacf

    "I think people get hung up on the fact that it is doing backprop at test-time"

    I think what rubs people the wrong way is that when you have a strict "10 minutes for training and 10 minutes for eval" rule that with TTT you are stretching the definitions of eval. IMO it's more of a problem of the rule trying to do that hard separation. But if you restrict eval to (not unreasonable) "no weights may be changed in this phase" then TTT is questionable.

    If the rule was simply "no weight changes during eval," score-first would also be banned, and the competition would just measure post-training model quality. Which is arguably cleaner.

  9. samacqua commented on Mar 23, 2026

    @samacqua
    Contributor

    @lukacf what about papers like Energy-based Transformers, End-to-End Test-Time Training for Long Context, or Let's (not) just put things in Context: Test-Time Training for Long-Context LLMs? There are whole companies (e.g. https://logicalintelligence.com/) built on these types of models.

    Of course it is valid to restrict to no parameter updates, but it seems overly restrictive given that defining a clean, train-eval split version is straightforward and this is supposed to be encouraging new techniques.

  10. hegdeadithyak commented on Mar 23, 2026

    @hegdeadithyak

    This was also a conversation in the discord, so I'll try to summarize the situation here to make it abundantly clear. Here are 3 different instantiations of test-time training (TTT) I see for PRs in this repo, from least-to-most legitimate.

    Claude vibe-coded website to visualize this comment: https://samacquaviva.com/projects/ttt-clarification/

    1: Train on val, then measure loss on val

    Pseudocode:

    def eval_ttt_cheat(model, val_tokens, num_epochs):
        for epoch in range(num_epochs):
            for batch in batches(val_tokens):
                sgd_step(model, loss(model, batch))
        return mean(loss(model, batch) for batch in batches(val_tokens))

    Valid?

    No, not even close. This is literally training on test and obviously invalid. You could just init a large-enough random model and train for many epochs and your loss will be 0 because it will just memorize everything.

    2: TTT auto-regressively on token stream

    Pseudocode:

    def eval_ttt_token_stream(model, val_tokens, chunk_size, context_len):
        ttt_model = deepcopy(model)
        for ci, chunk in enumerate(chunks(val_tokens, chunk_size)):
            context = val_tokens[max(0, chunk.end - context_len) : chunk.end]
            loss_per_token = ttt_model(context)
            accumulate(loss_per_token[chunk.start_in_context:])
            sgd_step(ttt_model, mean(loss_per_token[chunk.start_in_context:]))
        return total_bpb()

    Valid?

    Well, it depends on what is the validation set supposed to measure? The validation token stream in this competition is 50k documents from fine-web concatenated together with BOS tokens starting each document. So, assuming we want to model the distribution of sequences in FineWeb, then the validation set is 50k samples from that underlying distribution. If the competition chose 10k documents or 100k documents, the expectation of the validation loss should not change: only the variance of the estimator.

    However, if we train on the whole token stream: this is not the case: we have more training data for the 100k document case, so the loss will in expectation be lower. This is clearly broken and differs from the standard definition of what an eval set is, so this should not be allowed (I think it is under current rules). You could say that the point of this competition is to model this exact token sequence (50k docs) which would make this valid, but I think that is quite unnatural.

    Another way to see why this should be disallowed: imagine you were trying to measure your model's "emergent capability", so you make an eval set of 50k examples of something the model was not trained to do (let's say multiply numbers). Then, if you did token-stream TTT at inference time and your model got non-zero accuracy, you cannot say it is an "emergent phenomenon" but rather that your model can learn to multiply numbers when trained on thousands of examples. Token-stream TTT is identical to just continuing to train for 1-epoch on the eval set and reporting the mean loss (in the first epoch losses for each batch are losses before training on them).

    3: TTT auto-regressively on each document, independently

    Pseudocode:

    def eval_ttt_docbased(model, val_tokens, chunk_size, context_len):
        for doc in split_at_BOS(val_tokens):
            eval_ttt_token_stream(model, doc, chunk_size, context_len)
        return total_bpb()

    Valid:

    Yes! The dependency graph is identical to a non-TTT case: token i in document j is only dependent on tokens i'<i in document j: there is no dependency on tokens ahead (the problem of just training on test) and no dependency between documents (the problem of doing TTT on the whole sequence).

    I think people get hung up on the fact that it is doing backprop at test-time: it is just another operator -- no different than attending to tokens or updating some hidden state. If you attend to the label token: you are leaking the answer -- it is the same for TTT. For example, see Energy-based Transformers: the entire inference procedure is backprop. Similarly, look at LLM test-time-training papers like End-to-End Test-Time Training for Long Context or Let's (not) just put things in Context: Test-Time Training for Long-Context LLMs: these papers all do case 3 here. This PR is an example reference of case 3 in this repo.

    Other notes

    @leloykun: "I've also noticed that people are doing TTT on multiple parts of the evaluation sequence in parallel (via DDP rank), justifying it by only assigning each 'doc' to one rank"

    This is just an efficiency improvement. Assuming you follow case 3 outlined above (as in this PR), then parallelizing across documents is identical to doing eval over the token stream autoregressively (since each document is independent of other documents).

    @hegdeadithyak: "How does TTT even make sense?"

    Let me know if case 3 above (and referenced papers) clear it up. I agree the first two cases are incoherent.

    Hey there, case 3 is good I saw many PRs with 1 but.

  11. 5 remaining items

  12. hegdeadithyak commented on Mar 24, 2026

    @hegdeadithyak

    hey @samacqua , just for confirmation is this legal ?

    def eval_val_ttt(args, model, device, val_tokens,
                     base_bytes_lut, has_leading_space_lut, is_boundary_token_lut):
        chunk_size = args.ttt_chunk_size
        rank       = args.ttt_lora_rank
        lr         = args.ttt_lora_lr
        adapt_steps = args.ttt_lora_steps
    
        tokens = val_tokens.to(device, dtype=torch.int64)
        N      = tokens.numel()
    
        # Freeze base model weights; only LoRA adapters are trainable
        for p in model.parameters():
            p.requires_grad_(False)
    
        adapters  = _attach_lora(model, rank)
        optimizer = torch.optim.Adam([p for a in adapters for p in a.parameters()], lr=lr)
    
        loss_sum    = 0.0
        token_count = 0
        byte_count  = 0.0
    
        model.eval()   # keep BN/dropout in eval mode; LoRA grads still flow
    
        pos = 0
        while pos + chunk_size + 1 <= N:
            x_chunk  = tokens[pos: pos + chunk_size].unsqueeze(0)
            y_chunk  = tokens[pos + 1: pos + chunk_size + 1].unsqueeze(0)
    
            #STEP 1: SCORE with current LoRA (NO GRAD for the score)
            with torch.no_grad():
                with torch.autocast(device_type="cuda", dtype=torch.bfloat16):
                    logits = model.get_logits(x_chunk)
                per_tok_loss = F.cross_entropy(
                    logits[0].float(), y_chunk[0], reduction="none")
                chunk_loss_val = float(per_tok_loss.mean())
    
            loss_sum    += float(per_tok_loss.sum())
            token_count += int(y_chunk.numel())
            byte_count  += float(_count_bytes(y_chunk[0], x_chunk[0],
                                              base_bytes_lut, has_leading_space_lut, is_boundary_token_lut))
    
            #STEP 2: ADAPT LoRA on this chunk's loss
            #(uses only tokens ≤ pos+chunk_size, never future tokens)
            for _ in range(adapt_steps):
                optimizer.zero_grad()
                with torch.autocast(device_type="cuda", dtype=torch.bfloat16):
                    adapt_loss = _forward_with_lora(model, x_chunk, y_chunk)
                adapt_loss.backward()
                optimizer.step()
    
            pos += chunk_size
    
        _detach_lora(model)
        for p in model.parameters():
            p.requires_grad_(True)
        model.train()
    
        val_loss        = loss_sum / max(token_count, 1)
        bits_per_token  = val_loss / math.log(2.0)
        tokens_per_byte = token_count / max(byte_count, 1.0)
        return val_loss, float(bits_per_token * tokens_per_byte)
    
  13. himanalot commented on Mar 24, 2026

    @himanalot

    Are implementations like #611 legal? I'd have to imagine they're not—they're getting dramatically lower scores through re-scoring tokens after the model already trained on them. There's a new host of these types of submissions flooding in.

    It seems there's been a new scheme going on where people are using a score-every-epoch approach where they score all tokens in a document, train on them, and then rescore the same tokens and keep the minimum NLL across epochs. This doesn't seem to fit the goal of the challenge; it's really just exploiting eval and doesn't have any real innovation imo.

  14. valerio-oai commented on Mar 24, 2026

    @valerio-oai
    Contributor

    @himanalot Can't speak for every TTT scheme, but agreed that the score-every-epoch-and-keep-the-lowest-loss is equivalent to training on the val set, and is disallowed in my book.

  15. robinojw commented on Mar 24, 2026

    @robinojw

    @valerio-oai

    Personally I would prefer that TTT was written into the rules as explicitly disallowed, it wastes $ outside of training on compute. I called out whether or not my approach would be 'legal' in my PR and seems like the consensus is no.

    I can try another seed run with TTT_EPOCHS=1 to be fully compliant but I might need to apply for some more compute at this point. I'd expect to gain around ~0.04-0.06 BPB hopefully scoring around 1.10-1.12 but sounds like I should just scrap TTT all together?

    My PR: #620

  16. valerio-oai commented on Mar 24, 2026

    @valerio-oai
    Contributor

    @robinojw I see your point, but the reason we give the 10-min eval time is so folks can have interesting test-time approaches, so TTT is a valid approach in theory, but very easy to unintentionally leak val data into. There's still a long time to go, and I'm sure approaches will start to crystallize eventually.

  17. dentity007 commented on Apr 2, 2026

    @dentity007

    Hi @0hq @valerio-oai,

    Thanks for the TTT clarifications in this thread. I want to ask about the legality of my own submissions before the dashboard I maintain potentially misleads anyone.

    My PRs #948 and #968 use a Two-Level Dirichlet Posterior with Per-Order OBCL and phrase matching. During evaluation, these build n-gram frequency tables from tokens that have already been scored (backward-looking only, no future token access). The n-gram statistics are accumulated causally across the token stream, not per-document independently.

    This gives ~0.115 BPB, which is well below the neural-only range.

    Based on the discussion here, I want to understand where this falls:

    The n-gram cache only uses tokens that have already been scored (backward-looking), which aligns with the "use any preceding tokens you've already been tested on" ruling
    However, it accumulates statistics across documents (not per-document independent), which @samacqua's Case 2 vs Case 3 distinction suggests may be problematic
    Several other n-gram cache submissions have been closed, but no explicit ruling on the technique itself has been posted
    Could you clarify whether n-gram caching across the evaluation token stream is legal under the current rules? I'd rather flag my own submissions as non-compliant than have them sitting at the top of a leaderboard if they shouldn't be.

    For reference, I maintain the community dashboard at https://nathanmaine.github.io/parameter-golf-experiment-lab/ and I've already added TTT legality filtering based on this thread. I want to make sure I'm categorizing things correctly, including my own work.

    Thanks,
    Nathan (@dentity007)

  18. added 3 commits that reference this issue on Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions