Reliability of Shortest-Path Reasoning in Large Language Models, and How to Verify It
A fluent answer on path planning, scheduling, or cost optimization is not the same as a mathematically valid one. This article explains why LLMs mix up feasibility, cost, and optimality, how to model constrained path problems as explicit states, and how to split generation, solving, and independent verification so production systems can recompute and audit every claim.
A fluent answer on path planning, resource scheduling, or cost optimization is not the same as a mathematically valid one. A model may restate constraints accurately and produce a coherent calculation, yet still miss a legal path, wrongly declare the problem unsolvable, or treat a feasible route as the lowest-cost route.
A small set of run logs is worth noting. Two baseline models were run twelve times in total; five of those runs concluded that the task was “impossible.” In four of those five answers the reported minimum cost was wrong. In the remaining case the cost figure was correct, but the model explicitly said it had not verified that the path was shortest.
The logs lack the full problem statement, gold answers, run configuration, and scoring rules. They cannot support a general accuracy claim, and they do not prove that every “impossible” verdict was correct. It is also unclear whether “impossible” meant that no legal path exists at all, or that the task cannot be completed under a budget or other limit.
The logs still surface an engineering issue: feasibility, cost, and a proof of optimality are three different tasks. A reliable system must check each of them. Fluency of the final answer is not evidence of correctness.
What must actually be proved
Path optimization is usually a graph: nodes are locations or states, edges are allowed transitions, and weights are time, money, distance, or another cost.
Business tasks are often more than “start to goal.” They may require visiting specified nodes, limiting the number of transitions, meeting time windows, or staying under a resource threshold. Before solving, the required conclusions should be stated clearly.
1. Does a path exist?
Feasibility asks whether at least one path satisfies every constraint. A single legal path proves solvability. A claim of unsolvability must show that no legal candidate reaches the goal.
These proofs are asymmetric. Finding a path is existence evidence. Not finding a path is not a proof of non-existence. Incomplete search, missed states, or early termination can produce a false “no solution.”
2. Is the given path legal?
The node sequence must be checked step by step: edges exist, directions are valid, visit order matches the requirements, and resource limits are not violated.
A coherent-looking path is not a substitute for itemized checks. When an action must be completed before a region can be entered, the same location is not the same state.
3. What is the path cost?
Billing rules must be explicit: cost per edge vs. once per node, fixed fees, extra cost for revisits. Without a formal cost model, the same path can yield different totals. Use structured rules; do not let the model fill in unspecified charging logic from prose.
4. Is the cost minimal?
The cost of a legal path is only an upper bound on the optimum. Optimality requires showing that no cheaper legal path exists.
Systems should distinguish “a feasible solution was found,” “this is the lowest cost seen so far,” and “global optimality has been proved.” Those statuses must not be mixed.
Why models confuse these conclusions
LLMs are useful for explaining problems, extracting conditions, and organizing reasoning. Natural-language reasoning does not automatically provide complete search or rigorous proof.
Path problems suffer combinatorial explosion. As nodes, branches, and constraints grow, the number of candidates grows quickly. Listing several plausible routes does not imply full coverage.
Local choices can impersonate a global optimum. Taking the cheapest next edge can make the rest of the route expensive or can violate required visits or resource limits. Locally cheapest is not globally cheapest.
Constraints interact. An edge may be legal in isolation but forbidden after resources are spent or a required visit is skipped. Using only the current location as state drops information that later decisions need.
Models may stop after finding a candidate. A correct cost calculation means only that one arithmetic step did not fail; it does not mean the search was complete. Even a lucky hit on the optimum is not a stable distinction between solving and guessing if there is no checkable proof.
Remove linguistic ambiguity with state models
Reliable solving starts by turning the task into an explicit, executable state model—not by asking the model to write longer chain-of-thought.
For ordinary path problems, state may be only the current node. With extra constraints, state may need:
current position, completed required actions, key nodes visited, remaining resources, current time.
Which fields to keep follows from the transition rules. If two states share a location but allow different future actions, they must not be merged.
Example: a task requires a supply visit before the goal. “At node A, not yet resupplied” and “at node A, already resupplied” are different states. Treating them as one node can prune incorrectly or misjudge reachability.
After modeling, define:
- Initial state: starting conditions
- Goal condition: what counts as done, not merely arriving at a place
- Legal transitions: preconditions for each step
- Cost function: how each step adds to cumulative cost
- Termination: when search may stop and report a conclusion
The model can help extract these fields; critical fields still need rule checks or human confirmation so omissions in the original text do not become hidden assumptions.
Choose solvers that match the problem
Different path problems need different algorithms. One search style should not be applied to every task.
If all edges have equal cost and the goal is fewest transitions, layered BFS on a properly modeled state graph can find a minimum-hop solution.
If all weights are nonnegative, expand states in order of increasing cumulative cost (shortest-path algorithms of that family). Under the usual conditions, when a goal state is extracted and finalized at minimum cumulative cost, that cost is optimal.
Negative weights invalidate conclusions that assume nonnegative weights. Negative cycles must be checked: a negative cycle can drive the objective unbounded only if it is reachable from the start and the goal is reachable from it.
For complex constraints, consider state expansion, dynamic programming, branch-and-bound, or constraint optimization. Choose by structure, scale, and proof needs—not by which method the model “knows.”
Watch how resources are represented. Naive discretization of continuous resources can change feasibility and optimality. If approximation is required, state error sources and limits; do not label an approximate result as a strict optimum.
Treat the model as a constrained collaborator, not the final judge
A safer architecture splits understanding, solving, and verification.
- The model converts natural-language requirements into a structured description and flags ambiguous constraints (for example, whether “as cheap as possible” means strict minimization, and whether “no repeats” applies to nodes or edges).
- Validate the structured input: weight types, node references, conflicting constraints, missing fields.
- Run a matching algorithm; output a path, cumulative cost, and solver status.
- An independent checker re-validates legality and cost. It must not trust the model’s intermediate arithmetic.
- The model explains verified results, the conditions under which they hold, and remaining uncertainty.
Pipeline:
requirements → structured model → input and constraint checks → solve → independent result check → explanation
“Independent” is not another call to the same model. Re-reading its own answer can repeat the same assumptions and omissions. Use a check mechanism different from answer generation.
Make results a verifiable contract
Production systems should not return only a prose conclusion. Each result type needs matching evidence.
- Feasible solutions: full state path and a legality basis for each transition
- Cost values: line items and totals so a checker can recompute
- Optimal solutions: solver optimality status and applicable assumptions; if the algorithm reports bounds, check that they meet the required proof or error criteria
- Unsolvability: complete infeasibility vs. no solution found under limited search. Timeout, memory exhaustion, bad input, and mathematical unsolvability must be labeled separately
Unknown is not unsolvable. Feasible is not optimal. Approximate is not exact.
If search stops after a budget and a path of some cost was found, report a current feasible solution. Do not call it the lowest-cost route because later search never finished.
Evaluate in layers, not a single score
The run fragment is a reminder not to collapse different error types into one total.
A more diagnostic evaluation records:
- correctness of the feasibility judgment
- whether the output path meets all constraints
- whether cost matches the path
- whether optimality was actually reached
- whether claimed optimality has valid support
- whether resource exhaustion is reported as uncertainty rather than a false hard answer
Test sets should cover reachable and unreachable instances, multiple equal-cost paths, locally cheap but globally expensive routes, required detours, and cases where negative weights or resource limits break algorithm assumptions.
For small instances, exhaustive or independent exact methods can provide gold answers. For larger ones, keep feasibility evidence, solver logs, and optimality bounds. Across repeated runs, record inputs, sampling settings, resource limits, and scoring rules so differences can be attributed to model variance vs. pipeline change.
Twelve runs can expose issues; they cannot support broad capability claims. Evaluation reports should keep that boundary.
Principles for production use
A wrong “unsolvable” call can cause a business to drop a workable plan. A wrong “minimum cost” can distort budgets and waste resources.
Assign clear roles: the model for understanding, candidate generation, and explanation; the solver for algorithms; the checker for confirmation; business rules for which conclusions may be applied automatically.
For high-risk tasks, only results that meet preset verification standards should enter automatic execution. If optimality is unproved, report the current solution and its limits instead of hiding an evidence gap behind certain language.
Reliable intelligent optimization is not a more persuasive number from a model. It is every key conclusion being recomputable, recheckable, and traceable. Separate “finding an answer” from “proving the answer,” and path-planning systems can move from plausible reasoning to verifiable engineering results.
