XMind: Thinking Twice via Cross-Memory Reasoning for LLM-Based Autonomous Driving

Zuyi Guo, Xianjie Dai, Lei Yang, Xiaocong Zhao, Jingguang Li, Kitae Jang, Heye HuangarXiv 2026

TL;DR

When an LLM-based autonomous vehicle crashes in simulation, simply asking it to "reflect" on what it should have done often creates brittle, unverified rules that fail when traffic shifts slightly. XMind solves this without fine-tuning a single parameter by rewinding critical moments to simulate every possible alternative action, building an evidence-backed memory of what actually works. During live driving, the agent trusts its gut first and only "thinks twice" if this verified historical memory explicitly disagrees with its initial plan.

What Problem Does This Paper Address?

Autonomous vehicles excel at routine driving, but rare "long-tail" events—like sudden cut-ins or abrupt braking in dense traffic—remain dangerous. Lately, researchers have used Large Language Models (LLMs) paired with external memory banks so driving agents can learn from past mistakes without expensive retraining.

However, current memory-augmented agents suffer from two very human flaws:

  1. Hindsight bias without proof: When an agent crashes, it typically reflects on the event and writes down a correction (e.g., "I swerved left and crashed; next time, brake instead"). Nobody actually checks if braking would have prevented the crash—or caused a pileup behind it.
  2. Overthinking: Existing agents tend to shove retrieved memories into the prompt whenever a scene looks vaguely familiar. Weakly related memories end up polluting otherwise sensible decisions.
Comparison between unverified reflection-based memory and XMind's evidence-backed "Think Twice" reasoning

Methods

XMind keeps its backbone LLM completely frozen and splits memory into two systems: a short-term working memory and a long-term episodic memory.

  • Working Memory & Risk Layout: To give the LLM a sense of momentum and evolving danger, working memory feeds it the last $N=3$ frames of traffic data. Surrounding cars are mapped into a $4 \times 3$ spatial grid, scored from 0 to 2 using a combination of spatial Driver Risk Fields (DRF) and Time-to-Collision (TTC).
  • Offline Counterfactual Verification (The Novel Core): After an episode ends, XMind hunts for the pivotal moment—backtracking from a collision to find the last savable state, or finding the moment of peak risk. It then runs counterfactual rollouts: it rewinds to that exact frame and tests all five discrete meta-actions (LANE_LEFT, LANE_RIGHT, FASTER, SLOWER, IDLE) across four perturbed traffic conditions. Actions are labeled recoverable (safe across all tests), dangerous, or uncertain. Only states containing both recoverable and dangerous options—meaning the choice truly mattered—are packaged into risk capsules and saved to episodic memory.
  • Selective "Think Twice" Reasoning: Online, the LLM makes an initial decision using only its working memory. If nearby risk is elevated, XMind searches episodic memory by matching both text descriptions and the $4 \times 3$ risk grid (even mirroring the grid horizontally to catch symmetric left/right traffic patterns). If—and only if—a matched capsule's verified best action contradicts the LLM's initial choice, XMind triggers a second LLM call with the counterfactual evidence to reconsider.
Fig. 2. Overview of XMind. Working memory provides recent traffic context and a spatial risk layout. Online decision-making uses risk-gated episodic retrieval to cross-check the initial decision, triggering “Think Twice” reasoning when the retrieved preferred action differs from the initial choice. Offline validation evaluates candidate actions at critical states through counterfactual rollouts, distinguishing recoverable, dangerous, and uncertain actions. The resulting evidence is stored as risk capsules in episodic memory for reuse across episodes. The LLM parameters remain frozen throughout the whole process.

Datasets

Because XMind is training-free, datasets are used strictly to populate episodic memory and evaluate driving decisions:

  • Highway-env: A closed-loop simulation environment used to build risk capsules and run evaluations across multi-lane highways (4 to 5 lanes) with varying traffic densities.
  • K-Risk: An open-loop benchmark of real-world, high-risk interactions (hard braking and left/right cut-ins). The authors evaluate on three subsets derived from recorded human traffic: highD (86 events), NGSIM (107 events), and an extreme subset from CitySim (38 events).

Key Insights and Ideas

  • Don't remember everything—only remember decisive moments: Storing outcomes where every option was safe (or every option crashed) adds noise. Filtering episodic memory strictly for states where life-or-death choices diverged makes retrieval crisp and actionable.
  • Disagreement is a great compute filter: By only invoking memory-guided reasoning when past evidence conflicts with the agent's instinct, XMind prevents irrelevant memories from derailing good driving while saving token costs when the agent already knows what to do.
  • Sim-to-Real memory transfer works: Risk capsules forged entirely inside a simple highway simulator successfully helped the LLM make safer choices than actual human drivers on recorded real-world highway footage.
Case study showing XMind overriding a risky deceleration instinct with a counterfactually verified lane change

Key Results

  • Closed-loop simulation: Across three increasingly dense Highway-env setups, XMind achieved collision-free success rates of 93.3%, 90.0%, and 83.3%, beating the strongest risk-aware baseline (RESPOND) by ~6.6 percentage points on average, and outperforming classic memory agents like DiLu by up to 36.6 percentage points in heavy traffic.
  • Speed vs. Safety: XMind drove slightly slower (10.74–11.65 m/s) than aggressive baselines like KoMA (up to 15.83 m/s), trading top speed for surviving the full 30-step episodes.
  • Real-world risk reduction: On K-Risk, equipping XMind with 30 simulator-built risk capsules reduced mean peak risk relative to human drivers by 3.64% on highD and 9.12% on NGSIM.
  • Ablations: Removing working memory dropped success rates in dense traffic from 66.7% to 50.0%. Replacing counterfactual rollouts with standard LLM reflection dropped performance from 83.3% to 78.9%, proving that testing alternatives beats merely guessing about them.

Limitations and Future Work

  • Token overhead: Triggering a second LLM call upon disagreement isn't free. XMind uses ~3,100 input and ~180 output tokens per step—cheaper than multi-agent KoMA (~5,800 input), but roughly triple that of RESPOND (~1,000 input).
  • Domain gap on extreme events: On the extreme CitySim subset of K-Risk, simulator-derived memories struggled to generalize, slightly increasing mean peak risk compared to using working memory alone (a 1.76% risk reduction vs. human, compared to 2.01% without episodic memory).
  • Future directions: The authors plan to expand memory coverage beyond 4-second highway rollouts to tackle longer time horizons and more diverse urban traffic scenarios.

Summary updated

Abstract

Memory-augmented large language model (LLM) driving agents can reuse past experience, yet previously learned corrections often fail to transfer when traffic conditions change. A key limitation is that existing memories mainly record observed outcomes, providing little evidence about alternative actions. We introduce XMind, a training-free framework that enables LLM-based driving to "Think Twice" through cross-memory reasoning. XMind integrates working memory of recent traffic states with episodic memory of critical risk events. The agent first makes an initial decision from the current context and then cross-checks it against retrieved historical experience. If a conflict arises, it makes a second decision guided by the retrieved evidence. To construct reliable episodic memory, XMind evaluates alternative actions through counterfactual rollouts under perturbed traffic conditions and stores the verified outcomes as structured risk capsules. These capsules are retrieved by jointly matching spatial risk patterns and scenario semantics. Across closed-loop highway simulations, XMind achieves success rates of 83.3-93.3%, exceeding the strong baseline by 6.6 percentage points on average. Evaluation on K-Risk further demonstrates lower decision risk on unseen real-world high-risk interactions. Ablation studies confirm the complementary benefits of working memory, risk-text retrieval, and counterfactual verification. Code is available at https://github.com/xiangxiangliuwo/XMind
BibTeX
@misc{guo2026xmind,
  author = {Zuyi Guo and Xianjie Dai and Lei Yang and Xiaocong Zhao and Jingguang Li and Kitae Jang and Heye Huang},
  title = {{XMind: Thinking Twice via Cross-Memory Reasoning for LLM-Based Autonomous Driving}},
  year = {2026},
  eprint = {2611.32209},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.32209},
}
Figure