Time-Scoped Gating for Frozen-Model Knowledge Edits

A language model whose weights are never touched still remembers who the president was in 2015. That is the quiet advantage of zero-shot knowledge updating, meaning methods that change what a model says by attaching an external memory of edits instead of rewriting its weights. The advantage is easy to waste. Current memory-based editors fetch notes by topic, not by time. A note saying "the CEO of X is now B" will match a question about who ran X in 2010, and the model will answer B. This reproduces at inference time the historical-forgetting failure that weight editing causes during training. These editors are also slow in a way that has nothing to do with the edits. Every query pays for a retrieval step, a model pass that checks whether the retrieved note is relevant, and a longer prompt, even when most traffic never touches an edited fact.

We propose a small gate that runs on the frozen model's own early-layer representation of the query, before any retrieval or extra model pass. The gate asks two questions: does this query concern a fact that has been edited, and does the time the query refers to fall inside that edit's validity window? Only if both answers are yes does a single dated note enter the prompt. Otherwise the query goes straight to the untouched weights, which still hold the historical answer. The gate's score comes from reconstruction-based anomaly detection, the idea of scoring an input by how badly a model trained only on "normal" examples can rebuild it. Here the "normal" examples are the edit records themselves, keyed jointly by fact and by a continuous encoding of time. The note makes two testable claims. Time-scoped keys alone should recover most of the historical recall that flat note memories lose. A gate computed from representations the model already produces should remove most of the retrieval latency at no loss in edit quality.

Core Claim

The claim has a diagnostic part and a constructive part. Diagnostically, we hypothesize that note-based editors such as EREN (Robust and Scalable Model Editing for Large Language Models) lose historical recall on temporal edits. EREN stores edits as text, retrieves them with a dense retriever, and asks the model to check relevance before answering. It has no notion of when a note is valid, so under the AToKe benchmark's historical metrics it should fail in the same direction that History Matters: Temporal Knowledge Editing in Large Language Model documented for weight editors, whose historical edit scores fell to near zero. That paper motivates the proposal by showing the failure exists. It does not test external memories, because its own fix (METO, a weight-editing method with a joint objective over current and historical facts) still modifies weights.

Constructively, we claim that a gate keyed on both fact identity and query time can do three things together. It can preserve history for free, because skipped queries hit unmodified weights. It can keep edit quality and out-of-scope preservation at EREN's level. And it can make cost scale with the fraction of queries that actually touch edits rather than with total traffic.

Research Program

The memory stores each edit as a record of subject, relation, new object, and a validity interval with a start time and an end time that may be open. Each record gets a key made of two parts. The first is a fact vector, taken from a projection of the frozen model's hidden state at a fixed early layer while it reads a template of the subject and relation. The second is a time vector, produced by a sinusoidal encoding of continuous time. This kind of time encoding was used for trajectories in Transformer Networks for Trajectory Forecasting and, in relative-gap form, in Temporal Inductive Path Neural Network for Temporal Knowledge Graph Reasoning. We reuse the technique. Intervals are represented by placing key samples at times spread across each validity window. A chronological-ordering penalty in the style of Improving Time Sensitivity for Question Answering over Temporal Knowledge Graphs keeps the learned time map from scrambling order.

At query time, the frozen model's early layers run anyway. We read the fact vector from them, and a linear head on the same hidden state estimates the query's time reference $\tau$. That reference may be an explicit date, "now" by default, or a relative phrase. For relative phrases such as "previous" or "before the last change," $\tau$ is resolved against the ordered intervals stored under the same fact key. Fresh in memory, which found that recency is linearly encoded in activations, makes a linear temporal readout plausible. The gate then scores the query as

$$r(q,\tau) = \lVert z - R_M(z) \rVert, \qquad z = [\,k(q);\ \phi(\tau)\,],$$

where $k(q)$ is the fact vector of query $q$, $\phi(\tau)$ is the time encoding, and $R_M$ rebuilds $z$ using only the edit memory $M$. The system retrieves the matching note if and only if $r$ falls below a threshold $\theta$.

We treat $R_M$ as a family of choices rather than committing to one. At one end, nearest-neighbor reconstruction returns the closest stored key, which is effectively what MemStream and PatchCore-style memories do. At the other end is a low-capacity continuous coordinate grid, following Continuous Memory Representation for Anomaly Detection. That work (CRAD) showed that interpolating over a learned grid avoids the "identity shortcut," in which an overly flexible reconstructor rebuilds anomalous inputs perfectly and so stops flagging them. It also showed constant-time lookup. CRAD worked on spatial image patches. We move the coordinates to fact and time, and we ask whether the grid's interpolation generalizes better than exact matching to paraphrases and to same-subject, different-relation queries.

Thresholds are set without any out-of-scope labels: $\theta$ is a quantile of residuals on held-out paraphrases of the edits themselves. This takes seriously the warning in MVTec AD that unsupervised threshold setting is where deployed detectors break. When the gate fires, only the top note goes into the prompt, and EREN's relevance-check pass is dropped. If that drop costs edit quality, we will see it in the ablations below.

Baselines

The do-nothing reference is the frozen base model with no memory at all. It should score near the top on historical recall and near the bottom on current-edit scores. That makes it a ceiling for how much history any zero-update method can keep, and it is the number our gated system should approach on historical queries.

The strongest memory-based competitor is EREN, run exactly as published: Contriever retrieval followed by an instruction-tuned FLAN-T5 that performs the relevance check and conditional generation. It reports 95.9% behavior preservation on harder out-of-scope queries and 96.9% edit quality after 1,024 sequential edits. We also run a time-aware EREN, in which each note carries its validity dates in plain text, to separate "time is missing" from "time is present but unused." Both use the same base model, the same edit stream, and the same hardware as our system. Beating EREN means matching its edit quality and behavior preservation within about a point while clearly improving historical edit and recall scores on AToKe and cutting mean latency whenever fewer than half of queries touch edits. The file gives no latency figure for EREN (no reported result found on Lacuna for EREN latency), so we measure it ourselves.

The strongest temporal competitor is TEMPLE-MQA (Multi-hop Question Answering under Temporal Knowledge Editing), which builds a time-aware graph of edits and plans retrieval paths over it. It reports a historical edit score of 97.25 on AToKe-SE. We do not expect to beat that number on single edits. Success there is coming within a few points at a fraction of its per-query cost, which we measure on identical hardware. On AToKe-ME, where a fact changes several times, we compare against METO, whose reported historical edit score rose from under 0.3 to over 15 for some methods. Our expectation is that time-scoped retrieval over unmodified weights should exceed this by a wide margin. SERAC (Mitchell et al.) represents learned-classifier routing, at 33.1% behavior preservation on harder out-of-scope queries per EREN.

The ablations isolate each ingredient. One removes the time vector, leaving fact-only keys. One swaps the hidden-state keys for Contriever embeddings, which require an extra encoder pass. One compares nearest-neighbor reconstruction against the continuous grid. One restores EREN's relevance-check pass after the gate fires. All gate variants share the same tuning budget, a fixed sweep over layer choice and $\theta$ quantile, selected on edit paraphrases only.

Why not just…?

Why not just store dates as metadata and filter retrieved notes? For queries with explicit dates, this is a real threat. A symbolic interval check on parsed dates may match or beat any learned time encoding, and it costs nothing. We include it as a baseline and expect it to win or tie on that subset. The learned time readout earns its place only if it does clearly better on AToKe's multiple-edit split and on questions with relative or implicit time references, where there is no date to parse. If it does not, the right system is a date filter on top of the hidden-state gate, and we will say so.

Why not just threshold nearest-neighbor similarity instead of training a reconstruction model? Nearest-neighbor distance is already one member of our reconstruction family, so this alternative is tested directly rather than argued against. CRAD's evidence that grid interpolation generalizes beyond exact matches comes from images, not language, so it may not transfer. If nearest-neighbor matches the grid on edit quality and harder out-of-scope preservation, we adopt it. It is also cheaper to write, since the grid must be refit as edits arrive and we will measure that write cost. Either way, the contributions of time-scoped keys and pre-model gating stand.

Why not just train a classifier to route queries, as SERAC does? SERAC's 33.1% preservation on same-subject, unrelated queries, against EREN's 95.9%, shows that discriminative routers learned on edits generalize poorly to near-miss queries. Our gate is one-class: it is fit only to edit records, so it does not need examples of everything that is not an edit. The harder out-of-scope split directly tests whether that difference matters.

Why not just let EREN read dated notes and decide relevance itself? This may well recover historical recall, since instruction-tuned models follow the notebook format reliably. But it keeps the full per-query retrieval, relevance pass, and longer prompt. The time-aware EREN baseline measures exactly this trade. If it matches our accuracy, the proposal reduces to a latency contribution, and its value then depends on the speedup curve below.

Why not just use an LLM profiler, as in METIS? METIS reports 1.64 to 2.54 times lower response delay by profiling each query with an auxiliary model. That profiler is itself an extra model pass on every query and needs fallbacks when it is uncertain. Our gate reuses computation the base model already performs. We will report the gate's overhead in absolute milliseconds next to a profiler pass on the same hardware.

Proposed Experiments

The first experiment runs the diagnostic on AToKe's single-edit, multiple-edit, and extending-edit splits. It reports current and historical edit and recall scores for EREN with and without dates, and for our gate with and without the time vector. The decisive check is whether fact-only memories drive historical scores well below the frozen-model ceiling and whether time-scoped keys restore them.

The second experiment reproduces EREN's harder out-of-scope and 1,024-sequential-edit protocols, to confirm that gating costs no more than about a point of preservation or edit quality.

The third experiment measures latency under mixed traffic, varying the fraction of edit-touching queries from 1% to 50% and the memory size from hundreds to tens of thousands of edits. We report mean and tail latency per query, gate overhead, and the gate's miss rate, meaning edit queries routed to the weights. Gate quality is reported as threshold-free AUROC together with the operating point chosen from edit paraphrases alone. Following the lesson of TSB-AD about metrics that flatter weak detectors, we never credit partial matches.

The fourth experiment stress-tests multi-hop and temporal-scope questions on MQuAKE and TKEMQA. We expect a single-note gate to trail TEMPLE-MQA's graph planning there, and we will report how far behind it falls.

The proposal fails if time-scoped keys do not beat fact-only keys on historical scores, or if the gate's misses erase the latency gain at realistic edit fractions.