Abstract
Agentic workflows, which chain multiple LLM calls and tool invocations, are increasingly used for complex AI tasks. However, these workflows are highly susceptible to cascading errors where early hallucinations amplify downstream. While verification methods exist, applying them ubiquitously is prohibitively expensive and slow. This paper presents Sherlock, a serving framework that optimizes reliability and efficiency by intelligently placing cost-effective verifiers at vulnerable nodes and utilizing speculative execution to mask verification latency. Sherlock achieves an 18.3% average accuracy improvement while reducing execution time by up to 48.7%.
Introduction
The shift toward "agentic workflows"—structured graphs of LLM reasoning and tool use—has enabled AI to tackle sophisticated problems. Yet, the reliability of these systems remains a major hurdle. A single logical error or hallucination in an early step can propagate through the workflow, rendering the final output useless.
Current solutions often involve "verifiers" (e.g., self-reflection or multi-agent debate), but these introduce a significant "verification tax." Verifying every node can increase latency and cost by orders of magnitude. Conversely, verifying only the final output often fails to catch errors that have already corrupted the context. Sherlock addresses this by answering three critical questions: where to verify, which verifier to use, and how to execute verification without stalling the pipeline.
The Sherlock Framework
Sherlock employs a three-pronged strategy to balance reliability, cost, and speed during the execution of agentic workflows.
1. Vulnerability-Guided Verifier Placement
Not all nodes in a workflow are equally critical. Sherlock uses counterfactual fault injection during an onboarding phase to identify "vulnerable" nodes. By simulating errors and observing their propagation, the system develops a topology-aware policy. It prioritizes terminal nodes (where errors are final), initial nodes (where errors propagate furthest), and high "fan-in" nodes (which aggregate multiple potentially erroneous inputs).
2. Cost-Optimal Verifier Selection
The effectiveness of a verifier is highly task-dependent; a simple self-consistency check may outperform a complex multi-agent debate for certain prompts. Sherlock uses a lightweight selector model, trained via Group Relative Policy Optimization (GRPO), to predict the most cost-effective verifier for a given task. This allows the system to hit the Pareto frontier of accuracy versus computational cost.
3. Speculative Execution Runtime
To eliminate the latency penalty of verification, Sherlock introduces a speculative execution model. When a node completes, its downstream children begin executing immediately while the verifier runs in the background. If the verifier approves the output, the speculative work is committed. If a revision is needed, Sherlock uses fast similarity metrics (like ROUGE-L) to determine if the change is semantically significant. Only significant changes trigger a rollback and re-execution, minimizing wasted computation.
Key Results
Evaluation across benchmarks like CoTCollection, OMEGA, and LiveCodeBench demonstrates Sherlock's effectiveness.
- Accuracy: Sherlock provides an 18.3% average accuracy gain over non-verified baselines.
- Latency: Speculative execution reduces end-to-end latency by up to 48.7% compared to blocking verification. In coding tasks, the reduction reached 63%.
- Cost Efficiency: Sherlock reduces verification costs by 26.0% compared to state-of-the-art workflow generators like AFlow, while maintaining superior accuracy.
Discussion and Limitations
A key insight from the study is that 60–80% of verifier revisions are semantically identical to the original output, justifying the speculative approach. However, a limitation exists in the rollback mechanism for structured domains. While ROUGE-L works well for natural language, it fails to capture semantic equivalence in math and code. In these domains, Sherlock must conservatively default to full rollbacks, suggesting that future work should focus on developing fast, domain-specific semantic similarity metrics.
Summary updated