Category: Hard

  • DL0203 LLM Bias Detection Mitigation

    How do you detect and mitigate bias in LLM outputs, and what pipeline of classifier scoring, threshold calibration, and mitigation strategies can be applied?

    Answer

    Bias is not a single scalar you can read off a model, so detection begins by fixing a measurement protocol rather than by picking a classifier. The standard construction is a counterfactual prompt set in which only a demographic token changes, several sampled generations per prompt under fixed decoding parameters, and a scorer ensemble that turns each generation into numbers (toxicity, regard, sentiment, stereotype agreement, refusal). The quantity that matters is then a gap between groups with a confidence interval, not an absolute score, because every scorer has an offset that cancels when you subtract. Only after the gaps are measured does thresholding enter, and a single global threshold is almost always wrong because the guard classifier has its own group-dependent error rates. Mitigation is a ladder from cheap and reversible to expensive and durable: system-prompt constraints, decode-time filtering with rewrite, preference tuning on paired data, and finally changes to the pretraining or SFT mixture. The hardest part in production is that the detector and the model must be evaluated together, since a biased guard silently converts fairness work into unequal censorship.

    (1) Counterfactual Prompt Design: generate matched pairs where only the group term varies, so any score difference is attributable to that token rather than to topic or length.
    (2) Scorer Ensemble, Not One Classifier: a toxicity head, a regard/sentiment head, a rubric-driven LLM judge, and a refusal detector disagree in useful ways; a single classifier both misses stereotype-without-toxicity and over-flags reclaimed language.
    (3) Gaps With Uncertainty: report \Delta_{ab} with a bootstrap confidence interval per slice, because a 2-point gap on 40 prompts is noise and a 2-point gap on 4,000 prompts is a launch blocker.
    (4) Threshold Calibration Per Slice: choose the operating point from a per-group FPR target on benign text, and record how far apart the group thresholds have to be; that distance is itself a bias metric of the guard.
    (5) Mitigation Ladder: system prompt → decode-time filter and rewrite → counterfactual data augmentation and DPO → data-mixture change, in increasing cost, latency impact, and durability.
    (6) Guard The Guard: toxicity classifiers show measured dialect bias, so evaluate the detector on group-labelled benign text before you trust any gate it powers.

    Left-to-right pipeline: counterfactual prompt pairs feed the LLM under test with eight samples per prompt at fixed decoding, which fans out to three scorers (toxicity and regard classifier, stereotype LLM judge with rubric, refusal and sentiment detector), which feed per-group aggregation of gaps with bootstrap confidence intervals, then a threshold gate calibrated per group at five percent false-flag rate, which routes to allow, rewrite and re-sample, or refuse and log slice; a bottom loop sends aggregated gaps into an offline mitigation box covering counterfactual data augmentation, DPO on paired preferences, activation steering, and a tighter system prompt, which feeds back into the model

    Figure 1: The measurement half of the pipeline is online and the mitigation half is offline. The gate on the right acts on a single generation, while the aggregation block is the only place where a bias claim can legitimately be made, because bias lives in a distributional gap and not in any individual score.

    Two implementation details decide whether the numbers mean anything. First, decoding must be frozen across the counterfactual arms: temperature, top-p, seed policy, and sample count identical, otherwise you are measuring sampling variance. Second, refusals must be scored separately. A model that answers a question about one group and declines the matched question about another has a large refusal-rate gap while showing a near-zero toxicity gap, and a pipeline that only tracks toxicity will report the model as clean. On the mitigation side, the same discipline applies in reverse: any intervention must be re-measured on the identical prompt set plus a general-capability suite, because prompt-level and decode-time fixes routinely buy a lower gap at the price of higher refusal on benign requests, which is a regression that no bias dashboard shows.

    Mathematical Formulation:
    s = f_{\phi}(x, y) \in [0, 1]
    \Delta_{ab} = \mathbb{E}[s \mid g = a] - \mathbb{E}[s \mid g = b]
    \mathrm{FPR}_g(\tau) = P(s > \tau \mid g, \mathrm{benign})
    \tau_g = \min \{ \tau : \mathrm{FPR}_g(\tau) \leq \alpha \}
    \mathrm{ECE} = \sum_{b=1}^{B} \frac{n_b}{N} |\bar{s}_b - \bar{y}_b|

    Where:

    • s is the scorer output for prompt x and generation y, produced by a guard classifier or judge with parameters \phi that are separate from the model under test.
    • g is the group or slice label attached to the prompt (demographic term, dialect, language), and a, b are the two arms of a counterfactual pair.
    • \Delta_{ab} is the group gap, the primary detection statistic; it is reported with a bootstrap interval over prompts, not over samples, since samples within a prompt are correlated.
    • \tau is the gate threshold and \alpha the tolerated false-flag rate on benign text, so \tau_g is the smallest threshold meeting that budget within group g.
    • b \in \{1, \ldots, B\} indexes confidence bins with n_b items out of N; \bar{s}_b is the mean score and \bar{y}_b the empirical label rate, so ECE measures whether a score of 0.7 actually means 70% harmful.

    Worked Calibration Example (5,000 benign sentences per group):
    \mathrm{FPR}_a(0.50) = 115 / 5000 = 0.023
    \mathrm{FPR}_b(0.50) = 455 / 5000 = 0.091
    \tau_a = 0.40
    \tau_b = 0.58

    The same threshold of 0.50 therefore flags benign text from group b roughly four times as often, and equalizing the false-flag rate at \alpha = 0.05 requires thresholds 0.18 apart. That spread is the diagnostic: it says the guard classifier, not the generator, is the largest bias source in the stack, and the correct response is usually to fix the classifier’s training data rather than to ship group-conditional thresholds.

    Line chart of false-flag rate on benign text versus gate threshold for two groups, both decreasing curves with group B consistently above group A; a vertical dashed line at threshold 0.5 meets the curves at 2.3 percent and 9.1 percent, a horizontal line marks the 5 percent target, and two circular markers show the per-group thresholds 0.40 and 0.58 that achieve 5 percent each

    Figure 2: A single operating point produces two different error rates. Reading the gate at fixed threshold hides the disparity, while reading it at fixed false-flag rate exposes it as a horizontal distance between the two curves, which is the quantity to drive toward zero when you retrain the guard.

    PropertyPrompt / system levelDecode-time filter and rewriteTraining-time (CDA, DPO)
    Where it actsInstruction and few-shot context, no weight changeGuard score on the sampled output, then re-sample or refuseWeights, via augmented pairs or preference optimization
    Cost to shipHours, revertible with a config pushOne extra forward pass per output, plus rewrite latency on flagsDays of data work and a full eval cycle per iteration
    DurabilityLow, defeated by paraphrase and long context driftMedium, bounded by the guard’s own recall and calibrationHigh, the behaviour itself moves rather than being masked
    Dominant failure modeOver-refusal on benign group-related questionsInherits the classifier’s dialect bias, so filtering is unequalCapability regression and reward hacking of the preference signal
    What to measure afterRefusal-rate gap on benign prompts per slicePer-group FPR at fixed threshold, plus added p95 latencyCounterfactual gap, general benchmarks, and win rate versus baseline

    Login to view more content
  • DL0202 RL Production Recommendation

    What are the challenges of using Reinforcement Learning in a production recommendation system, such as the YouTube home feed or Spotify’s carousels?

    Answer

    The hard part is almost never the learning algorithm. A production recommender is an off-policy problem with a combinatorial action space, a corrupted reward signal, and a closed feedback loop, and each of those violates an assumption that textbook RL takes for granted. You cannot explore freely on paying users, so the only training data is what yesterday’s serving policy logged, which makes importance weighting and its variance the central engineering problem rather than a footnote. The action is not one item but a slate of K items drawn from a catalogue of order 10^{8}, so enumerating a Q value per action is impossible and the policy must be factorized or decomposed. Finally, the reward you actually want, long-term satisfaction, arrives days after the action, and is confounded by position bias, seasonality, and the recommendations themselves.

    (1) Off-Policy By Construction: training data comes from a logging policy \beta, not from the policy you are optimizing, so every gradient needs an importance correction whose variance grows with the mismatch.
    (2) Combinatorial Slate Actions: a page of K items from N candidates gives \binom{N}{K} actions, forcing decompositions such as top-K correction or SlateQ‘s per-item value factorization.
    (3) Reward Specification And Delay: clicks are immediate and gameable, retention is the real objective and is observed days later, so credit assignment spans sessions rather than steps.
    (4) Feedback Loops And Non-Stationarity: the deployed policy shapes tomorrow’s training distribution, so a small early bias compounds instead of averaging out, and the catalogue and user base drift underneath the model.
    (5) Offline Evaluation Is Unreliable: off-policy estimators are high variance on large action spaces, so offline value gains routinely fail to reproduce in an A/B test.
    (6) Infrastructure Cost: you must log propensities at serving time, keep the randomization budget small, and still return a ranked page inside a tens-of-milliseconds latency budget.

    Closed-loop diagram with four boxes in a row: serving policy pi-theta with retrieval and ranker over a 10^8 item catalogue, slate of K items shown to the user where position bias enters, logged feedback carrying the action, the propensity beta and a delayed reward, and off-policy training with IPS weights, clipping and top-K correction, with a return arrow deploying new policy weights back to serving

    Figure 1: The loop is the problem. Supervised ranking treats the log as a fixed dataset, but here the policy under training generates its own future training distribution, so bias compounds across deployments and the reward attached to each logged action is both delayed and confounded by presentation.

    The standard production recipe, popularized by YouTube’s top-K REINFORCE recommender, is to keep policy-gradient learning but reweight each logged trajectory by the ratio between the new policy and the logging policy. Two corrections then appear. The first is weight clipping, which caps the influence of any single log line and trades unbounded variance for a controlled downward bias. The second is the top-K correction factor, which accounts for the fact that the system shows K slots rather than sampling one item, and which flattens the gradient on items the policy already places with near certainty. Both are variance-control devices, and understanding why they are needed is the difference between a candidate who has read the paper and one who has shipped the system.

    Mathematical Formulation:
    J(\theta) = \mathbb{E}_{\tau \sim \pi_{\theta}}\left[\sum_{t=0}^{T} \gamma^{t} r_{t}\right]
    w_t = \dfrac{\pi_{\theta}(a_t \mid s_t)}{\beta(a_t \mid s_t)}
    \tilde{w}_t = \min(w_t, c)
    \lambda_K(s_t, a_t) = K\left(1 - \pi_{\theta}(a_t \mid s_t)\right)^{K-1}
    \hat{g} = \sum_{t} \tilde{w}_t\, \lambda_K\, R_t\, \nabla_{\theta} \log \pi_{\theta}(a_t \mid s_t)
    \mathrm{ESS} = \dfrac{\left(\sum_i w_i\right)^{2}}{\sum_i w_i^{2}}

    Where:

    • J(\theta) is the expected discounted return of the target policy over a user trajectory \tau, with discount \gamma \in (0,1] and per-step reward r_t.
    • s_t is the user state (interaction history and context), a_t the item actually shown and logged, and R_t the return following that action.
    • \pi_{\theta} is the target policy and \beta the logging (behavior) policy; w_t is their ratio, and it is undefined wherever \beta(a \mid s) = 0.
    • c is the clipping threshold; \tilde{w}_t is the truncated weight, which is biased but bounded.
    • \lambda_K is the top-K correction for showing K slots instead of one; it tends to K for rare items and to 0 as \pi_{\theta}(a \mid s) approaches 1.
    • \mathrm{ESS} is the effective sample size over i \in \{1,\ldots,N\} logged records, and it is the number that decides whether a 10M-row log is really 10M rows.
    Log-scale line chart of effective sample size fraction versus policy mismatch sigma, showing an unclipped importance-sampling curve collapsing from near one to about one thousandth as sigma grows to three, a curve clipped at one hundred decaying more slowly, and a curve clipped at ten still retaining several percent, with an annotation marking that at sigma equal to two the unclipped estimator retains about two percent of the logged rows

    Figure 2: Why off-policy learning is a variance problem before it is an optimization problem. As the target policy drifts from the logging policy, the effective sample size of the log collapses exponentially, so a huge log can carry the statistical weight of a small one. Clipping restores usable sample size at the price of a systematic downward bias on exactly the actions the new policy likes most.

    This is also why the choice between supervised ranking, a contextual bandit, and full sequential RL is a real design decision rather than a question of ambition. A bandit captures most of the exploration benefit with a single-step correction and no long-horizon credit assignment, and it is what Spotify’s explainable-recommendation work uses for carousel and explanation selection. Full RL earns its cost only when an action genuinely changes the future state, for example when promoting a new creator today changes what the user is willing to watch next month.

    PropertySupervised rankerContextual banditFull sequential RL
    ObjectivePredict the immediate label, click or watch probabilityMaximize immediate reward under uncertaintyMaximize discounted return across future sessions
    Data requiredLogged impressions and labels onlyLogged action plus its propensityFull trajectories with propensities and delayed rewards
    Correction neededNone in principle, though position bias still needs debiasingSingle-step IPS or doubly robustPer-step IPS, clipping, top-K factor, bootstrapped value targets
    Exploration costNone, and therefore no counterfactual coverageSmall randomized slot, epsilon-greedy or Thompson samplingRandomization plus pessimism penalties for out-of-support actions
    Dominant failureMyopic optimization that rewards clickbaitNo credit for downstream session valueVariance explosion offline and feedback-loop drift online

    Login to view more content
  • DL0201 Pretraining Loss Spike Debugging

    During pretraining of a 100B parameter model on a large GPU cluster, you suddenly see loss spikes. How do you debug this, and is it a data issue, a learning-rate problem, or hardware failure?

    Answer

    All three causes are real at this scale, and they leave different fingerprints, so the answer is a triage order rather than a guess. Run the checks in order of cost: first the numerics and per-rank logs you already have on disk (NaN or Inf, one data-parallel rank far from the mean loss, XID or ECC events, NCCL timeouts), then the optimizer traces (global gradient norm, Adam update ratio, maximum attention logit, output logit magnitude), and only then the data, which is proven guilty only by replaying the exact batch from the pre-spike checkpoint. The shape of the curve already narrows the space: a single sharp spike that recovers within a few thousand steps is usually a batch-times-model-state interaction, a slow creeping divergence preceded by growing logits is a learning-rate or numerics problem, and an instant jump to NaN with a stalled step time is hardware. The industry-standard mitigation for the first case is the one PaLM reported: rewind to a checkpoint roughly 100 to 200 steps before the spike and skip a few hundred batches, which removes the spike even though the same data is harmless from a different model state. That asymmetry is the single most important fact in this debugging problem, because it means “the data was bad” is almost never the correct conclusion on its own.

    (1) Read The Shape First: recoverable spike, creeping divergence, and hard fault are three distinct signatures, and each maps to a different subsystem.
    (2) Cheapest Check First: numerics and per-rank divergence cost nothing to inspect, optimizer traces cost one dashboard query, and a batch replay costs about one node-hour.
    (3) Never Trust The Global Loss: with 512 data-parallel ranks a single sick rank moves the average by a fraction of a percent, so log per-rank loss and gradient-norm maxima, not just the mean.
    (4) Silent Data Corruption Has No NaN: a degrading GPU can return wrong arithmetic with no error flag, so keep a bitwise-reproducibility canary that reruns one batch on two hosts and compares.
    (5) Data Is Guilty Only On Replay: rerun batch b_s from the checkpoint at step s-1 on a fresh replica; if the spike does not reproduce, the batch is not the cause.
    (6) Skip-And-Resume Versus Config Change: rollback is right for isolated spikes, but recurring spikes plus growing attention logits mean you must pay for QK-norm, z-loss, a lower peak learning rate, or fp32 optimizer state.

    Two-row by three-column chart grid. Top row shows training loss versus step for three cases: a single sharp spike at step 9000 that recovers to trend, a creeping divergence starting near step 11500 that never returns, and a curve that ends abruptly at step 15000 with a NaN marker. Bottom row shows the corresponding global gradient norm on a log scale with a clipping threshold line at 1.0: a single narrow 15x spike, a gradient norm that creeps up for two thousand steps before the loss moves, and a flat trace that terminates in an infinite value.

    Figure 1: The same symptom, three diseases. Case A is a recoverable spike whose gradient norm spikes for a handful of steps and then returns, case B is a creeping divergence in which the gradient norm rises for roughly 2,000 steps before the loss visibly moves, and case C is a hard fault with no precursor at all. Note that gradient clipping at 1.0 caps the applied update but does not hide the raw norm, which is exactly why the raw norm must be logged.

    The mechanism behind case B is worth being precise about, because it is the one people misdiagnose as bad data. As training proceeds, attention logits q_i^\top k_j / \sqrt{d_h} can grow without bound; the softmax saturates, one head collapses onto a single position, and the gradient through that head becomes both tiny and extremely sharp. In parallel, the output logits drift so that \log Z wanders, which makes the cross-entropy surface stiff in a direction the optimizer cannot see from the loss value alone. Case A has a different mechanism: in bf16 or when optimizer state is stored in low precision, the Adam second moment for a rarely-activated parameter block (embeddings for rare tokens are the classic example) can decay toward the epsilon floor, after which one moderate gradient produces an update whose effective step size is orders of magnitude larger than intended. The debugging pipeline is therefore always the same: detect → localize → replay → mitigate, with instrumentation decided before the run rather than after the first spike.

    Mathematical Formulation:
    \ell_t > \mu_{t-W:t} + 3\,\sigma_{t-W:t}
    \theta_{t+1} = \theta_t - \eta_t \dfrac{\hat m_t}{\sqrt{\hat v_t} + \epsilon}
    r_t = \dfrac{|\hat m_t|}{\sqrt{\hat v_t} + \epsilon}
    r_{\max} \approx \dfrac{1-\beta_1}{\sqrt{1-\beta_2}}
    s_{ij} = q_i^\top k_j / \sqrt{d_h}
    \mathcal{L} = \mathcal{L}_{\mathrm{CE}} + \alpha (\log Z)^2

    Where:

    • \ell_t is the training loss at step t, and \mu and \sigma are the mean and standard deviation over a trailing window of W steps (a few hundred works well); this is the spike detector that should fire an alert, not a human eye on a dashboard.
    • \theta_t are the parameters, \eta_t the scheduled learning rate, and \hat m_t and \hat v_t the bias-corrected first and second Adam moments with decays \beta_1 and \beta_2.
    • r_t is the update ratio, the per-block quantity to log alongside the gradient norm, because it exposes the actual step size the optimizer is taking rather than the size of the gradient.
    • r_{\max} is the ratio a single outlier gradient can produce, roughly 0.1/\sqrt{0.05} \approx 0.45 for \beta_1 = 0.9 and \beta_2 = 0.95; this bound holds only while \sqrt{\hat v_t} dominates \epsilon, and it is epsilon underflow that breaks it.
    • s_{ij} is the pre-softmax attention logit for query i and key j with head dimension d_h; tracking \max_{ij} |s_{ij}| per layer is the earliest available warning of the creeping-divergence mode.
    • Z = \sum_{v=1}^{V} \exp(z_v) is the softmax partition function over vocabulary size V, and \alpha is the z-loss coefficient (commonly 10^{-4}) that pins \log Z near zero at negligible quality cost.

    The r_{\max} \approx 0.45 bound is the reason “one weird document blew up the run” is usually wrong: with healthy second moments, Adam already damps a single 30x outlier gradient to less than a normal step. What actually hurts is a sequence of correlated large gradients, or a block whose \hat v_t has collapsed so that the denominator is dominated by \epsilon. That distinction determines the fix: correlated gradients are a data-ordering and learning-rate problem, while a collapsed second moment is a precision problem solved by keeping optimizer state in fp32 and raising \epsilon.

    Left-to-right triage diagram. A trigger box for a detected loss spike fans out to three ordered check boxes: numerics and per-rank divergence, optimizer signals such as gradient norm and maximum attention logit, and a replay of the offending batch from the previous checkpoint. Each check has a yes branch to an evidence box listing concrete symptoms, and each evidence box points to a verdict box: hardware, learning rate and numerics, or data crossed with model state. Vertical clean arrows connect check one to check two and check two to check three.

    Figure 2: The triage order that makes this question answerable in an interview. The three branches are ordered by cost per bit of information, not by likelihood, and the replay step is what separates a genuinely corrupt shard from a batch-times-state interaction that a 400-batch skip will silently fix.

    SignalData and model stateLearning rate and numericsHardware and interconnect
    Loss shapeSharp isolated spike, recovers to trend within a few thousand stepsRepeated spikes of growing size, or a divergence that never recoversInstant NaN or Inf, or a flat line while step time stalls
    Gradient normOne narrow burst of a few steps, clipping engages brieflySlow upward drift over thousands of steps, clipping engages permanentlyJumps straight to Inf, or becomes exactly zero on one rank
    Per-rank patternElevated on the ranks holding the offending microbatches onlyUniform across all ranks, since the cause is the shared updateOne rank or one host is an extreme outlier, or a canary mismatches bitwise
    Replay testReproduces from the same checkpoint, disappears from a different oneReproduces from any nearby checkpoint with the same scheduleDoes not reproduce on a healthy node with identical inputs
    Corroborating logsSample dump shows repeated n-grams, a truncated shard, or non-text bytesMax attention logit and update ratio rising, parameter norm inflatingXID or ECC entries, NCCL timeouts, thermal throttling, link flaps
    First mitigationRewind about 200 steps, skip 200 to 500 batches, then dedup or drop the shardLower peak LR, extend warmup, add QK-norm and z-loss, keep fp32 optimizer stateFence the host, restore the last checkpoint, rerun on a spare node

    The operational context matters for how much of this you should automate. Meta reported 419 unexpected interruptions during Llama 3 405B pretraining, with roughly 78% traced to hardware, which means at 100B scale a fault-driven anomaly is not an exotic event but a weekly one. That argues for treating spike response as a control loop: an automatic detector on the trailing-window rule, automatic checkpoint retention dense enough to rewind 200 steps, automatic host fencing on XID events, and a human decision only for the residual class where the numerics themselves are unstable.


    Login to view more content
  • DL0199 Sensitive Data Memorization Remediation

    Imagine you’ve trained a model with unusually strong memorization of sensitive data. What steps would you take next?

    Answer

    Handle it as a privacy incident with a measurement problem at its core, not as a modeling curiosity. The first hour is containment: stop the rollout, pin and lock every checkpoint derived from the suspect run, and bring legal and privacy owners in immediately, because notification clocks (for example the 72-hour clock in GDPR Article 33) start from awareness rather than from confirmation. Then quantify before you touch anything, since “the model memorizes” is not an actionable statement until you have a per-record extraction rate under an adversarial prompt distribution, a canary exposure number, and a membership-inference AUC. Diagnosis almost always lands on the same few causes: near-duplicate records, personal data that survived scrubbing because it arrived through production logs, or too many epochs over a small sensitive shard. Only then do you pick the cheapest remediation tier that clears an agreed risk gate, escalating output guard → targeted unlearning → retrain with deduplication and DP-SGD, and you verify with adversaries you did not design the fix against.

    (1) Contain Before You Explain: Freeze the rollout, revoke external checkpoint and API access, and preserve prompts, completions, and data manifests so the incident can be scoped later.
    (2) Quantify With Adversarial Probes: Report extraction rate under prefix, divergence, and template attacks plus canary exposure in bits, not a handful of prompts that happened to leak.
    (3) Duplication Is The Usual Root Cause: A record repeated a dozen times is far more extractable than a record seen once, so a near-duplicate audit on the flagged records comes before any algorithmic fix.
    (4) Use A Cost-Ordered Remediation Ladder: Output filters buy hours, targeted unlearning buys weeks, and only retraining with deduplication and DP-SGD yields a formal per-record bound.
    (5) Verification Must Be Independent: Re-measure on held-out canaries and an adaptive red team, check utility regressions, and probe for relearning, because suppressed knowledge often returns after light fine-tuning.
    (6) Deletion Obligations Propagate: Embeddings, indexes, eval logs, distilled students, and downstream fine-tunes all inherit the memorization, so the remediation plan must enumerate every derived artifact.

    Serpentine incident-response flow: top row contains contain, quantify and diagnose stages; the middle row is an escalating remediation ladder read right to left from output guard to targeted unlearning to full retrain with deduplication and differential privacy, with escalate arrows between tiers; the bottom row runs verify, monitor and close out

    Figure 1: The playbook, ordered by cost rather than by ambition. Each escalation step is triggered by a failed risk gate, not by preference, and the loop only closes when independent probes and a documented data lineage both hold.

    The measurement phase decides everything downstream, so it deserves real engineering. Insert canaries (synthetic secrets with known formats and known insertion counts) into future runs, and for the current model estimate exposure by ranking the true secret against a candidate set of same-format alternatives under the model’s own likelihood. Complement this with black-box extraction rate: run a large, adversarially generated prompt set and count verbatim recoveries of records you know are in the training set. Two subtleties trip teams up. A single leaked record is enough to be reportable, so the metric that matters is a confidence bound on the leak probability rather than a point estimate. And zero observed hits is not zero risk: with no hits in N probes, the 95% upper bound on the per-probe rate is about 3/N, which is why a 200-prompt smoke test can never clear a production gate.

    Mathematical Formulation:
    \mathrm{exposure}(s) = \log_2 |\mathcal{R}| - \log_2 \mathrm{rank}(s)
    \mathrm{rank}(s) = |\{ r \in \mathcal{R} : \mathcal{P}(r) \leq \mathcal{P}(s) \}|
    \hat{e} = \frac{1}{N} \sum_{i=1}^{N} \mathbf{1}[ g(p_i) = s_i ]
    \hat{e} = 0 \Rightarrow p_{95} \approx 3/N
    \Pr[M(D) \in S] \leq e^{\epsilon} \Pr[M(D') \in S] + \delta

    Where:

    • s is the sensitive string under test and \mathcal{R} the set of same-format candidates it is ranked against, so \log_2 |\mathcal{R}| (30 bits for a 9-digit-scale secret) is the maximum exposure.
    • \mathcal{P}(\cdot) is the model’s perplexity of a candidate; \mathrm{rank}(s) = 1 means the true secret is the model’s single most likely completion.
    • \hat{e} is the empirical extraction rate, p_i the i-th adversarial prompt, g the decoding procedure, and N the number of probes.
    • p_{95} is the 95% upper confidence bound on the per-probe leak probability, which is the number a risk gate should be written against.
    • M is the training mechanism, D and D' two datasets differing in one record, and (\epsilon, \delta) the differential privacy budget that bounds any single record’s influence on the released weights.
    Log-scale chart of canary exposure in bits against the number of times a sensitive record appears in the training corpus, showing a baseline curve that saturates near 30 bits after a few dozen duplicates, a slower curve for deduplication plus loss masking, and a nearly flat curve for DP-SGD training, with a shaded region above 20 bits marking where a single greedy decode recovers the secret

    Figure 2: Why the duplicate audit comes first. Under ordinary training, roughly 13 near-duplicates of one record are enough to push exposure past 20 bits, where a single greedy decode recovers it; mitigations such as span masking only shift the curve right, while DP-SGD flattens it at the cost of long-tail accuracy.

    Remediation tier3a. Output-side guard3b. Targeted unlearning3c. Retrain (dedup + DP-SGD)
    What it changesDecoding and post-processing only; weights untouchedWeights, via a forget-set objective on the flagged recordsThe data pipeline and the training objective, from a clean checkpoint
    Time to deployHoursHours to daysDays to weeks
    Compute costNegligible, plus per-token filter latencyRoughly 0.1 to 1 percent of the original training FLOPsA full training budget, plus DP-SGD clipping overhead
    GuaranteeNone; only block-list coverage of known stringsEmpirical and benchmark-dependent; reversible by relearningFormal per-record bound with a stated epsilon and delta
    Utility costNear zero, aside from false blocks on common stringsMeasurable drift on neighboring, legitimate knowledgeLargest on rare classes and long-tail facts
    Dominant failure modeParaphrase, translation, or encoding walks around the matchThe fact is still latent; only the surface form is suppressedEpsilon accounting is void if one record recurs under many users

    Login to view more content
  • DL0196 Reward Model Overfitting

    How do you prevent the reward model from overfitting in RLHF, and what role do data diversity, ensemble reward models, and uncertainty estimation play?

    Answer

    A reward model (RM) is a learned proxy for human judgement fitted on a finite set of preference pairs, so it fails in two distinct ways that need different defenses. The first is ordinary statistical overfitting: held-out pairwise accuracy typically plateaus in the 65-75% band and then degrades, which is why InstructGPT-era practice is a single epoch at a small learning rate, since a second epoch mostly memorizes annotator noise. The second and more damaging failure is over-optimization, where held-out accuracy still looks acceptable but the policy drifts into a region the RM never saw labeled, so the proxy score climbs while true human preference falls. The defenses are therefore spread across the whole loop rather than concentrated in the RM training script. Diverse prompts and on-policy responses widen the region where the RM is actually supervised, an ensemble of independently seeded RMs converts the unsupervised region into a measurable disagreement signal, and a pessimistic aggregate such as mean minus \lambda times the spread turns that signal into a reward the policy cannot profit from. A KL penalty to the frozen reference policy plus periodic relabeling of fresh on-policy samples keeps the optimizer inside the RM’s zone of competence.

    (1) Two Different Failures: Classical overfitting is measured on held-out preference pairs, while over-optimization is a Goodhart effect visible only when the RM is used as an RL objective. Fixing one does not fix the other.
    (2) Train Short, Regularize Hard: One epoch, learning rates around 10^{-5} or below, early stopping on held-out pairwise accuracy, plus label smoothing or a margin term and an auxiliary language-modeling loss to keep the backbone from collapsing.
    (3) Data Diversity Sets The Support: Prompts from real traffic, red-teaming, and synthetic edge cases, with responses sampled from several policy checkpoints and temperatures, so the RM is supervised where the policy will actually go.
    (4) Multiple Annotators Bound The Ceiling: Human agreement of roughly 70-80% on subtle pairs caps achievable accuracy, so a model chasing 90% training accuracy is fitting noise, not preference.
    (5) Ensembles Estimate Epistemic Uncertainty: K = 3 to 5 members whose pretraining seeds differ disagree most off-distribution, which is exactly where reward hacking begins.
    (6) Pessimism Turns Uncertainty Into Reward: Optimizing a lower confidence bound or the worst-of-K score delays the over-optimization peak instead of merely detecting it.
    (7) Close The Loop: Iterative rounds that relabel on-policy samples attack the root cause, distribution shift, rather than its symptom.

    Loop diagram: a diverse prompt pool feeds response sampling from many policy checkpoints and temperatures, which feeds human preference labeling with two to three annotators per pair, which trains an ensemble of K reward models with independent pretrain seeds, whose outputs are aggregated into a mean and a spread, converted into a conservative reward equal to the mean minus lambda times the spread, and used by a PPO or GRPO policy update with a KL penalty, with a dashed feedback edge sending fresh on-policy responses back for relabeling each round

    Figure 1: Where each defense sits in the loop. Diversity widens the labeled support, K independently seeded reward models turn unlabeled regions into a measurable spread s, and the conservative reward makes the policy pay for that spread. The dashed feedback edge is the only mechanism that actually removes distribution shift rather than penalizing it.

    Data diversity is the highest-leverage lever because it changes the support of the training distribution rather than the fit on a fixed support. Preference sets collected from one prompt source and one policy checkpoint produce an RM that is accurate on that slice and arbitrary elsewhere, and the policy will find “elsewhere” within a few thousand PPO steps. Two diversity axes matter most: the prompt distribution, which should mix production traffic, adversarial red-team prompts, and long-tail synthetic cases, and the response distribution, which should include samples from several checkpoints, several temperatures, and deliberately balanced lengths so the RM does not learn that longer equals better. Multi-annotator labeling on a subset gives the agreement rate, and that rate is the practical accuracy ceiling: driving training accuracy far past it is a direct measurement of memorization.

    Mathematical Formulation:
    \Delta_\theta = r_\theta(x, y_w) - r_\theta(x, y_l)
    \mathcal{L}_{\mathrm{RM}} = -\log \sigma(\Delta_\theta)
    \bar r(x,y) = \frac{1}{K}\sum_{k=1}^{K} r_k(x,y)
    s^2(x,y) = \frac{1}{K}\sum_{k=1}^{K}(r_k - \bar r)^2
    r_{\mathrm{LCB}} = \bar r - \lambda s
    J(\pi) = \mathbb{E}_{\pi}[r_{\mathrm{LCB}}] - \beta D_{\mathrm{KL}}

    Where:

    • \Delta_\theta is the score margin between the preferred response y_w and the rejected response y_l for prompt x, and \sigma is the logistic function, so \mathcal{L}_{\mathrm{RM}} is the Bradley-Terry negative log-likelihood.
    • \theta are the RM parameters: a pretrained or SFT backbone with a scalar head, usually trained for one epoch so \mathcal{L}_{\mathrm{RM}} never approaches zero.
    • r_k is the score of ensemble member k \in \{1,\ldots,K\}, and \bar r their mean, which is also a mild variance reduction on the reward itself.
    • s(x,y) is the ensemble spread, used as an epistemic uncertainty proxy: it stays small on the labeled support and grows on responses no annotator ever judged.
    • \lambda \geq 0 is the pessimism coefficient, commonly in the range 0.5 to 2; \lambda = 0 recovers plain mean aggregation.
    • \beta is the KL coefficient (typically 0.01 to 0.05) and D_{\mathrm{KL}} = D_{\mathrm{KL}}(\pi \,\|\, \pi_{\mathrm{ref}}) the divergence from the frozen reference policy, which bounds how far the policy may travel from the RM’s support.
    Two-panel chart. Left panel: reward model training accuracy on preference pairs climbing from 0.69 toward 0.98 over four epochs while held-out validation accuracy peaks near 0.73 at one epoch and then declines, with an early-stopping marker at one epoch. Right panel: as policy drift measured by the square root of KL increases, the proxy reward from the reward model rises monotonically, the gold human reward peaks around square root KL of nine and then falls, and a conservative lower-confidence-bound reward reaches a later and higher peak around thirteen

    Figure 2: Left: held-out pairwise accuracy peaks near one epoch while training accuracy keeps climbing, which is why single-epoch training with early stopping is the default. Right: the same RM used as an RL objective. The proxy score rises monotonically while the gold reward peaks and then declines, and pessimistic aggregation pushes that peak further out. Curves are schematic and follow the functional form fitted by Gao et al.

    The right panel is the empirically important one, and its shape is well described by the over-optimization scaling law, where the gold reward is a function of the drift d = \sqrt{D_{\mathrm{KL}}} rather than of training steps.

    Over-Optimization Law:
    R_{\mathrm{gold}}(d) = d\,(a - b \log d)
    d = \sqrt{D_{\mathrm{KL}}(\pi \,\|\, \pi_{\mathrm{ref}})}

    Here a and b are fitted constants that improve with RM size and with the amount of preference data, so a larger RM trained on more diverse comparisons does not merely score better, it peaks later. Ensembling contributes on two fronts. Averaging K members reduces variance in the reward itself, which stabilizes advantage estimates, and the spread s provides the only cheap in-loop signal that the policy has left the supervised region. In practice the disagreement metric is worth logging even if you never subtract it: a sudden rise in mean s over sampled rollouts is an early warning that arrives before the gold reward turns over. Subtracting it, as in conservative or worst-of-K optimization, costs a little early progress because uncertain but genuinely good responses are also penalized, and buys a substantially later peak. The critical implementation detail is that members must be diverse in their errors: fine-tuning five heads from one pretrained checkpoint with different shuffles yields correlated mistakes, so the spread underestimates true uncertainty precisely on hacked outputs.

    PropertyData diversity and relabelingEnsemble of K reward modelsPessimistic aggregation
    What it fixesRemoves the unsupervised region the policy would exploitMeasures that region and reduces reward varianceMakes exploiting that region unprofitable
    MechanismWidens the support: prompt sources, checkpoints, temperatures, fresh on-policy labelsSpread across members as an epistemic uncertainty proxyOptimize a lower confidence bound or the worst-of-K score
    Typical settingRelabel every RLHF round; 2 to 3 annotators on a calibration subsetK = 3 to 5, independent pretrain seeds plus bootstrapped dataPessimism coefficient roughly 0.5 to 2, tuned on gold evaluations
    CostHuman annotation budget and pipeline latency per roundK times training and K times reward-inference computeSlower early progress; uncertain-but-good responses are penalized
    Fails whenAnnotators share a bias, such as preferring length or confident toneMembers share a pretrained backbone, so errors correlateSpread is miscalibrated, so the penalty blocks progress or misses hacks

    Login to view more content
  • DL0194 Sensor Degradation Feature Extractor

    How do you detect and handle sensor degradation (lens distortion, rain noise, sensor misalignment) dynamically within a deep feature extractor pipeline, for a production perception stack such as a robotaxi’s camera-LiDAR fusion model or a Valeo-style surround-view ADAS?

    Answer

    Degradation is not handled by making the backbone bigger. It is handled by a cheap monitoring path that runs beside the feature extractor and a policy layer that changes how the extractor’s outputs are consumed. Three monitor families are affordable per frame: referenceless image-quality and soiling heads on the raw or early-feature tensor, feature-space drift statistics such as a Mahalanobis distance between the current channel-mean vector and the training reference, and geometric self-consistency residuals such as cross-sensor reprojection error, which is the only signal that separates a genuine extrinsic shift from bad weather. Detection alone is worthless, so those signals drive three mitigations: a quality gate that reweights per-sensor features before fusion, FiLM-style conditioning that lets the shared trunk adapt its normalization to the measured degradation, and an operational-design-domain (ODD) fallback that reduces speed, disables a fused output, or triggers a wiper and an online extrinsic re-estimation. The pipeline therefore reads capture → ISP → undistort → backbone → gate → fusion → heads, with the monitors tapping the first three stages and writing only into the gate.

    (1) Separate Detection From Correction: a small monitor head that answers “how bad is this input” is far easier to train and validate than a backbone expected to be silently invariant to everything. It also gives you an auditable signal to log.
    (2) Three Complementary Signals: pixel-level quality catches soiling and droplets, feature drift catches global appearance shift like rain veiling or blooming, and reprojection residuals catch calibration error. No single one covers all three failure classes.
    (3) Geometry For Geometry Faults: a 0.5 degree extrinsic yaw drift leaves every image looking perfectly clean, so appearance-based monitors are blind to it; only cross-sensor residuals or photometric alignment expose it.
    (4) Gate The Fusion, Not The Backbone: down-weighting a corrupted branch with normalized weights w_m is a one-line change at inference and needs no retraining, whereas swapping backbone weights per weather condition doubles the validation surface.
    (5) Train For Dropout, Not Just For Rain: corruption augmentation plus random modality dropout is what makes a gated fusion model usable when a branch is masked, otherwise the fused head has never seen a zeroed input.
    (6) Absolute Scores Plus An Abstention Path: a softmax gate can only express relative trust, so a separate calibrated absolute quality score must be able to declare that all sensors are bad and hand control to the ODD layer.

    Architecture diagram with three sensor lanes for front camera, side camera, and LiDAR, each passing through a per-sensor encoder and a quality head, all feeding a tall degradation gate box that computes fusion weights and FiLM conditioning, then a feature fusion block, then detection heads and a degradation-state and fallback block, with an online monitor box at the bottom sending dashed arrows to the gate and back to the encoder for recalibration

    Figure 1: The monitors sit outside the critical path and write only into the gate. An alarm changes the fusion weight w_m, the FiLM conditioning, and the declared ODD, but it never edits backbone weights at runtime, which keeps the deployed model bit-identical and the failure behaviour testable.

    Each monitor has a different latency and a different false-alarm profile. The soiling and quality head is a per-tile classifier over an early feature map, typically under 1 ms on an embedded accelerator, and it is the only monitor fast enough to drive a physical actuator such as a nozzle or a heater. Feature drift is computed from the channel means of a mid-level tensor against a reference mean and covariance collected on clean data, then smoothed by a CUSUM accumulator so that a single dark frame does not raise an alarm while a sustained shift does within a few frames. Reprojection residuals need matched features across overlapping fields of view or LiDAR points projected into the image, so they run at a lower rate over a sliding window of several seconds, which is acceptable because extrinsic drift from thermal expansion or a curb strike is either slow or a step change that persists. Lens distortion sits between these cases: an intrinsics change makes straight lines curve and inflates residuals even for a single camera, and the correct response is to re-estimate the undistortion look-up table rather than to touch the network, because a CNN trained on rectified images treats a mis-rectified frame as out-of-distribution geometry.

    Two stacked time-series panels over 300 camera frames. The top panel shows feature-drift distance rising from about 1.15 to 3.5 during a shaded rain burst between frames 90 and 170 while the reprojection residual stays near 0.35 pixels, then a second shaded region after frame 200 where the reprojection residual steps to about 2.5 pixels while feature drift stays low, with a dashed one-pixel residual threshold. The bottom panel shows the CUSUM statistic on feature drift staying at zero, then sawtoothing above a threshold of five during the rain burst with alarm markers.

    Figure 2: The two monitors have orthogonal signatures. Rain moves the feature-drift statistic and leaves the reprojection residual untouched, while a mount shift moves the residual by 2.5 px without disturbing appearance statistics at all. Reading only one monitor guarantees you misdiagnose one of the two faults.

    Quality-Gated Fusion:
    q_m = \sigma(g_{\phi}(F_m))
    \hat{F}_m = \gamma(q_m) \odot F_m + \beta(q_m)
    w_m = \frac{\exp(a_m + \log q_m)}{\sum_j \exp(a_j + \log q_j)}
    F = \sum_m w_m \hat{F}_m

    Where:

    • F is the fused feature tensor consumed by the task heads, and F_m is the raw feature map of sensor m, with \hat{F}_m its degradation-conditioned version.
    • q_m \in [0,1] is the absolute quality score produced by a small monitor head g_{\phi} with logistic output \sigma; it is supervised by synthetic corruption labels and calibrated on held-out real degraded clips.
    • \gamma(\cdot) and \beta(\cdot) are the FiLM scale and shift vectors, and \odot is channel-wise multiplication.
    • a_m is a content-dependent attention logit from the ordinary fusion module, so the gate combines what is informative with what is trustworthy.
    • w_m sums to 1 over sensors m, which is why a low but uniform q across all sensors must be caught by the raw q_m values rather than by the weights.

    Runtime Degradation Monitors:
    d_t^2 = (\mu_t - \mu_0)^{\top} \Sigma_0^{-1} (\mu_t - \mu_0)
    S_t = \max(0, S_{t-1} + d_t - k)
    r_{ij} = \| u_i - \pi(T_{ij} X_j) \|_2

    Where:

    • d_t is the Mahalanobis drift at frame t between the current channel-mean vector \mu_t of a mid-level feature map and the clean-data reference \mu_0 with covariance \Sigma_0.
    • S_t is the CUSUM statistic with slack k, which is set just above the clean-condition mean of d_t; an alarm is raised when S_t > h and S_t is then reset to 0.
    • r_{ij} is the reprojection residual in pixels for correspondence (i,j), where u_i is the observed image point, X_j the 3D point from LiDAR or a second camera, T_{ij} the extrinsic transform, and \pi the projection using current intrinsics.
    • A robust percentile of r_{ij} above roughly 1 px sustained over a window indicates extrinsic or intrinsic drift rather than matching noise, and triggers online recalibration.

    The handling policy has to be trained for, not bolted on. A gate that can zero a camera branch is only safe if the fused head saw randomly dropped modalities and heavy corruption augmentation during training, otherwise masking a branch pushes the fusion layer into a region it never visited and accuracy collapses harder than with the corrupted input left in place. Augmentation alone is also insufficient, because it buys average-case robustness while a gate buys graceful worst-case behaviour: at high rain severity the model that can lean on LiDAR keeps far more of its mAP than the model that must average a clean point cloud with a veiled image. The cost is roughly one mAP point in clean weather, from the gate occasionally distrusting a good camera, plus the engineering burden of calibrating q_m so that the gate does not permanently learn to ignore a sensor after a single bad deployment week.

    Line chart of mAP versus rain and spray severity from level zero to five for three configurations: a clean-trained fusion baseline falling from 58 to 19, the same model with corruption augmentation falling from 58 to 31, and augmentation plus quality gating with LiDAR fallback starting slightly lower at 57 and falling only to 40, with an annotation noting the gate down-weights the camera branch at high severity

    Figure 3: Corruption augmentation flattens the curve, but only the quality gate changes the shape of the tail, because it can stop trusting the camera entirely. The 1-point clean-weather cost at severity 0 is the price of that option, and it is the number a reviewer should ask you for.

    DegradationDetection signalWhere it runsRuntime mitigation
    Lens soiling, dropletsPer-tile soiling mask, loss of high-frequency energyEarly feature map, per frame, under 1 msActuate nozzle or heater, mask affected tiles, lower that camera’s weight
    Rain, spray, fog veilingFeature-drift CUSUM on channel statistics, quality head scoreMid-level tensor, per frame with a few-frame delayFiLM conditioning, shift fusion weight toward LiDAR and radar
    Intrinsics or distortion driftStraight-line curvature, single-camera reprojection residualSliding window of seconds, off the critical pathRe-estimate the undistortion look-up table before the backbone
    Extrinsic misalignmentCross-sensor residual above 1 px, LiDAR edge to image edge offsetSliding window, low rate, host CPU acceptableOnline extrinsic correction, disable geometric fusion if outside bound
    Full blockage or frozen streamFrame hash repetition, entropy collapse, timestamp gapDriver layer, before the networkDrop the modality using dropout-trained fusion, reduce the declared ODD

    Login to view more content
  • DL0193 DINOv3 Frozen Backbone Zero-Shot Transfer

    Why can DINOv3 perform zero-shot dense segmentation and classification using a completely frozen backbone without task-specific fine-tuning, and what properties of its self-supervised pretraining enable this transfer?

    Answer

    DINOv3 is pretrained with a purely discriminative self-distillation objective that supervises two granularities at once: an image-level DINO loss on the CLS token and a patch-level iBOT masked-latent loss on individual patch tokens. Because the target is another view’s latent assignment rather than a caption, patch tokens are never squeezed through a text bottleneck, so the P \times d patch grid emerging from the last block is already a linearly separable semantic map rather than an intermediate code that only a trained decoder can read. The property that keeps this true at 7B parameters and 1.689B curated images is Gram anchoring: late in training DINOv3 adds a loss that matches the student’s patch-token Gram matrix to that of an earlier EMA teacher, pinning the patch-to-patch similarity structure while global features keep improving. Register tokens remove the high-norm artifact patches that otherwise pollute attention maps, and axial RoPE with frequency jittering makes the same weights usable at resolutions far above the training crop. The result is that read-out becomes non-parametric: k-NN on the CLS token classifies, and cosine similarity between patch embeddings segments, with no gradient ever entering the backbone. A single linear layer on the frozen features reaches roughly 88% ImageNet-1k top-1 and around 56 mIoU on ADE20k, which is why “frozen backbone plus tiny head” is a competitive deployment strategy rather than a baseline.

    (1) Two Granularities Of Supervision: the DINO term shapes the CLS token for image-level tasks while the iBOT term shapes individual patch tokens, so dense and global capability are trained jointly instead of one being a by-product.
    (2) No Text Bottleneck: contrastive image-text training pushes patch information toward one caption-level summary, whereas latent self-distillation leaves per-patch detail intact, which is exactly what dense matching consumes.
    (3) Gram Anchoring Preserves Dense Structure: constraining the P \times P similarity matrix, not the absolute features, lets representations keep drifting globally while patch-similarity geometry stays sharp.
    (4) Artifact-Free High-Resolution Maps: register tokens absorb the global-information outliers that would otherwise appear as bright background patches, and jittered axial RoPE keeps features stable when inputs are upscaled.
    (5) Read-Out Is Non-Parametric: cosine similarity to a handful of reference patches or a simple clustering of patch tokens yields masks with zero trained parameters, so “zero-shot” here is literal.
    (6) Scale, Curation, Then Distillation: a 7B teacher on curated web data is distilled into ViT-S/B/L and ConvNeXt students that inherit the dense property, so the same recipe ships at deployable sizes.

    Left-to-right diagram: an input image at any resolution passes through 16x16 patch embedding with four register tokens and jittered axial RoPE into a frozen ViT-7B/16 that receives no gradients, producing a CLS token and P patch tokens, which feed three read-out paths: k-NN or linear probe on the CLS token for ImageNet classification, patch-to-patch cosine similarity for zero-shot masks with no trained head, and a lightweight linear or DPT head for ADE20k segmentation and NYUv2 depth

    Figure 1: One frozen backbone, three read-outs. The only task-specific parameters live to the right of the token boundary, and the middle path has none at all: it is pure cosine similarity between patch embeddings, which is only meaningful because Gram anchoring protected that similarity structure during pretraining.

    The interesting failure this design fixes is temporal. Train DINO plus iBOT long enough at 7B scale and the two granularities diverge: image-level metrics such as ImageNet linear probing keep improving, while patch-level metrics (segmentation with a frozen linear head, video tracking, patch-similarity coherence) peak relatively early and then degrade. Patch tokens slowly become carriers of global, image-level evidence, so neighbouring patches on the same object stop being each other’s nearest neighbours and background patches start matching foreground ones. Monitoring only ImageNet accuracy hides this completely, which is why the effect went unaddressed for so long. Gram anchoring intervenes on the second-order statistic rather than the features: the student must reproduce the teacher’s patch-patch cosine matrix, so it is free to rotate, rescale, or refine the embedding space while the relational geometry that dense tasks read out is held in place. Meta reports the anchoring loss switched on in a late phase of training, using a Gram teacher whose features are computed at higher resolution and downsampled, which sharpens the target further.

    Dual-axis schematic line chart over 1.2 million training iterations: the ImageNet-1k linear probe top-1 curve rises monotonically from about 76 to 88 percent, while the ADE20k frozen linear mIoU curve rises to about 56 by 0.22 million iterations, decays to about 48 by 1.0 million, then jumps back above 56 after a dash-dot vertical line marking where Gram anchoring is switched on

    Figure 2: Schematic shape of the reported trend. Global and dense quality diverge under long self-supervised training, so a model that looks strictly better on classification can be strictly worse for zero-shot dense read-out. Gram anchoring recovers the dense curve without sacrificing the global one.

    Mathematical Formulation:
    \mathcal{L} = \mathcal{L}_{\mathrm{DINO}} + \mathcal{L}_{\mathrm{iBOT}} + \lambda \mathcal{L}_{\mathrm{Gram}}
    G_S = \hat{X}_S \hat{X}_S^{\top}
    \mathcal{L}_{\mathrm{Gram}} = \| G_S - G_T \|_F^2
    P = (H/16) \times (W/16)
    s_{pq} = \hat{x}_p^{\top} \hat{r}_q
    \hat{y}_p = \arg\max_q s_{pq}

    Where:

    • \mathcal{L}_{\mathrm{DINO}} is the image-level cross-view self-distillation loss on the CLS token and \mathcal{L}_{\mathrm{iBOT}} the patch-level masked-latent loss, with \lambda weighting the anchoring term.
    • \hat{X}_S \in \mathbb{R}^{P \times d} holds the student’s L_2-normalized patch features and \hat{X}_T the same for the Gram teacher, an earlier EMA checkpoint evaluated at higher resolution and downsampled.
    • G_S, G_T \in \mathbb{R}^{P \times P} are the patch-patch cosine similarity matrices, so the loss constrains relations between patches and not the patch vectors themselves.
    • P is the number of patch tokens for an H \times W input at patch size 16, and d the model width; the anchoring loss therefore costs O(P^2 d) per view.
    • \hat{x}_p is the normalized embedding of test patch p and \hat{r}_q a normalized reference embedding, taken from an annotated patch, a class prototype, or a cluster centroid.
    • \hat{y}_p is the predicted label for patch p; the read-out has no learned weights, and the backbone is evaluated with \lambda and all pretraining machinery discarded.
    Two side-by-side grayscale heatmaps of cosine similarity to a single query patch marked by a red square inside a large elliptical object; the left map is sharp with high similarity confined to the object and near-zero elsewhere including on a nearby distractor object, while the right map is blurred and noisy with spurious high-similarity patches scattered across the background

    Figure 3: What one row of G looks like in image space. Zero-shot dense segmentation is nothing more than thresholding or arg-maxing maps like these, so map sharpness is the capability: the right-hand panel, typical of dense degradation, produces masks that bleed into the background even though the model’s classification accuracy is higher.

    Two practical consequences follow. First, “zero-shot” in this setting means no text alignment: DINOv3 can tell you that patch p belongs to the same thing as your reference patch, but it cannot be queried with the string “traffic cone” the way SigLIP or CLIP can, so open-vocabulary work still needs a language-aligned encoder or a small aligner trained on top. Second, freezing is what makes the model economical to operate: one forward pass produces features that many heads share, features can be cached, and there is no risk of catastrophic forgetting when a new task arrives.

    PropertyFrozen DINOv3Frozen CLIP / SigLIPSupervised fine-tuning
    Pretraining signalSelf-distillation on images only, image-level plus patch-levelImage-text contrastive or sigmoid loss on alt-text pairsTask labels, one dataset at a time
    Patch-token qualityHigh and explicitly protected by Gram anchoringWeaker: detail is compressed toward the caption-level summaryHigh for the trained task, unreliable off-task
    Zero-shot dense masksYes, by cosine matching or clustering of patch tokensPoor without a dense-adaptation stageNot applicable, the head defines the label set
    Text queriesNone, references must be visual examplesNative open-vocabulary queryingFixed closed vocabulary
    Adaptation costCache features once, train a linear or DPT head in minutesCheap for classification, expensive for dense tasksFull backbone gradients per task, plus a new checkpoint
    Dominant failure modeDomains far from curated web imagery, and no semantics for text promptsBlurred patch features and prompt sensitivityCatastrophic forgetting and per-task serving cost

    Login to view more content
  • DL0192 Depth Anything 3 Cross-View Depth Estimation

    How does Depth Anything 3 enable cross-view interaction for consistent multi-view monocular depth estimation, and what architectural changes distinguish it from its single-view predecessors?

    Answer

    Depth Anything 3 keeps the monocular recipe of its predecessors and changes essentially one thing inside the network: the scope of self-attention. Each of the N input views is patchified by the same plain DINOv2 encoder, the per-view token sequences are concatenated into a single sequence, and the stack then alternates between within-view attention, where a query sees only its own view and fine monocular detail survives, and cross-view attention, where every token attends to every token of every view and correspondence, relative pose, and a common scale are learned. No fusion module, cross-attention adapter, or cost volume is introduced. The pretrained attention weights are simply given a wider window, so a single-view input degenerates exactly to the original monocular model, which is why multi-view capability does not cost single-image quality. The second change is the output: instead of the per-image affine-invariant disparity of Depth Anything V1 and V2, DA3 predicts a depth-ray target per view (a depth map plus a ray map), and depth along predicted rays back-projects to one point cloud and one set of camera poses under a single global scale. That one target replaces the multi-head, multi-task output of VGGT-style geometry transformers, and the reported gains over VGGT are roughly 44% on camera pose accuracy and 25% on geometric accuracy, while monocular depth still improves over DA2.

    (1) Attention Scope, Not A New Module: cross-view interaction is implemented by concatenating view tokens and letting the existing self-attention layers run over the union, so no modality-specific or view-specific parameters are added.
    (2) Interleaved Within-View And Cross-View Layers: within-view layers protect high-frequency monocular detail, cross-view layers enforce geometric agreement, and the two are alternated through the stack.
    (3) Input-Adaptive Degeneration: at N = 1 the cross-view layer is numerically identical to the single-view layer, so the model is a strict superset of its monocular predecessor rather than a compromise.
    (4) Single Depth-Ray Target: one head predicts depth plus a ray map per view; depth along rays → point cloud, and camera pose is read out of the ray field instead of a dedicated pose head.
    (5) One Global Scale For The Whole Set: normalization is fitted once over all views rather than a free scale and shift per image, which is precisely what removes per-frame flicker and non-overlapping point clouds.
    (6) Plain Backbone, Teacher-Student Data: a vanilla DINOv2 transformer with a DPT-style dense head is enough; the accuracy comes from the target and from teacher-student pseudo-labelling, not from architectural specialisation.
    (7) The Price Is Quadratic: a cross-view layer costs N times a within-view layer, so view count, not image resolution, becomes the dominant memory term.

    Architecture diagram: three input views feed one shared DINOv2 patch embedding that concatenates N times 1369 tokens into a single sequence, which passes through a within-view attention block and then a cross-view attention block interleaved over M blocks, then a shared DPT-style dense head that emits a depth map and a ray map per view, which are fused into one point cloud and camera poses in a shared frame under a single global scale

    Figure 1: One encoder, two attention scopes, one target. The only cross-view machinery is the wider attention window, and the only output is a depth map plus a ray map per view, from which the point cloud and the camera poses are derived rather than predicted by separate heads.

    It helps to look at the attention mask directly. With N views of L tokens each, a within-view layer is a block-diagonal mask: N independent L \times L blocks, exactly what a monocular model computes, repeated in parallel. A cross-view layer fills in the off-diagonal blocks, and those off-diagonal entries are the whole mechanism, because a token on a wall corner in view 3 can now match the same corner in view 1 and inherit its depth ordering. Because the projection matrices are unchanged, the same weights serve both scopes and the model never has to learn a separate matching operator. The cost of filling those blocks is the reason view count dominates the budget, and it is also the reason non-overlapping views buy nothing: the off-diagonal blocks exist, but there is no correspondence for them to find, so the relative scale between two disjoint clusters of views stays unconstrained.

    Two 3-by-3 block attention masks for three views with eight tokens each: the left mask has only the three diagonal within-view blocks filled and the six off-diagonal blocks marked masked, totalling 192 token pairs; the right mask has the diagonal within-view blocks plus all six off-diagonal cross-view blocks filled, totalling 576 token pairs

    Figure 2: The same layer, two masks. Single-view models compute only the block diagonal; DA3 fills the off-diagonal blocks, and cross-view correspondence lives entirely there. The pair count grows from N L^2 to (NL)^2, a factor of exactly N.

    Mathematical Formulation:
    Z = [\,X_1; X_2; \ldots; X_N\,]
    A_{\mathrm{within}}(v) = \mathrm{softmax}(Q_v K_v^{\top}/\sqrt{d})V_v
    A_{\mathrm{cross}} = \mathrm{softmax}(QK^{\top}/\sqrt{d})V
    P_v(u) = o_v + d_v(u)\, r_v(u)
    s = \mathrm{median}_{v,u}\, \| P_v(u) \|
    C_{\mathrm{within}} = N L^2
    C_{\mathrm{cross}} = N^2 L^2

    Where:

    • X_v \in \mathbb{R}^{L \times d} holds the tokens of view v and Z \in \mathbb{R}^{NL \times d} is the single concatenated sequence the transformer actually sees.
    • Q_v, K_v, V_v are the projections restricted to one view, while Q, K, V are the same projections applied to all of Z; the weights are shared, only the scope differs.
    • u indexes pixels, v \in \{1,\ldots,N\} indexes views, L = (H/p)(W/p) is tokens per view for patch size p, and d is the model width.
    • d_v(u) is the predicted depth and (o_v, r_v(u)) the predicted ray map (origin and unit direction) expressed in a shared frame, so P_v(u) is a 3D point in that frame and the camera pose follows from fitting r_v.
    • s is a single global scale estimated jointly over all views and pixels, replacing the per-image scale and shift used by affine-invariant monocular training.
    • C_{\mathrm{within}} and C_{\mathrm{cross}} count attention token pairs per layer, so their ratio is N and the KV cache of a cross-view layer grows linearly in N.

    Token Budget At 518 Pixels And Patch Size 14:
    L = 37 \times 37 = 1369
    N L = 32 \times 1369 = 43808
    C_{\mathrm{within}} = 32 \times 1369^2 \approx 6.0 \times 10^{7}
    C_{\mathrm{cross}} = 43808^2 \approx 1.92 \times 10^{9}

    Thirty-two views at a modest resolution already put nearly 44k tokens in one sequence, and a single cross-view layer touches about 1.9 billion token pairs against 60 million for a within-view layer. This is why the interleaving ratio is a real design knob rather than a detail: every cross-view layer you insert buys consistency and pays N times the attention cost, and it is why the practical deployment question for any-view geometry models is not accuracy but how many views fit on the device.

    Log-scale line chart of attention token pairs per layer versus number of input views from 1 to 64, with a dashed blue line for a within-view layer growing linearly as N times L squared and a solid orange line for a cross-view layer growing quadratically as N L squared, annotated at N equals 32 with 43808 tokens and 1.92 billion versus 60 million pairs, and a note that the two curves coincide at N equals 1

    Figure 3: Consistency is not free. A within-view layer scales linearly in view count while a cross-view layer scales quadratically, and the two curves meet at N = 1, which is the formal statement of the input-adaptive property that keeps monocular quality intact.

    The target change matters as much as the attention change. A per-image affine-invariant prediction is ambiguous by construction: two frames of the same room can be individually excellent and still disagree by a factor of two in scale, so stitching them produces a doubled wall. Fitting one scale over the whole view set turns depth from a per-image ranking problem into a set-level geometry problem, and the ray map supplies the missing piece by encoding where each pixel’s viewing ray points in the shared frame. Camera intrinsics and extrinsics then fall out of the ray field by a least-squares fit rather than from a separate pose head, which is the concrete sense in which DA3 collapses a multi-task output into a single one.

    PropertyDepth Anything V1 / V2VGGTDepth Anything 3
    InputOne image, independently per frameA set of images in one forward pass1 to N views, optionally with known poses
    Cross-view mechanismNone; consistency is a post-processing problemAlternating frame-wise and global attention with dedicated camera tokensInterleaved within-view and cross-view self-attention, no new parameters
    Prediction targetAffine-invariant relative disparitySeparate heads for camera, depth, point map, trackingA single depth-ray target per view
    Scale handlingFree scale and shift per imageSet-level, anchored to the first cameraOne global scale fitted over the whole view set
    Camera poseNot producedPredicted by a dedicated camera headRead out of the predicted ray map
    BackboneDINOv2 ViT with a DPT dense headViT with specialised camera and register tokensPlain DINOv2 ViT, no architectural specialisation
    Dominant failure modeTemporal flicker and misaligned point clouds across framesMulti-task head interference and heavy memoryQuadratic cost in N; needs genuine overlap between views

    Login to view more content
  • DL0189 KAN vs MLP: Kolmogorov-Arnold Networks

    How does a KAN (Kolmogorov-Arnold Network) differ from a traditional MLP in its use of learnable splines on edges instead of fixed activations on nodes, and what are the trade-offs in expressivity, interpretability, and scaling?

    Answer

    An MLP puts learnable scalars on the edges and a fixed nonlinearity on the nodes: every edge is one number in a weight matrix, and every hidden unit applies the same hand-chosen \sigma. A KAN swaps those two roles. Every edge carries its own learnable univariate function \phi_{l,j,i}, implemented as a B-spline of grid size G and order k plus a SiLU residual branch, and every node does nothing but sum its incoming edge outputs. Both families are universal approximators, so the difference is not what can be represented but where the capacity sits and what that placement costs. Moving capacity onto the edges buys a per-edge object you can plot, sparsify, prune, and even snap to a symbolic formula, and it buys a fast spline approximation rate on smooth low-dimensional targets. It costs a factor of about (G+k) in parameters at the same layer shape, roughly an order of magnitude in wall-clock training time because per-edge splines do not collapse into one dense GEMM, and a new hyperparameter (the spline grid) that must cover the actual range of the activations.

    (1) Role Swap, Not A New Theorem: the Kolmogorov-Arnold representation theorem motivates the design, but the depth-2 form it guarantees can require pathological inner functions, so KANs generalize it to arbitrary depth and width and rely on smoothness of the target, not on the theorem, for their advantage.
    (2) Edge Function Is Spline Plus Residual: each \phi is a learned combination of G+k basis functions added to a scaled SiLU, so a KAN is not activation-free; the fixed nonlinearity survives as a residual path that keeps gradients alive outside the grid.
    (3) Nodes Are Pure Summation: no elementwise nonlinearity between layers, which is exactly why the univariate curves are individually meaningful.
    (4) Parameter Cost Multiplies: a 64 \times 64 layer holds 4,160 parameters as an MLP and about 32,768 spline coefficients as a KAN with G=5, k=3.
    (5) Interpretability Is A Workflow: L1 plus entropy regularization on the edge functions, pruning of dead edges, then symbolic snapping of each surviving curve to a candidate like \sin, \exp, or x^2.
    (6) Scaling Is The Weak Point: per-edge spline evaluation is memory-bound and GEMM-unfriendly, and at matched parameters and FLOPs an MLP still wins on vision, language, and audio benchmarks.

    Side-by-side diagram of the same two-input toy layer. On the left an MLP sends two inputs through scalar weights w1 and w2 into a node containing a fixed sigma, then to the output y. On the right a KAN sends each input through a box containing a learnable spline curve drawn over knot ticks, and both spline outputs feed a node that only sums, producing y.

    Figure 1: The role swap in its smallest form. In the MLP the edge is a single learnable number and the nonlinearity is a fixed \sigma baked into the node; in the KAN the edge is a learnable spline over a knot grid and the node only adds. Capacity moves from a matrix of scalars to a grid of spline coefficients, which is why the same layer shape costs about (G+k) times more parameters.

    Expressivity behaves differently in the two regimes that matter in practice. On smooth, low-dimensional, compositional targets (symbolic regression, ODE and PDE solution operators, small physical laws) the spline basis is close to the right basis, so error falls quickly with parameters and grid extension lets you refine an already trained model by re-fitting a finer grid instead of restarting. On high-dimensional perception data the picture inverts: a controlled comparison at matched parameters and FLOPs found MLPs ahead on machine-vision, language, and audio tasks, with KANs winning only on symbolic formula representation, and KANs forgetting more than MLPs in a standard class-incremental setting. Interpretability is the more robust claim. Because a node only sums, each edge curve is a genuine one-dimensional function of one variable, so you can plot all of them, drive most toward zero with sparsity penalties, prune the graph down to a handful of edges, and read off a formula. That workflow is what made KANs useful as a scientific assistant rather than as a general drop-in replacement for a dense layer.

    Mathematical Formulation:
    \mathrm{MLP}(x) = W_L \sigma(W_{L-1} \cdots \sigma(W_1 x))
    f(x) = \sum_{q=1}^{2n+1} \Phi_q \left( \sum_{p=1}^{n} \phi_{q,p}(x_p) \right)
    x_j^{(l+1)} = \sum_{i=1}^{n_l} \phi_{l,j,i}\left(x_i^{(l)}\right)
    \phi(x) = w_b \, \mathrm{silu}(x) + w_s \sum_{m=1}^{G+k} c_m B_m(x)
    P_{\mathrm{MLP}} = O(L n^2)
    P_{\mathrm{KAN}} = O(L n^2 (G+k))
    \ell \propto N^{-4}

    Where:

    • x is the input vector and x_j^{(l+1)} the j-th activation of layer l+1, obtained by summation only in a KAN.
    • W_l and \sigma are the MLP’s learnable weight matrices and its fixed elementwise nonlinearity.
    • \phi_{q,p} and \Phi_q are the inner and outer univariate functions of the Kolmogorov-Arnold representation, with n the input dimension; \phi_{l,j,i} is the learnable edge function from unit i of layer l to unit j of layer l+1.
    • B_m are B-spline basis functions with local support over the knot grid, c_m their learned coefficients, and w_b, w_s the scales of the SiLU residual and the spline branch.
    • G is the number of grid intervals and k the spline order, so each edge holds G+k coefficients; typical values are G=5, k=3.
    • L is depth, n the layer width, and P the parameter count, so the KAN pays the extra factor (G+k) at identical layer shape.
    • \ell is test error against parameter count N; the N^{-4} rate is the cubic-spline approximation rate and holds only when the target is smooth and effectively low-dimensional.
    Two-panel chart. Left panel: grouped bars comparing an MLP baseline at one times against a KAN, showing eight times the parameters at the same layer shape and about ten times the training time per epoch at the same parameter count. Right panel: log-log plot of test error against parameter count, with a steep KAN curve following an N to the minus four rate marked by grid-extension points at G equals 3, 5, 10 and 20, and a much shallower dashed MLP curve following an N to the minus one rate.

    Figure 2: Cost against payoff. At matched layer shape a KAN with G=5, k=3 carries about 8x the parameters, and at matched parameter count it trains roughly 10x slower because each edge evaluates its own spline instead of joining one dense matmul. The right panel shows the regime where that price buys something: on a smooth low-dimensional target, grid extension (3 → 5 → 10 → 20) walks the same trained model down a steep spline-approximation curve that an equally sized MLP does not follow.

    PropertyMLPKAN
    Nonlinearity locationFixed sigma on every nodeLearnable phi on every edge; nodes only sum
    Learnable object per edgeOne scalar weightG+k spline coefficients plus base and spline scales
    Params for a 64 to 64 layer4,160About 32,768 at G=5, k=3 (about 41k with the two scales)
    Hardware behaviourOne dense GEMM, cuBLAS and tensor-core friendlyPer-edge basis evaluation, memory-bound, about 10x slower at matched params
    Input domain requirementNone; sigma is defined on all of RKnot grid must cover the activation range, so grid updates or normalization are mandatory
    Interpretability routeInspect weights or use post-hoc attribution; features stay entangledPlot each curve, sparsify, prune, snap to a symbolic form
    Where it winsVision, language, audio at matched params and FLOPs; anything throughput-boundSymbolic regression, small smooth scientific targets, operator learning
    Main failure modeActivation choice is a fixed prior; little internal structure to readGrid hyperparameters, slow training, and worse forgetting on class-incremental benchmarks

    Login to view more content
  • DL0188 Liquid Neural Networks

    What are Liquid Neural Networks (LNNs), and how do their continuous-time ODE-based dynamics with time-varying parameters differ from fixed-weight RNNs and Transformers?

    Answer

    A Liquid Neural Network is a recurrent model whose hidden state is defined by an ordinary differential equation in continuous time rather than by a fixed-stride update rule, and whose effective time constant is computed from the current input and state instead of being frozen at training time. The canonical instance is the Liquid Time-Constant (LTC) network, where a neuron leaks toward a resting value at rate 1/\tau and is simultaneously driven by a nonlinearity f(x, I; \theta) that also appears in the denominator of the effective time constant, so each neuron can behave like a fast detector on one input and a slow integrator on another. The trained parameters \theta are static after training; what is “liquid” is the input-dependent time constant and synaptic drive, which makes the system a family of dynamics selected on the fly rather than one fixed linear-time-invariant filter. Because the state is a function of physical time, the elapsed interval \Delta t is an explicit argument to a numeric solver, which is what lets LNNs consume irregularly sampled sensor streams without imputation. Against this, a gated RNN applies the same learned transition once per token at an implicit constant stride, and a Transformer has no recurrent state at all: it mixes tokens by attention over the whole prefix, paying O(L^2) prefill and carrying a linearly growing KV cache.

    (1) Continuous-Time State: the hidden vector is the solution of an ODE evaluated by a solver, so the model interpolates between observations instead of skipping to the next index.
    (2) Liquid Time Constant: \tau_{sys} = \tau / (1 + \tau f) varies per neuron per step, giving input-dependent timescales from one fixed parameter set.
    (3) Elapsed Time Is An Input: unequal gaps between samples are handled exactly by integrating over \Delta t, which matters for event streams, medical records, and asynchronous sensors.
    (4) Sparse Auditable Wiring: Neural Circuit Policies wire LTC neurons in a sensory, inter, command, motor hierarchy, and a 19-neuron command layer has flown real drones and driven real cars.
    (5) Cost Scales With Solver Steps: compute is O(L k d^2) for k solver steps per observation, with no KV cache, but the recurrence is inherently sequential.
    (6) Provable Boundedness: the LTC construction bounds both the state and \tau_{sys}, so the dynamics cannot blow up the way an unconstrained neural ODE can.

    Flow diagram of a liquid time-constant cell: an irregularly sampled input stream feeds a nonlinear drive function f of state and input, which both drives the ODE state x of t and, through a lower box, sets the liquid time constant tau over one plus tau times f; the state is integrated by an ODE solver taking k fused Euler steps across each delta t, then read out linearly, with a dashed feedback arrow returning the state at the next observation and a timeline below showing unequally spaced observation ticks with grey internal solver steps between them

    Figure 1: One nonlinearity does two jobs. The same f(x, I; \theta) supplies the drive toward the resting potential A and sets the effective time constant, and the solver spans whatever \Delta t the sensor happened to deliver, so the grey internal steps, not the sequence index, determine the compute bill.

    The contrast with a fixed-weight RNN is easiest to see through the timescale. An LSTM or GRU also has a forget gate that modulates memory retention, but the gate acts on a fixed discrete stride: the model learns one retention profile for “one step” and has no representation of how much real time a step covered. If your samples arrive at 3 ms and then at 400 ms, the gated RNN sees two identical steps unless you hand it the gap as an extra feature and hope it learns the exponential relationship. The LTC instead solves for the exponential, because \Delta t enters the integrator directly. The contrast with a Transformer is structural rather than temporal. Attention is a stateless global mixer: it can reach any earlier token in one hop, which is why it dominates language, but it has no notion of physical duration beyond whatever positional scheme you inject, and its cost grows quadratically with context while its memory grows linearly. An LNN keeps a fixed-size state regardless of horizon, which is exactly what an embedded controller running at 50 Hz for hours needs, and exactly the wrong trade for retrieving a fact from 200,000 tokens of text.

    Mathematical Formulation:
    \frac{dx}{dt} = -\frac{x}{\tau} + f(x, I; \theta)\,(A - x)
    \tau_{sys}(x, I) = \frac{\tau}{1 + \tau f(x, I; \theta)}
    \frac{\tau}{1 + \tau f_{max}} \leq \tau_{sys} \leq \tau
    h_t = \sigma(W h_{t-1} + U I_t + b)

    Where:

    • x(t) \in \mathbb{R}^{d} is the continuous-time neuron state and I(t) the sensory input at that instant.
    • f(x, I; \theta) is a bounded nonlinearity (typically a sigmoid of an affine map) with static trained parameters \theta; it appears twice, as the drive and inside the time constant.
    • \tau is the per-neuron leak time constant, A the resting potential the drive pulls toward, and f_{max} the supremum of f that bounds the fastest achievable dynamics.
    • \tau_{sys} is the liquid (effective) time constant; the bracketing inequality is what guarantees the state stays bounded and the solver stays stable.
    • The last line is the fixed-weight RNN baseline: h_t depends on step index t only, with W, U, b applied identically at every step and no \Delta t anywhere in the update.
    Two panel chart. Left panel plots the effective time constant tau_sys against input drive f on a logarithmic vertical axis for three base time constants 0.1, 0.5 and 2.0 seconds, all curves collapsing toward one over f as the drive grows. Right panel plots state x of t against time for a square input pulse between one and three seconds, comparing a fixed leaky integrator with a constant one second time constant against a liquid time constant cell whose effective time constant is 0.21 seconds while the input is on and 0.84 seconds when it is off, showing a much faster rise and a partially sustained level

    Figure 2: Left, the whole point of the 1 + \tau f denominator: a strong input collapses \tau_{sys} toward 1/f, so one neuron spans a wide band of timescales. Right, the same input pulse through a fixed leaky integrator and an LTC cell with identical \tau; the liquid cell charges roughly five times faster while driven and relaxes more slowly once the drive is removed, behaviour a single fixed-weight filter cannot produce.

    The practical objection to LNNs is the solver. Every observation costs k evaluations of f, stiff dynamics push k up, and the whole recurrence is sequential, so training cannot be parallelized across time the way attention or a convolutional scan can. Closed-form Continuous-time (CfC) networks answer this by replacing the numeric integration with an analytic approximation of the LTC solution, keeping the input-dependent timescale while deleting the solver from the graph, at reported speedups of one to five orders of magnitude in training and inference over solver-based LTCs.

    Closed Form And Cost:
    x(t) = \sigma(-f\,t) \odot g + [1 - \sigma(-f\,t)] \odot h
    C_{LNN} = O(L\,k\,d^2)
    C_{TF} = O(L^2 d + L\,d^2)

    Here f, g, h are separate learned heads of (x, I) and \sigma(-f t) acts as a time-dependent gate that interpolates between two candidate states as elapsed time grows, which is the closed-form stand-in for exponential relaxation. Note that C_{LNN} has no term in L^2 and no cache: an LNN controller at d = 64 can run indefinitely in constant memory, while the Transformer term grows with every token retained.

    PropertyLiquid (LTC / CfC)Fixed-weight RNN (LSTM / GRU)Transformer
    State definitionContinuous state from an ODE, evaluated by a solver or a closed-form gateDiscrete hidden and cell state, one update per stepNo recurrent state; every token attends over the full prefix
    Handling of elapsed timeDelta t is an explicit solver argument, so unequal gaps are exactImplicit constant stride; gaps must be imputed or appended as a featurePosition index or RoPE; real timestamps must be encoded as extra inputs
    Effective timescaleInput-dependent, tau over one plus tau f, bounded above by tauSet by trained gate weights, modulated only within one fixed strideNone; the mixing radius is the context window
    Cost per observationk solver evaluations, sequential, no cacheOne matmul pass, sequential, no cacheParallel in training, but KV cache grows linearly with L
    Typical deployed sizeTens to a few thousand neurons, including 19-neuron flight and driving policiesThousands to millions of parametersHundreds of millions to hundreds of billions
    Dominant failure modeStiff dynamics inflate solver steps; no parallelism over timeVanishing gradients and timescale mismatch on long horizonsQuadratic prefill, and no built-in notion of physical duration

    Login to view more content