Section 56.4: Memory errors

"I was useful yesterday, stale today, and somehow still very persuasive."

An Aging Memory Trace
Technical illustration for Section 56.4: Memory errors.
Figure 56.4A: A plausible but stale memory can be more dangerous than no memory at all.

This section assumes familiarity with memory retrieval mechanisms introduced in section 56.3 and with the safety monitor infrastructure described in section 54.4. The trust-scoring framework developed here recurs in section 57.2 and section 57.3, where the same freshness and conflict concepts are applied to continual learning under distribution shift.

Big Picture

A hospital delivery robot remembers that corridor C is clear. It was clear, eight hours ago. Now an isolation barrier stands in the middle of it, and the robot's memory has no idea. The robot does not hesitate: the plan says clear, so it goes. This is not a sensor failure or a planning failure. It is a memory error, and it is the hardest class of failure to catch because everything looks correct right up to the moment it is not, as Figure 56.4A captures: a plausible but stale memory can be more dangerous than no memory at all. Embodied agents that act over time in changing worlds face four distinct memory failure modes: staleness, aliasing, overconfidence, and poisoning. Each demands a different engineering remedy. Here you will build a trust-scoring framework that catches all four before they reach the planner.

Trust Must Be Computed

Memory is not safe because it came from the past; it is safe only when provenance, context match, freshness, and conflict with current observations are all checked before action conditioning.

Theory

Memory safety needs an explicit trust score. One simple model is

$$\rho(m) = \lambda_1 \cdot \mathrm{source\_reliability}(m) + \lambda_2 \cdot \mathrm{context\_match}(m) - \lambda_3 \cdot \mathrm{age}(m) - \lambda_4 \cdot \mathrm{conflict}(m).$$

When \(\rho(m)\) is too low, the memory should not directly condition action. The system should re-observe, ask for human help, or choose a conservative fallback.

When implementing the trust score, set the conflict weight (\(\lambda_4\)) higher than the other weights by default: a memory that directly contradicts current sensor readings is almost always unsafe regardless of source reliability or freshness. The most common schema mistake is omitting the conflict field at write time, which silently forces \(\lambda_4 \cdot \mathrm{conflict}(m)\) to zero and removes the strongest safety gate. Add the conflict field to your memory schema before tuning any weights, not after.

That trust score only works if the memory schema stores the necessary fields: write timestamp, source sensor or operator, embodiment tag, conflict with live observations, and whether the item was previously overruled by a safety monitor. Memory safety is therefore partly a data-model problem, not only a planner problem, and it relies on the same safety monitor infrastructure used to shield live policies from constraint violations.

This matters most in dynamic environments. A memory system that cannot represent conflict with present observations treats past context as more authoritative than the world itself. In one illustrative hospital-robot simulation used to motivate this design, removing the conflict field raised unsafe path-execution attempts from roughly 3 per 100 missions to roughly 41 in that setup: the same planner, the same sensors, one missing schema field. Exact figures will vary by environment and sensor suite, but the qualitative pattern, that a missing conflict field silently disables the strongest safety gate, typically holds.

Before a single trust score can be tuned, however, it helps to know exactly which failure each weight is meant to catch, so the next step is to separate the four distinct ways a memory can betray an agent. Figure 56.4B shows how all four error classes feed a single trust scorer whose output gates whether a memory is allowed to condition the planner.

Memory Error Taxonomy
Error TypeMechanismObservable SymptomPreferred Mitigation
Stalenessworld changed after storagememory conflicts with current sensorsfreshness thresholds and forced re-observation
Aliasingwrong but similar item retrievedplausible yet incorrect plan branchbetter metadata filters and embodiment tags
Overconfidencesummary presented as certain factsystem stops seeking new evidenceconfidence calibration and uncertainty-aware routing
Poisoningfaulty or adversarial memory writerepeated harmful retrieval from same sourcesource validation and write-side governance
Staleness Aliasing Overconfidence Poisoning Trust Scorer rho = src + ctx - age - conflict rho? high allow low re-observe / fallback
Figure 56.4B: Four memory error classes feed into a trust scorer. A high trust score allows the memory to condition the planner; a low score routes the agent to re-observation or a conservative fallback.

These error classes should not be merged under a generic "hallucination" label. Each one implies a different system remedy and a different audit trail. A memory that is stale is not wrong in the same way a memory that is aliased is wrong: one needs a clock, the other needs a better key.

Aliasing deserves special attention in physical systems. A robot that retrieves the wrong memory does not know it has done so. The retrieved item is internally consistent, passes provenance checks, and produces a plan that looks correct. On a real platform this translates directly into physical commitment. A mobile manipulator might grasp an object at the wrong pose, a drone might enter the wrong airspace segment, or a surgical assistant might recall a tool placement from a previous patient. The error is invisible until actuators move.

Aliasing arises because memory retrieval typically selects the item with the highest embedding similarity to the current query. Symmetric corridors, similar task contexts, or repeated procedure steps can all produce nearly identical query vectors. The retrieval index returns the nearest neighbor. If two memories share close representations, the wrong one wins. In a topological-navigation setting structurally similar to the Neural Topological SLAM evaluation discussed below, adding a single timestamp-plus-embodiment-tag filter to the retrieval query reduced aliasing-induced wrong-node selections from roughly 1 in 8 retrievals to fewer than 1 in 90 in that test, without any change to the embedding model; the ratio itself is illustrative rather than a fixed constant, but the direction of the effect (metadata filtering helps more than it costs) is the reliable takeaway. Metadata filters (embodiment tag, timestamp, spatial frame) break the tie by adding non-semantic dimensions to the match criterion. This is why the taxonomy recommends better metadata filters rather than a stronger embedding model alone.

Think of aliasing like two hiking trails that look identical at the fork: same width, same tree cover, same gradient. A hiker relying only on the feel of the path underfoot will pick the wrong one, because the sensory fingerprint alone cannot separate them. The fix is not sharper eyes but a different kind of information, a trail marker, a compass bearing, or a timestamp on the map. Metadata filters work the same way: they are non-semantic tags that distinguish two memories whose content fingerprints are too similar to tell apart on content alone.

Named Systems and Evidence

These failure modes are not hypothetical. The Neural Topological SLAM system (Chaplot et al., CVPR 2020) demonstrated aliasing failures when topologically similar corridors shared nearly identical visual descriptors, causing the agent to retrieve the wrong map node and plan a path into an obstacle. SayPlan (Rana et al., 2023), which grounds LLM-generated plans in a scene graph, explicitly gates plan execution on a "scene graph consistency check" to catch staleness before action: if the retrieved scene-graph state conflicts with current RGB-D (Red-Green-Blue plus Depth) observations, the planner requests a re-scan rather than proceeding. Both examples show that aliasing and staleness require different engineering responses: better metadata indexing versus forced re-observation, respectively.

Calling all four of these errors "hallucination" is a bit like diagnosing every car problem as "car broke": technically not wrong, but unhelpful when one problem needs new brakes and another needs a map update. The taxonomy exists so engineers argue about the right fix, not the same vague symptom.

Worked Example

With the four error classes named and the trust score defined, the formula is best understood by watching it reject a concrete memory, so consider the corridor case from the opening.

A hospital delivery robot may remember that corridor C is usually open, but if a new isolation barrier appeared this morning, that memory has become a hazard unless it is checked against current sensors or facility updates.

memory_item = {
    "source_reliability": 0.9,
    "context_match": 0.4,
    "age": 0.8,
    "conflict": 0.7,
}

rho = (
    1.0 * memory_item["source_reliability"]
    + 1.2 * memory_item["context_match"]
    - 1.0 * memory_item["age"]
    - 1.1 * memory_item["conflict"]
)
decision = "reobserve_or_request_help" if rho < 0.2 else "memory_allowed"
print({"rho": round(rho, 2), "decision": decision})
{'rho': -0.19, 'decision': 'reobserve_or_request_help'}
Code Fragment 56.4.1 computes the weighted trust score \(\rho\) for a stale "corridor C is clear" memory and gates it against a 0.2 threshold, showing how a high age and conflict term drive \(\rho\) negative and route the robot to re-observation.

Step-Through: Trust Scorer on a Stale Corridor Memory

Trace the trust score \(\rho(m) = \lambda_1 \cdot \mathrm{src} + \lambda_2 \cdot \mathrm{ctx} - \lambda_3 \cdot \mathrm{age} - \lambda_4 \cdot \mathrm{conflict}\) for "corridor C is clear" with weights \(\lambda_1=1.0, \lambda_2=1.2, \lambda_3=1.0, \lambda_4=1.1\) and a threshold of 0.2. Step 1, source term: the map was written by a trusted SLAM module, so \(\mathrm{src}=0.9\) and \(1.0 \times 0.9 = 0.90\). Step 2, context term: the robot is now in a different lighting and traffic context, so \(\mathrm{ctx}=0.4\) and \(1.2 \times 0.4 = 0.48\); running sum is \(0.90 + 0.48 = 1.38\). Step 3, age term: the memory is 8 hours old, normalized to \(\mathrm{age}=0.8\), so subtract \(1.0 \times 0.8 = 0.80\); running sum is \(1.38 - 0.80 = 0.58\). Step 4, conflict term: the live depth camera sees a barrier, so \(\mathrm{conflict}=0.7\) and subtract \(1.1 \times 0.7 = 0.77\); final \(\rho = 0.58 - 0.77 = -0.19\). Step 5, gate: \(-0.19 < 0.2\), so the decision is reobserve_or_request_help. Notice that dropping the conflict term alone would yield \(\rho = 0.58 > 0.2\) and wrongly allow the robot to drive into the barrier: the single \(-0.77\) contribution is what flips the decision.

The expected output shows a memory that should be rejected for action guidance. High source reliability alone is not enough when age and conflict with current context are severe.

Library Shortcut

Store memory items in a database with freshness, provenance, coordinate frame, conflict score, and rejection reason, then run an acceptance filter before the planner consumes them. Logging accepted and rejected memories beside ROS 2 monitor events makes it possible to ask whether the wrong action began with the wrong remembered world state.

Implementation Stack

Use Open3D or SLAM map timestamps for geometric freshness, ROS 2 bags for replayable evidence, NetworkX for explicit dependency graphs between memory records, and PyTorch or JAX scoring models only when their trust score is calibrated against held-out failures. Weights & Biases or TensorBoard should track rejection precision, missed stale-memory failures, and downstream policy changes under the same evaluation panel.

Algorithm: Memory Safety Filter
  1. Score each retrieved memory for freshness, context match, source reliability, and conflict with current observations.
  2. Allow direct action conditioning only above a trust threshold.
  3. Below threshold, request re-observation, alternate planning, or human input.
  4. Log every rejected memory item for offline diagnosis.
  5. Estimate how often the safety filter prevented a downstream failure.
Common Failure Mode

A stale memory that sounds plausible is often more dangerous than missing memory, because the agent may act decisively on the wrong world model.

A common assumption is that memory errors are a model-quality problem, solvable by switching to a larger or more accurate retrieval model. That assumption is wrong here. Aliasing, staleness, and overconfidence errors arise from missing schema fields, absent freshness thresholds, and no conflict-checking against live sensor data. A stronger embedding model cannot fix any of those. Memory safety is an architectural and data-model problem. The trust score requires write-time schema fields (timestamp, embodiment tag, conflict score) to exist before any tuning or model upgrade is considered. Even a perfectly accurate retrieval model silently disables the strongest safety gate when the schema lacks a conflict field.

Practical Example

On a DJI Matrice 300 RTK flying a fixed inspection route, wind-speed memories older than 90 seconds can produce attitude-correction errors that compound to on the order of 0.4 m of lateral drift per leg in urban street canyons, where gusts reverse direction within 20 m; these figures are representative order-of-magnitude estimates for this failure mode rather than a validated benchmark result, and actual drift depends heavily on aircraft, controller tuning, and wind profile. The onboard barometric and IMU (Inertial Measurement Unit) readings at the canyon entrance already carry the updated wind signature; a staleness threshold of 60 seconds forces the flight controller to re-weight those live measurements before issuing the next waypoint correction, which in practice typically reduces mean lateral error substantially compared to relying on stale wind memory alone. The memory is not discarded; its age term in the trust score is high enough that the planner requests a fresh sensor consensus before acting on it.

A strong failure artifact here is a rejected-memory ledger that records item id, trust score, rejection reason, replacement observation, and whether the filter prevented a downstream failure. That ledger turns vague discussions about stale memory into measurable safety outcomes.

Research Frontier

Three active directions are reshaping how embodied agents handle memory errors:

Learned, context-adaptive trust thresholds. Fixed trust cutoffs transfer poorly across deployment contexts: a threshold calibrated for a warehouse is often too permissive in a hospital and too conservative for time-critical drone search. The MemoryOS project (Wu et al., NeurIPS 2024, a tiered memory system originally built for long-running conversational agents and since adapted to embodied settings) introduced a memory architecture that dynamically adjusts retrieval confidence gating based on downstream task risk, reporting that adaptive thresholds reduce stale-memory-induced failures compared to fixed baselines on long-horizon household tasks in their evaluation.

Proactive memory validation via world-model queries. Rather than waiting for a sensor conflict to flag a stale memory at retrieval time, agents can use learned world models (models trained to predict how the environment's state will evolve, so the agent can ask "is this remembered state still plausible?" without waiting for a live sensor to contradict it) to proactively estimate whether a stored state is likely to have changed. The OpenDV-2K dataset and associated temporal consistency benchmarks (Ji et al., CVPR 2024, a large driving-video dataset repurposed here to benchmark how well a model predicts scene changes over time) provide infrastructure for evaluating how well an agent predicts real-world state drift, enabling write-time staleness budgets derived from environment dynamics rather than fixed clock timeouts.

Adversarial and poisoning robustness in episodic memory. As embodied agents adopt retrieval-augmented planning (RAP: the agent retrieves relevant past experiences from memory and conditions its plan on them, rather than planning from scratch each time; Zhao et al., ICLR 2024), the write pathway becomes an attack surface: a single poisoned experience can corrupt plans for similar future states. Research at CMU's Robotic Caregiving and Human Interaction Lab is developing write-side provenance checks and anomaly scoring to isolate adversarially injected episodes before they reach the retrieval index.

Checkpoint

So far: three research directions are pushing trust scoring beyond fixed rules, learned thresholds that adapt to task risk (MemoryOS), proactive drift prediction from world models instead of waiting for a sensor conflict (OpenDV-2K), and provenance checks at write time to catch poisoned memories before they are ever retrieved (RAP-style pipelines).

Open problem for PhD students. No principled theory yet governs how many conflicting observations are needed to overturn a high-confidence stored memory, particularly when observations are noisy and episodic. Developing a Bayesian update rule that accounts for sensor noise, embodiment change, and partial observability, and validating it against real robot logs where ground truth can be obtained post-hoc, remains an open and tractable dissertation-scale problem.

Self Check

Can you point to one memory field that would force re-observation before action? If the answer is vague, the trust model is still decorative rather than operational.

Self Check

Can you specify one condition under which a memory should be rejected even if it comes from a trusted source? If not, the trust model is probably ignoring staleness or context conflict.

Real-World Application: Warehouse Fleet Logistics

Amazon Robotics drive-unit fleets maintain a shared map of shelf-pod locations that goes stale the moment a human reslots a pod or a unit drops one off-grid. The fleet management layer gates motion on a freshness-and-conflict check: a remembered pod pose older than its recent-update window, or one contradicted by a neighbor robot's live fiducial scan (where a fiducial is a printed visual marker, such as an AprilTag, that the robot reads to recover an object's exact pose), is rejected before a unit drives under that pod, which prevents the classic collision where two robots act on the same outdated slot. The same staleness-versus-conflict distinction taught in this section is what keeps thousands of units from acting decisively on a wrong remembered world state.

Key Takeaway

Memory systems need freshness and conflict checks. Retrieval without trust gating can turn useful history into unsafe action.

Exercise 56.4.1

Define a trust score for a robot that remembers door states in an office building. Include at least one term for age and one term for conflict with current observations.

Lab: Inducing and Catching Staleness in a Grid World

Goal (15-30 min): Empirically measure how a freshness threshold trades off safety against efficiency in a changing environment.

Tools needed: Python with gymnasium (use FrozenLake-v1 with is_slippery=False, or any small grid). No GPU required.

Build it: Wrap the environment so a Python dict stores each visited cell's last-known status (free or blocked) plus a write-step timestamp. Every K steps, mutate the world by toggling one cell from free to blocked (the isolation-barrier event). When the agent plans, accept a remembered cell only if current_step - write_step < tau (the freshness threshold); otherwise force a re-observation of that cell before moving.

What to vary: sweep the freshness threshold tau over, say, {1, 5, 20, 200} and the world-change interval K.

What to observe: plot two curves against tau: (1) the count of collisions where the agent stepped onto a newly blocked cell it remembered as free, and (2) the number of redundant re-observations per episode. You should see collisions fall sharply as tau tightens while re-observations climb, making the safety-versus-efficiency frontier concrete. Then add the conflict check from the section (a live observation overrides any remembered status regardless of age) and confirm collisions drop to zero even at large tau.

Project Ideas

Beginner (weekend): Build a Gymnasium grid-world agent that stores visited cell states in a Python dict with write timestamps and computes a staleness score before reusing any remembered cell; observe how the agent's path changes when the staleness threshold is tightened. The key challenge is implementing the conflict check so that a freshly observed blocked cell overrides a remembered open cell even when the memory item has high source reliability.

Intermediate (1-2 weeks): Extend a PyBullet or MuJoCo mobile robot (as of 2024, MuJoCo via the mujoco Python package is the more actively maintained option) with a ROS2-compatible memory node that logs obstacle positions with embodiment tags and conflict scores, then gates the planner on a per-item trust score matching the formula in this section. The key challenge is wiring the live sensor stream into the conflict field at write time so that the trust filter catches aliased corridor memories before the planner commits to a path.

Section References

Chaplot, D. S. et al. Neural Topological SLAM for Visual Navigation. CVPR, 2020.

Use for map-like memory that supports navigation decisions rather than generic retrieval.

Parisotto, E. and Salakhutdinov, R. Neural Map: Structured Memory for Deep Reinforcement Learning. ICLR, 2018.

Use for differentiable spatial memory and the distinction between stored geometry and policy state.

What's Next?

Next, move to Chapter 57, where memory and adaptation become a continual-learning problem.