Papers
Topics
Authors
Recent
Search
2000 character limit reached

Closed-Loop Graph Algorithm Execution with Small Language Models: Step Accuracy and Rollout Reliability

Published 23 Jun 2026 in cs.LG | (2606.24980v1)

Abstract: Small LLMs offer an efficient alternative to large-scale systems, but their ability to execute structured algorithms over multiple dependent decisions remains poorly understood. We study graph algorithm execution as a closed-loop prediction problem in which a model repeatedly selects the next action from the current graph and algorithmic state. Our evaluation framework covers several classical graph procedures, multiple synthetic graph families, and disjoint training, validation, and test partitions. It assesses both local decision quality and global execution behaviour using step accuracy, exact rollout accuracy, constraint validity, partial solution quality, prefix survival, and intervention-based diagnostics. The results show that adaptation can produce reliable policies for structural procedures such as traversal and coloring, while weighted algorithms remain substantially more sensitive to error accumulation. More broadly, the findings demonstrate that strong next-step prediction does not necessarily translate into reliable autonomous execution and motivate evaluating algorithmic LLMs through complete closed-loop rollouts rather than isolated decisions.

Authors (1)

Summary

  • The paper demonstrates that high local action accuracy in small LMs does not ensure robust closed-loop execution in graph algorithms.
  • It employs rigorous evaluations on six graph algorithms using synthetic graphs to assess exact rollout fidelity and error accumulation.
  • The study highlights that globally coupled tasks like Dijkstra and Prim are highly sensitive to cascading errors, stressing closed-loop metrics.

Closed-Loop Graph Algorithm Execution with Small LLMs: Key Insights and Implications

Problem Statement and Motivation

This paper investigates the capacity of small LLMs (SLMs)—specifically, instruction-tuned LLMs with 1–1.5B parameters—to serve as closed-loop agents for the stepwise execution of classical graph algorithms. Unlike settings where the model's output is a static answer, here the model emits discrete actions at each step, each of which directly alters the subsequent state and thus influences subsequent predictions. The central question is whether strong local (next-step) decision accuracy translates into reliable long-horizon autonomous rollouts when the model's own outputs recursively condition future states.

The study is motivated by challenges identified in neural algorithmic reasoning, agentic tool use, and program synthesis: local action correctness, when measured in isolation (teacher-forced), often poorly predicts aggregate rollout reliability under self-induced execution paths.

Methodology

The authors focus on six canonical graph algorithms: BFS, DFS, greedy coloring, Borůvka’s MST, Dijkstra’s shortest paths, and Prim’s MST. Synthetic graphs of 20–30 nodes from Barabási–Albert, Erdős–Rényi, and Watts–Strogatz families are used, with deterministic partitioning to ensure no overlap between training, validation, and test instances.

For each algorithm, at each step, the model receives a tokenized text serialization of the graph and current symbolic state. It outputs a single parseable action, which is executed externally by a deterministic symbolic executor. This strict separation ensures that the model is only responsible for decision selection, not state transitions, and that execution semantics remain precise and reproducible.

Two SLMs—Llama-3.2-1B-Instruct and Qwen2.5-1.5B-Instruct—are adapted per-task using LoRA (rank-16, scale 32) on 4-bit quantized parameters. Each adaptation is supervised on individual (state, action) pairs extracted from ground-truth rollouts for the training graphs.

The evaluation framework is comprehensive:

  • Teacher-forced step accuracy: Measures local action prediction accuracy on the unperturbed reference trajectory.
  • Exact rollout accuracy: Fraction of test graphs for which the model autonomously produces an action sequence yielding the exact reference solution.
  • Constraint validity, soft agreement, prefix survival, and oracle intervention diagnostics: Analyze the rollout's structural validity, partial agreement with ground-truth, error localization and accumulation, and minimum required corrections.

Zero-shot and chain-of-thought baselines using the unadapted instruction models are also evaluated.

Numerical Results and Empirical Findings

The unadapted SLMs, even with CoT prompting, are incapable of producing exact rollouts for any of the algorithms tested, confirming that adaptation is essential for this closed-loop graph reasoning task.

For adapted models:

  • BFS and DFS: Rollout accuracy is near teacher-forced accuracy. Llama achieves 97.33%/96.00%; Qwen achieves 95.33%/94.00%. Prefix AUCs exceed 93%. Step-to-trajectory gaps are minimal (<4pp).
  • Greedy Coloring: Despite ≥98% step accuracy, rollout accuracy is moderately lower (80%–86%) with high prefix AUCs (≥92%) and low correction counts, indicating late and often isolated errors.
  • Weighted Algorithms (Borůvka, Dijkstra, Prim): There is a large disconnect between step accuracy and rollout reliability:
    • Borůvka: ~93% step, but only 21%–25% rollout.
    • Dijkstra: ~85% step, only 13%–17% rollout. Prefix AUCs drop to <20%; on average, four oracle corrections are needed per trajectory.
    • Prim: Llama achieves 41% rollout, Qwen drops to 15%, despite similar step scores.
    • This demonstrates that SLMs are highly sensitive to error accumulation in globally coupled, numerically conditioned tasks.

Soft (partial) scores and constraint-validity remain high for MST algorithms even as exact rollouts collapse, implying that models often select many correct components but cannot maintain global constraints.

Analysis and Discussion

The data show that next-action accuracy, although traditionally used as the main metric for algorithmic policy learning, can be misleading when models act as closed-loop agents. For structural, locally constrained procedures (e.g., graph traversal), high local accuracy translates well to global execution fidelity due to the weak coupling and forgiving state evolution. In contrast, weighted and globally coupled procedures (Dijkstra, MST) are far more prone to cascading errors: a single plausible but non-optimal action can alter the state space such that subsequent decisions quickly drift from the reference, leading to dropout of exact solutions even when most actions are locally reasonable.

Rollout diagnostics—such as prefix survival and intervention counts—provide useful evidence on the temporal and structural patterns of model failures. For instance, Dijkstra rollouts fail early and irrecoverably, while coloring errors cluster later in execution.

These findings have significant implications:

  • Methodological: Model selection and evaluation for algorithmic LLMs must include closed-loop rollout analysis, not just teacher-forced accuracy, particularly for settings where the model's own outputs recursively influence future inputs.
  • Architectural: Increasing local prediction power (or prompt engineering) alone is insufficient for robust graph algorithm execution, especially under distributional shift caused by model-generated state drift.
  • Theoretical: The action/state representation, global vs. local constraint structure, and propagation properties of the algorithm critically determine model reliability. Prim and Borůvka, for example, are both MST algorithms but exhibit fundamentally different error accretion behaviors, suggesting that more granular task decomposition and controlled ablation studies are necessary.

Limitations

All tasks use synthetic graphs limited in size and structural diversity, and weight assignments are deterministic and integer-valued. Evaluation is strictly within-distribution. The constraint-validity check is intentionally weak and not normalized across algorithms. The focus on exact canonical solutions may overlook the practical acceptability of alternative, non-canonical outputs.

Future Directions and Impact

The experimental paradigm serves as a blueprint for rigorous closed-loop evaluation of neural algorithmic policies and broader agentic systems. Future work should extend to out-of-distribution and larger-scale graphs, compare different adaptation mechanisms, systematically probe the influence of state/action representations, and develop more nuanced criteria for semantic solution equivalence.

The implications extend beyond graph algorithms to AI agents, sequential planners, and tool-use systems—any setting where an agent’s predictions recursively define future observations. Robust operational reliability in these systems requires evaluations that genuinely stress the model’s ability to maintain invariant correctness under its own distributional drift, rather than isolated next-action competence.

Conclusion

This study provides evidence that small LLMs, when parameter-efficiently adapted, are effective closed-loop agents for locally structured algorithms like traversals and coloring but remain fragile on globally coupled, numerically intensive graph algorithms. A high degree of next-action accuracy does not guarantee reliable execution over entire trajectories. The work underscores the necessity of end-to-end closed-loop rollout evaluation for neural agents acting in procedural or programmatic domains and charts a path for future methodological and architectural advances in algorithmic reasoning with SLMs.

Reference: "Closed-Loop Graph Algorithm Execution with Small LLMs: Step Accuracy and Rollout Reliability" (2606.24980)

Paper to Video (Beta)

No one has generated a video about this paper yet.

Whiteboard

No one has generated a whiteboard explanation for this paper yet.

Open Problems

We haven't generated a list of open problems mentioned in this paper yet.

Collections

Sign up for free to add this paper to one or more collections.

Tweets

Sign up for free to view the 1 tweet with 15 likes about this paper.