Abstract
GateLens is a novel LLM agent architecture designed to bridge the "reasoning-to-code gap" in complex data analysis for safety-critical industries. By utilizing Relational Algebra (RA) as a formal intermediate representation, GateLens ensures faithful translation of natural language queries into executable code. Evaluated on automotive software release datasets, GateLens achieved 100% accuracy on controlled benchmarks and reduced manual analysis time by over 80%, demonstrating significant improvements in reliability, transparency, and cost-efficiency over traditional Chain-of-Thought methods.
Introduction
In safety-critical industries like automotive manufacturing, "Go/No-Go" decisions for software releases rely on massive tabular datasets containing test results and operational metrics. While Large Language Models (LLMs) are proficient in natural language processing, they often struggle when translating complex analytical reasoning into executable code—a phenomenon known as the reasoning-to-code gap.
Traditional "Chain-of-Thought" (CoT) prompting can be "unfaithful," where the model’s written explanation sounds logical, but the generated code performs a different (and incorrect) operation. Furthermore, existing multi-agent systems are often slow, expensive, and require extensive "few-shot" examples to handle domain-specific jargon and ambiguous queries. GateLens addresses these challenges by introducing a structured, verifiable pipeline for data analysis.
Methods
The GateLens architecture replaces unstructured reasoning with a structured, two-stage pipeline that ensures every step of the analytical process is discrete and reusable.
The Two-Stage Pipeline
- The Query Interpreter (NL to RA): Instead of writing code immediately, the first agent translates a natural language query into Relational Algebra (RA). RA acts as a "Lego-like" formal language (using operations like Select, Project, and Join) that provides a verifiable blueprint for the data analysis.
- The Coder (RA to Python): A second agent takes the formal RA expression and converts it into optimized Python/Pandas code.
Key Innovations
- Formal Intermediate Representation: By forcing the model to think in RA, GateLens ensures that every reasoning step is directly mappable to code, preventing the model from "hallucinating" logic or skipping steps.
- Zero-Shot Operation: GateLens uses a "glossary-enhanced schema" to resolve domain-specific terms without needing prior examples, making it more efficient than systems relying on massive context windows.
- Privacy-First Design: The agents interact only with data schemas and metadata. Sensitive raw test data is processed locally during code execution, ensuring data security.
Evaluation and Results
The researchers evaluated GateLens using two distinct benchmarks: a controlled set of 50 queries across four difficulty levels and a real-world set of 244 unique queries pulled from production logs at Volvo Group.
Key Performance Metrics
- Accuracy: Using GPT-4o, GateLens achieved a 100% F1 score on the controlled benchmark. On the real-world benchmark, it hit an 83.51% F1 score, outperforming the baseline CoT+Self-Consistency system by roughly 13 percentage points.
- Efficiency: GateLens reduced total token consumption by 78% to 81% compared to traditional methods.
- Industrial Impact: In actual deployment, the system reduced the time required for software release analytics by over 80%, allowing analysts to focus on high-level decision-making rather than manual data preparation.
- Robustness: The system was significantly better at handling "imprecise" queries, more than doubling the recall (78% vs 36%) of the baseline system.
Discussion and Conclusion
GateLens demonstrates that RA serves as a powerful "reasoning anchor," preventing the model from conflating multiple operations into opaque thoughts. In industrial settings, where "black-box" code is a liability, the explicit RA plan produced by GateLens provides transparency, making errors much easier to diagnose.
While the system currently relies on well-defined database schemas and shows some sensitivity to model choice (with top-tier models like GPT-4o performing significantly better than open-source alternatives), its success in the automotive sector suggests broad applicability. Future work will explore expanding the architecture to other safety-critical domains like healthcare and finance, as well as supporting "RA-to-SQL" generation for broader database compatibility.
Summary updated