← Latest papers
💬 NLP

Tool-Call Dependency Structure is Linearly Decodable in LLM Agent Residual Streams

This paper demonstrates that the directed dependency graph of tool-call trajectories in LLM agents is linearly decodable from the model's residual streams, revealing that the network actively represents abstract execution topology rather than merely tracking positional order or identifier values.

Original authors: Tianda Sun, Dimitar Kazakov

Published 2026-05-26
📖 5 min read🧠 Deep dive

Original authors: Tianda Sun, Dimitar Kazakov

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

The Big Idea: Reading the "Ghost" of a Plan

Imagine a large language model (LLM) as a very smart, but slightly forgetful, assistant. When you ask this assistant to do a complex task—like "Find a user, check their order, and then exchange the product"—it doesn't just do it in one giant leap. It has to take several steps, calling different tools along the way.

The paper asks a simple question: Does the model "know" how these steps connect to each other while it is thinking?

Specifically, if Step A gives information that Step B needs, does the model's internal brain (its "residual stream") actually hold a map showing that connection? Or is the model just guessing the next step based on what it said last?

The researchers found that yes, the model does hold this map. They built a tiny, simple "decoder" that can read the model's internal thoughts and reveal the hidden dependency graph (the map of who needs what from whom) with high accuracy.

The Analogy: The Construction Site Blueprint

Think of the model as a construction site.

  • The Tools: The model uses tools like "Get User" or "Get Order."
  • The Trajectory: The sequence of actions the model takes.
  • The Dependency Graph: This is the blueprint. It says, "You can't pour the concrete (Step B) until you have the cement delivery receipt (Step A)."

Usually, we only see the finished building (the final answer). We don't see the blueprint inside the workers' heads. This paper is like putting on special X-ray glasses that let us see the blueprint floating inside the workers' minds as they work.

How They Did It (The "Decoder")

The researchers used a model called Qwen3-32B. They watched it solve problems and recorded its internal "residual stream" (a continuous stream of data representing its current state of mind).

They trained a very small, simple tool (a "probe") to look at this stream and answer a binary question for any two steps in the process:

"Does the output of Step A feed into the input of Step B?"

The Results:

  • It works: The probe could predict these connections with about 87% accuracy.
  • It's not a trick: They tested against random guesses and simple patterns (like "Step 2 always follows Step 1"). The probe did much better than those, proving it was actually reading the logic of the connection, not just the order of events.
  • It's abstract: When they changed the specific numbers in the data (e.g., changing a user ID from "123" to "456") but kept the structure the same, the probe still worked. This means the model understands the relationship (A depends on B), not just the specific words.

The "Ghost" in the Machine (Propagation)

One of the coolest findings is about how this information travels.

Imagine you whisper a secret to the first worker (Step A). The paper shows that this secret doesn't just disappear after the worker finishes. It travels through the entire construction site, lingering in the "air" (the residual stream) all the way to the last worker (Step Z).

They proved this by "patching" (swapping) the internal state of the first worker with a different scenario. Even though the model didn't change its final behavior (it still built the same house), the "blueprint" inside the later workers changed to match the new scenario. This suggests the model is actively carrying the structural plan forward, not just reacting to the immediate prompt.

When Does This Map Disappear?

The researchers tested this on different types of tasks to see if the map is always there. They found a pattern:

  1. Complex Chains (Multi-hop): If the task requires a long chain of dependencies (A \to B \to C \to D), the map is very clear and easy to read.
  2. Simple Lists: If the task is just a list of independent steps (A, then B, then C, with no connections), the map vanishes.
  3. The "Order" Clue: If the steps are so simple that just knowing the order tells you everything (e.g., "First do A, then B"), the model doesn't need to build a complex internal map. The "extra" signal disappears because the position alone is enough.

What This Means (and What It Doesn't)

What it means:
We have found a new way to look inside AI agents. We can see that they aren't just blindly guessing the next word; they are maintaining a structured, abstract map of how their actions depend on one another. This map is linear (easy to read) and travels through the model's layers.

What it does NOT mean (based strictly on this paper):

  • It does not mean we can now easily control the model to make better decisions (the paper explicitly says the patching changed the internal map but not the final behavior).
  • It does not mean this works on every single AI model or every tiny model (they only tested specific large models).
  • It does not mean we can use this to fix "hallucinations" or make the model safer yet; that is future work.

Summary

The paper is like discovering that a magician's assistant isn't just memorizing a script, but is actually holding a mental map of the entire trick's logic. By using a simple decoder, the researchers proved that this map exists, travels through the model's brain, and is essential for solving complex, multi-step problems.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →