mech.app
AI Agents

Early Abort Probes: How LLM Agents Predict Their Own Failure Before Wasting Compute

Lightweight probes on hidden activations predict agent trajectory failure before observable task breakdown, saving 37-47% of inference compute.

Source: arxiv.org
Early Abort Probes: How LLM Agents Predict Their Own Failure Before Wasting Compute

LLM agents burn inference budget on doomed trajectories. A multi-step task that will fail after eight rounds still consumes eight rounds of compute. The agent commits to a bad plan, executes it faithfully, and only discovers the failure when the environment rejects the final action or the task times out.

A new paper from Ruan et al. shows that failure is predictable from the agent’s internal representations before the trajectory breaks down. Lightweight probes on hidden activations anticipate episode failure as early as the first interaction round, when scorers reading only the agent’s observable behavior are barely better than chance. The technique saves 37-47% of inference compute on TextCraft benchmarks by aborting doomed episodes early.

This is not post-hoc observability. It is predictive failure detection using the model’s own internal state, inserted into the agent loop without rewriting the orchestration logic.

The Problem: Doomed Trajectories

Multi-step agent episodes follow a pattern:

  1. Agent receives task and environment state
  2. Agent generates action
  3. Environment executes action and returns new state
  4. Repeat until task completes or fails

When an agent commits to a bad plan in round one, it often continues executing that plan for dozens of rounds. The failure is only observable when the environment rejects a critical action or the agent runs out of steps. By then, you have paid for every inference call in the trajectory.

Observable behavior (the action text, tool calls, intermediate outputs) does not reliably signal impending failure. The agent’s internal representations do.

Probe Architecture

The probe cascade inserts lightweight classifiers at each interaction round. Each probe reads the agent’s hidden activations and outputs a binary abort signal.

Per-Round Probe Design:

  • Linear classifier on top-layer hidden states
  • Trained on labeled episodes (success vs. failure)
  • Calibrated to meet a per-round recall budget
  • No access to future rounds or environment feedback

Cascade Structure:

  • One gate per round
  • Episode survives only if it passes all gates up to the current round
  • Per-round recall budgets are jointly searched to meet a global episode-level recall target
  • False-abort risk accumulates across gates, so the cascade optimizes for episode survival rate, not per-round accuracy

The key insight: hidden states at round N contain information about whether the episode will eventually fail, even when the observable action at round N looks reasonable.

Implementation Details

Instrumentation Points:

You need to hook into the agent loop at two places:

  1. After the LLM forward pass, before action decoding
  2. Before the environment step, to inject the abort decision

For LangGraph or AutoGen, this means wrapping the LLM call node and adding a conditional edge that routes to an abort handler.

Probe Training:

  • Collect a dataset of complete episodes with success/failure labels
  • For each episode, extract hidden states at each round
  • Train a per-round binary classifier (logistic regression or small MLP)
  • Calibrate thresholds using conformal prediction to meet recall budgets

Calibration:

The paper uses distribution-free calibration to guarantee episode-level recall. Given a target global recall (e.g., 90% of successful episodes must survive all gates), the calibration procedure searches for per-round thresholds that jointly satisfy the constraint.

This is not a hyperparameter sweep. It is a sample-splitting procedure that provides a probabilistic guarantee on held-out data.

Compute Savings

On TextCraft with Qwen-2.5-7B and Llama-3.2-3B:

ModelGlobal RecallCompute SavedLift vs. Single Gate
Qwen-2.5-7B90%47.1% ± 10.3%1.6x
Llama-3.2-3B90%37.2% ± 8.8%1.6x

The cascade outperforms a single-gate policy (one probe at a fixed round) by 1.6-1.7x. A cascade reading only observable behavior (action text, tool calls) saves roughly half as much. Adding behavioral features to the hidden-state probe yields no further gain.

The hidden states capture what behavior reveals, plus information that behavior does not expose.

Integration with Orchestration Frameworks

LangGraph Example:

from langgraph.graph import StateGraph
from typing import TypedDict

class AgentState(TypedDict):
    messages: list
    round: int
    abort: bool

def probe_gate(state: AgentState, probe_model, threshold):
    """Check hidden states and decide whether to abort.
    
    extract_hidden_states() is called after the LLM forward pass
    but before action decoding, typically by hooking the model's
    output layer or using a custom generation callback.
    """
    hidden_states = extract_hidden_states(state["messages"][-1])
    score = probe_model.predict_proba(hidden_states)[1]
    return score < threshold

def build_graph_with_abort(agent_node, probe_cascade):
    graph = StateGraph(AgentState)
    
    graph.add_node("agent", agent_node)
    graph.add_node("abort", lambda s: {"abort": True})
    
    def should_abort(state):
        round_idx = state["round"]
        if round_idx < len(probe_cascade):
            threshold = probe_cascade[round_idx]
            if probe_gate(state, probe_model, threshold):
                return "abort"
        return "continue"
    
    graph.add_conditional_edges("agent", should_abort, {
        "abort": "abort",
        "continue": "agent"
    })
    
    return graph.compile()

AutoGen Integration:

Wrap the agent’s generate_reply method and inject the abort check before returning the message. If the probe fires, return a sentinel message that triggers the orchestrator’s early-exit path.

Key Constraint:

The probe must not block the forward pass. Extract hidden states asynchronously or cache them during the LLM call. The abort decision happens before the environment step, not during token generation.

Failure Modes

Calibration Data Mismatch:

If the probe is calibrated on one task distribution and deployed on another, the recall guarantee breaks. The paper provides sample complexity bounds: you need O(1/ε²) episodes to certify a recall target within ε of the true rate (e.g., ε=0.05 for ±5% tolerance on the recall estimate).

Cascading False Aborts:

Each gate adds false-abort risk. A 10-gate cascade with per-round recall 99% yields global recall ~90%. If you miscalibrate one gate, the entire cascade undershoots the target.

Latency Overhead:

Each probe adds a forward pass through a small classifier. On a 7B model, this is negligible (sub-millisecond). On a 70B model with tight latency SLAs, you may need to batch probe inference or run it on a separate accelerator.

State Extraction Complexity:

Extracting hidden states requires model access. If you are calling a hosted API (OpenAI, Anthropic), you cannot run probes. This technique is only viable when you control the inference stack.

When to Use This

Use early abort probes if:

  1. You control the inference stack (self-hosted models or API providers that expose hidden states)
  2. Inference cost represents more than 30% of total agent operating cost
  3. You have at least 500 labeled episodes for calibration (1000+ for high-recall targets above 95%)
  4. Average episode length exceeds 5 rounds
  5. Task distribution is stable (less than 20% shift between training and deployment)

Avoid this technique if:

  1. You call hosted APIs without hidden-state access (OpenAI, Anthropic, Cohere)
  2. Episodes are short (fewer than 5 rounds), where the overhead of probe inference exceeds potential savings
  3. Task distribution shifts frequently (more than 20% between calibration and production)
  4. You cannot tolerate any false aborts (e.g., high-stakes medical or financial decision-making where aborting a viable trajectory has severe consequences)
  5. You lack sufficient labeled data (fewer than 500 episodes)

The tradeoff:

You exchange 1-2ms of probe latency per round for 37-47% compute savings on doomed trajectories. The break-even point occurs when probe overhead is less than the cost of one wasted environment interaction. For most multi-step agents, this threshold is reached by round 3.

Technical Verdict

Implement early abort probes if you run agents on your own infrastructure and inference cost is a material line item. The 37-47% savings are real, the calibration procedure is sound, and the integration overhead is manageable. The technique pays for itself after processing approximately 200 episodes (assuming typical cloud GPU pricing).

Skip this if you call hosted APIs or your episodes are short. The core limitation is that you need model internals, which rules out most hosted services. For short episodes (fewer than 5 rounds), the probe overhead exceeds the savings from early abort.

The gap between internal representations and observable behavior is the key finding. Agents know they are failing before the failure becomes visible. The plumbing challenge is extracting that signal without breaking the orchestration loop. If you control the inference stack and have the calibration data, this is a straightforward win. If you do not, you are stuck with post-hoc observability and retry budgets.

Tags

agentic-ai orchestration infrastructure

Primary Source

arxiv.org