TL;DR
Carnot is an interactive execution engine that translates natural language queries over unstructured data lakes into editable, step-by-step notebook pipelines. By blending the structured optimization of traditional database query plans with the flexibility of AI agents, it gives analysts full visibility and fine-grained control over execution paths while optimizing for cost and latency constraints.
What Problem Does This Paper Address?
Organizations increasingly rely on AI-driven systems to extract insights from massive, unstructured data lakes. Currently, this is done via two main paradigms: opaque "Deep Research" AI agents or rigid semantic query processing engines.
However, both approaches present significant friction for data analysts:
- Deep Research Agents operate as black boxes. They autonomously run loops of data retrieval and code generation, but hide intermediate reasoning steps and offer no control over spiraling API costs or latency. Analysts cannot easily verify if an LLM hallucinated an attribute or silently skipped crucial data sources.
- Semantic Query Engines execute structured, SQL-like plans but lack flexibility. If a query is poorly specified or an LLM operator fails halfway through execution, the user only realizes it at the end. To fix it, they must modify the code and pay to re-run the entire pipeline from scratch.
Carnot addresses this lack of visibility (the ability to inspect prompts, code, and intermediate data at every step) and steerability (the ability to intervene and modify the execution path mid-stream without losing prior computational work).
Methods
Carnot introduces an architecture that bridges the gap between database query optimization and agentic workflows, split across a frontend interface and a modular backend library.
- Plan Compilation: When a user submits a natural language query, Carnot’s
QueryPlanner(an LLM agent) first deploys a data discovery subagent to sample the dataset and analyze its schema. It then compiles the request into a Directed Acyclic Graph (DAG) of physical operators, combining semantic operators (like LLM-based filters) with agentic operators (like Python code generation). - Notebook Materialization: The system sorts the DAG topologically and materializes it into an interactive notebook interface. Each cell corresponds to a single physical operator. Users can inspect cells at three levels of abstraction: a natural language summary of intent, the generated code/prompt, or the raw input/output data pairs.
- Cascades-Style Query Optimizer: Inspired by advanced database optimizers, Carnot uses an LLM agent to select a physical plan from an estimated Pareto frontier based on user-defined cost, latency, and quality budgets. For instance, it can dynamically swap an expensive frontier LLM for a smaller, cheaper model if a task requires lower precision.
- Incremental Re-execution: If an analyst spots an error (e.g., a faulty LLM filter prompt), they can edit the notebook cell directly. Carnot’s engine leverages cached upstream data to re-optimize and re-execute only the modified cell and its downstream dependents, saving both time and API costs.
Datasets
The authors demonstrate Carnot using two primary workloads:
- Proprietary Consumer Reviews: A dataset consisting of 1,000 consumer product reviews from an industry partner. To protect proprietary information, real product names were stripped, and an LLM was used to paraphrase the text and titles while strictly preserving the original sentiment and content.
- KramaBench: An academic benchmark designed for evaluating AI systems on data-to-insight pipelines over data lakes. The authors specifically utilize its legal workload.
Key Insights and Ideas
- The Notebook as a Control Plane: Turning an AI agent's internal execution graph into a standard notebook structure successfully demystifies the "black box." It maps complex agent behaviors into a format that engineers and analysts already know how to debug.
- State Preservation Equals Steerability: By caching the inputs and outputs of individual operators, humans can safely intervene during runtime. This transforms the human's role from a passive reviewer of final outputs into an active supervisor who can correct course mid-execution.
- Dual-Layer Feedback Loops: Carnot allows users to steer the system at two different granularities: high-level conversational adjustments via a chat interface (which prompts the
QueryPlannerto re-plan the DAG), or low-level code/prompt adjustments directly inside the notebook cells.
Key Results
As a system demonstration paper, the evaluation focuses on qualitative walkthroughs of real-world analysis scenarios:
- Transparent Plan Inspection: Attendees can verify exactly which data sources a plan targets and review filter criteria before any LLM tokens are spent.
- Conversational Steering: In testing, when a user noticed a filter was only looking at numerical ratings and typed a correction ("Be sure to also consider negative comments in the review text"), Carnot successfully isolated the affected operators and updated the DAG dynamically.
- Cell-Level Editing: The system successfully demonstrated recovery from LLM false negatives. By directly tweaking a prompt inside a notebook cell, the user achieved correct classification without paying to re-run expensive upstream data retrieval steps.
Limitations and Future Work
Currently, Carnot does not provide hard statistical guarantees regarding final plan accuracy or correctness. While the optimizer could theoretically be modified to provide statistical guarantees relative to an oracle, the authors note that the oracle itself can be wrong.
For future iterations, the team plans to expand Carnot's capabilities to include web search (bringing it closer to commercial Deep Research tools) and general tool calling. They also aim to improve the user interface, as standard linear notebooks struggle to cleanly represent highly non-linear, branching DAG structures.
Summary updated