Code methods improve accuracy and cut costs for AI outputs
COVE: A Task-Adaptive, Code-Based Ensemble for Proactive Verification of LLM Outputs
Software Engineering
Summary
Large language models often make believable but incorrect or mixed-up responses, causing problems in work settings. The authors created COVE, a system that uses computer code to stop mistakes before they happen and check answers afterwards without extra expensive AI calls. Tested on many text and image examples, COVE greatly improved correctness and used much less computing effort. This approach shows how simple code can make AI answers more reliable and cheaper to produce.
What this means in practice
- •For enterprise software engineers: Integrate code-based checks to improve AI output reliability and lower verification costs in business applications.
- •For automation platform developers: Build systems that prevent false AI-generated content proactively, boosting trust for automation tools handling text and images.
Authors
Anjaney Shrivastava, Dharmala Hrudai Aditya
Abstract
Large Language Models (LLMs) are now embedded in enterprise workflows, yet their outputs remain prone to hallucinations: plausible-sounding but factually incorrect or malformed content. Most verification approaches are reactive, detecting errors only after generation and often spending additional expensive LLM calls to do so. We present COVE, a task-adaptive, code-based ensemble that takes the opposite stance: it prevents errors before generation and validates structure and consistency afterwards using six deterministic, pure-Python innovations that add no extra LLM calls. On an internal evaluation spanning 11 text datasets (1,020 examples) and 4 image datasets (200 examples), COVE lifts text accuracy from a 45.2% unverified baseline to 82.1% (an 81.7% relative improvement), improves image accuracy by 69.5%, and reduces token usage by 48 to 96% (simulated cost model), at a measured verification overhead of 0.26 ms per output (excluding the LLM call). This article describes the engineering design of each innovation (with pseudocode and the exact parameters we use), the measured impact, an ablation of every component, and the practical lessons learned from deploying code-based verification in enterprise pipelines.