Prompt as a Data Type: In-Database LLM Prompt Management and Rewriting
Not on the map. Why?
Abstract (arXiv)
Large Language Models (LLMs) are increasingly used in database-backed applications to classify tuples, filter records using semantic predicates, extract structured attributes, and enrich query results. Yet the prompt that start these computations are typically stored outside the DBMS in unstructured formats, making them invisible to query execution, metadata management, and optimization. Drawing on Stonebraker's QUEL as a Data Type and the principles of reflective programming, this paper introduces PromptDB, a database system that treats prompts as tuple-level database values. PromptDB provides a logical PROMPT datatype whose values store a template, bindings to tuple attributes, model metadata, and task metadata. Relations may contain PROMPT attributes directly in base tables, or expose them through views over joined tuples. Users query prompt-valued attributes through generated evaluation views, while the system internally renders, rewrites, optimizes, and executes prompts through an EVAL operator. Making prompts database-visible creates a new optimization space. The key idea is to bring query-optimizer thinking to prompts: just as query optimizers exploit database metadata to rewrite SQL plans, PromptDB exploits database metadata to rewrite prompts. We evaluate PromptDB on synthetic and real-world data workloads across different tasks. The results show how database-guided rewriting improves output validity and yields favorable cost-quality trade-offs compared with static, manually written prompts.
Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 5 of its 12 references that are in the map. First posted on arXiv 23 Jul 2026.
Builds on
5 of 12 references.
References · 5
- 2021What Makes Good In-Context Examples for GPT-3?cited by 1,195
- 2021OpenPrompt: An Open-source Framework for Prompt-learningcited by 148
- 2023Language Models Enable Simple Systems for Generating Structured Views of Heterogeneous Data Lakescited by 111
- 2025JSONSchemaBench: A Rigorous Benchmark of Structured Outputs for Language Modelscited by 71
- 2025Making Prompts First-Class Citizens for Adaptive LLM Pipelinescited by 3
Built on by
Not cited yet.