A Simple and Fast Way to Handle Semantic Errors in Transactions
Jinghan Zeng, Eugene Wu, Sanjay Krishnan
TL;DR
The paper tackles semantic errors in LLM-generated database transactions by introducing an invariant-satisfaction middleware that preserves ACID consistency while enabling undo through buffering of suspicious or compensating transactions. It formalizes Invariant Satisfaction (I-Satisfaction) to determine when buffered and new transactions can proceed without coordination, and when coordination is required to maintain database invariants. The authors present a middleware design with dependency registration, a Dependency Matrix, and algorithms for adding and materializing transactions, validated by experiments on a rewritten TPC-C framework. The work offers a practical, minimal-change path for integrating undoable LLM-driven actions into existing systems, with clear tradeoffs between information completeness, user reviews, and buffering strategies. Overall, it provides a robust mechanism to safely leverage LLMs for database operations while guaranteeing consistency and recoverability.
Abstract
Many computer systems are now being redesigned to incorporate LLM-powered agents, enabling natural language input and more flexible operations. This paper focuses on handling database transactions created by large language models (LLMs). Transactions generated by LLMs may include semantic errors, requiring systems to treat them as long-lived. This allows for human review and, if the transaction is incorrect, removal from the database history. Any removal action must ensure the database's consistency (the "C" in ACID principles) is maintained throughout the process. We propose a novel middleware framework based on Invariant Satisfaction (I-Confluence), which ensures consistency by identifying and coordinating dependencies between long-lived transactions and new transactions. This middleware buffers suspicious or compensating transactions to manage coordination states. Using the TPC-C benchmark, we evaluate how transaction generation frequency, user reviews, and invariant completeness impact system performance. For system researchers, this study establishes an interactive paradigm between LLMs and database systems, providing an "undoing" mechanism for handling incorrect operations while guaranteeing database consistency. For system engineers, this paper offers a middleware design that integrates removable LLM-generated transactions into existing systems with minimal modifications.
