Research Exposé · Agentic Systems Lab

What Does Continual Learning Actually Forget? Probing Memorization vs Generalization in Sequential Training

Ronald Domi July 2026 ~5 min read
Video walkthrough — coming soon

01 — ProblemWhat Does CL Actually Erase?

Continual learning research has always measured one thing: task performance. Can the model still solve Task A after training on Task B? This is the standard metric — backward transfer, forgetting rate, plasticity-stability tradeoff. It is a reasonable proxy, but it is incomplete.

Task performance captures generalized knowledge — the model's ability to solve a class of problems. It says nothing about a second type of knowledge living in the same weights: memorized knowledge — specific data points encoded verbatim during training. A model can forget how to perform a task while still having specific examples from that task memorized. Or it can perform well through generalization with no memorization at all. These are distinct phenomena. CL research currently has no tool to distinguish them.

This gap has a practical edge. Contamination detection — identifying whether a model was trained on benchmark test data — depends entirely on memorization signals surviving in the model's weights. If a model is contaminated at one training stage and then continues learning, do those signals persist? Do they decay? Does it depend on how the model is trained? Nobody has studied this.

Current contamination detection methods assume a static model. Real models are updated continuously — through fine-tuning, RLHF, and sequential task training. Whether contamination signals survive that process is entirely open.

02 — MotivationWhy This Gap Matters

For CL researchers, this opens a new diagnostic dimension. EWC, replay buffers, and LoRA adapters are compared on task performance alone. But they may treat memorized and generalized knowledge completely differently. EWC protects weights important for task performance — does it also protect memorization? Replay literally replays training data, which should strongly preserve memorization signals. LoRA freezes base model weights entirely — contamination stored there cannot be touched by new task adapters. Each method reveals something different about where knowledge lives in weight space, but only if you have a probe sensitive enough to distinguish memorization from generalization.

For auditing deployed models: a model trained at stage A, then updated at B, C, and D — can you still detect that stage A introduced contaminated data? For how long does the signal survive? Is there a point of no return? These questions determine whether retrospective auditing is even possible, which matters for anyone deploying models that learn continuously.

03 — ApproachCoDec as Probe, LMC as Explanation

This research uses two tools in combination: CoDec as the measurement instrument and Linear Mode Connectivity (LMC) barriers as the geometric explanation.

CoDec (Zawalski et al., ICLR 2026) detects memorization by exploiting a behavioral asymmetry. For data the model has never seen, in-context examples help — they provide useful signal. For data the model has memorized, in-context examples disrupt — the model already knows the answer and gets confused by seeing it reframed. The CoDec score is the fraction of test samples where adding context decreases the model's log-probability. High score (>80%) indicates contamination; low score (<50%) indicates clean data.

LMC barriers measure whether two model checkpoints occupy the same loss basin. A low barrier means a low-loss linear path exists between them in weight space — they are geometrically close. A high barrier means the model has moved into a different region. The hypothesis: CoDec signals persist as long as the model stays in the same basin as the contaminated checkpoint. When CL training crosses a basin boundary, the memorization signature collapses. If this holds, LMC barriers are a leading indicator of signal decay — detectable without needing the contaminated benchmark at all.

04 — PoCBaseline Already Running

To establish the baseline, I fine-tuned GPT-2 (117M) on a held-in text corpus and measured CoDec scores on that corpus versus a clean held-out set. This confirms the signal is detectable at this scale and that the re-implementation of CoDec matches the paper's behavior. The research question is what happens to the contaminated score as the model continues training on sequential unrelated tasks.

Baseline Result — GPT-2 (117M)
CoDec score · contaminated set
CoDec score · clean held-out set
Plot pending — experiment in progress

GPT-2 fine-tuned on 200 text passages. CoDec score computed over 100 contaminated samples and 100 clean held-out samples using k=3 in-context examples. A clear gap between the two scores confirms the signal is present and measurable at this scale.

05 — Research QuestionsFive Questions That Form the Thesis

06 — Experimental PlanThree Experiments, Increasing Depth

EXP 1 Decay Curves — The Core Experiment

Contaminate GPT-2 on a text corpus. Run 4–5 sequential CL tasks across unrelated text domains, saving checkpoints. At each checkpoint, measure CoDec score and LMC barrier back to the contaminated checkpoint. Plot both curves on the same axis against training steps.

Answers Q1, Q2, Q3. Three controls included: same compute on random data, same task repeated, and a clean model baseline.

EXP 2 CL Method Comparison

Repeat Experiment 1 under four CL strategies: naive fine-tuning, EWC, replay, and LoRA adapters. Compare CoDec decay curves and LMC barrier trajectories across methods. Each is predicted to show a structurally different pattern based on what weights it modifies.

Answers Q4. The centerpiece of the thesis — reveals what different CL methods actually do to memorized knowledge beyond task performance.

EXP 3 Contamination Localization

Train a model through stages A → B → C → D with contamination introduced at one unknown stage. Using all saved checkpoints, apply differential CoDec scoring and LMC barrier analysis to attribute contamination to the correct stage.

Answers Q5. Upside experiment — adds a practical contribution if Experiments 1 and 2 succeed.

07 — RisksWhat Could Go Wrong and Why It Is Still Fine

Risk Likelihood Mitigation
CoDec signal invariant to CL — does not decay across training stages 30% Reframe as a finding: memorization is robust to CL. Investigate via LMC which weight subspaces preserve the signal and why.
No correlation between LMC barrier and CoDec decay 25% Still publishable: basin structure does not predict memorization persistence — memorization lives deeper than basin membership implies.
Signal collapses after one CL step, no dynamics to study 20% Study single-step dynamics in detail. Pivot to: which training configurations preserve the signal for more than one step?
CoDec does not replicate cleanly at GPT-2 scale 10% Re-implement from paper directly. Simpler logprob-delta contamination signal as fallback if AUC is insufficient.
Appendix Implementation Details

Code for the core measurement tools. Both are re-implemented from scratch — no dependency on the original authors' codebase.

CoDec Signal — Re-implementation

# CoDec score: fraction of samples where context DECREASES confidence
# High score = model disrupted by context = memorized data
# Low score  = model helped by context   = unseen data

import torch
from transformers import GPT2LMHeadModel, GPT2Tokenizer

def logprob(model, tokenizer, text, context=None, device="cpu"):
    prompt  = (context + "\n\n" + text) if context else text
    ctx_len = len(tokenizer(context + "\n\n").input_ids) if context else 0
    ids     = tokenizer(prompt, return_tensors="pt").input_ids.to(device)
    with torch.no_grad():
        loss = model(ids, labels=ids).loss
    return -loss.item()

def codec_score(model, tokenizer, samples, k=3, device="cpu"):
    disrupted = 0
    for i, x in enumerate(samples):
        context  = " ".join([s for j, s in enumerate(samples) if j != i][:k])
        lp_plain = logprob(model, tokenizer, x, device=device)
        lp_ctx   = logprob(model, tokenizer, x, context=context, device=device)
        if lp_ctx < lp_plain:
            disrupted += 1
    return disrupted / len(samples)

LMC Barrier — Linear Interpolation

# Barrier > 0: loss hill exists between checkpoints = different basins
# Barrier ~ 0: low-loss path exists = same basin

def lmc_barrier(model_a, model_b, eval_fn, steps=11):
    """eval_fn: takes a state_dict, returns scalar loss"""
    loss_a   = eval_fn(model_a.state_dict())
    loss_b   = eval_fn(model_b.state_dict())
    baseline = (loss_a + loss_b) / 2
    max_loss = baseline

    for alpha in torch.linspace(0, 1, steps):
        a = alpha.item()
        interp = {
            k: (1 - a) * model_a.state_dict()[k] + a * model_b.state_dict()[k]
            for k in model_a.state_dict()
        }
        max_loss = max(max_loss, eval_fn(interp))

    return max_loss - baseline

Environment Setup

conda create -n poc python=3.11 -y
conda activate poc
pip install torch transformers datasets matplotlib

# GPT-2 117M fits in CPU RAM
# Fine-tuning 200 examples: ~10 min on CPU
# All claims scoped to GPT-2 scale; larger models are upside if compute allows