Structured Prompt Language: Declarative Context Management for LLMs
Not on the map. Why?
Abstract (arXiv)
We present SPL (Structured Prompt Language), a declarative SQL-inspired language that treats large language models as generative knowledge bases and their context windows as constrained resources. SPL provides explicit WITH BUDGET/LIMIT token management, an automatic query optimizer, EXPLAIN transparency analogous to SQL's EXPLAIN ANALYZE, and native integration of retrieval-augmented generation (RAG) and persistent memory in a single declarative framework. SPL-flow extends SPL into resilient agentic pipelines with a three-tier provider fallback strategy (Ollama -> OpenRouter -> self-healing retry) fully transparent to the .spl script. Five extensions demonstrate the paradigm's breadth: (1) Text2SPL (multilingual NL->SPL translation); (2) Mixture-of-Models (MoM) routing that dispatches each PROMPT to a domain-specialist model at runtime; (3) Logical Chunking, an intelligent strategy for documents exceeding a single context window--expressed naturally through SPL's existing CTE syntax with no new constructs, decomposing a large query into a Map-Reduce pipeline that reduces attention cost from O(N2) to O(N2/k) and runs identically on cloud (parallel) or local hardware (sequential); (4) SPL-flow, a declarative agentic orchestration layer with resilient three-tier provider fallback; and (5) BENCHMARK for parallel multi-model comparison with automatic winner persistence. We provide a formal EBNF grammar, two pip-installable Python packages (spl-llm, spl-flow), and comparison against Prompty, DSPy, and LMQL. SPL reduces prompt boilerplate by 65% on average, surfaces a 68x cost spread across model tiers as a pre-execution signal, and runs the identical .spl script at 0.002 on OpenRouter or at zero marginal cost on a local Ollama instance--without modification.
Key facts. Cited by 1 paper in the map (data through 7 Oct 2026). Builds on 13 of its 30 references that are in the map. First posted on arXiv 23 Feb 2026.
Builds on
13 of 30 references.
References · 13
- 2017Attention Is All You Needcited by 59,932
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,302
- 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,160
- 2017Billion-scale similarity search with GPUscited by 2,477
- 2023AutoGen: Enabling Next-Gen LLM Applications via Multi-Agent Conversationcited by 1,906
- 2018Spider: A Large-Scale Human-Labeled Dataset for Complex and Cross-Domain Semantic Parsing and Text-to-SQL Taskcited by 1,120
- 2023DSPy: Compiling Declarative Language Model Calls into Self-Improving Pipelinescited by 803
- 2026GLM-5: from Vibe Coding to Agentic Engineeringcited by 502
- 2024Token-Budget-Aware LLM Reasoningcited by 242
- 2019SParC: Cross-Domain Semantic Parsing in Contextcited by 141
- 2022Prompting Is Programming: A Query Language for Large Language Modelscited by 110
1 more
Built on by
Citing papers per year: 2026: 1.
1 paper.
Similar, not cited
Close in wording, no citation either way
- 2023How to Prompt LLMs for Text-to-SQL: A Study in Zero-shot, Single-domain, and Cross-domain Settings
- 2024Can Long-Context Language Models Subsume Retrieval, RAG, SQL, and More?
- 2023ACT-SQL: In-Context Learning for Text-to-SQL with Automatically-Generated Chain-of-Thought
- 2025Auto prompt sql: a resource-efficient architecture for text-to-sql translation in constrained environments
- 2024RB-SQL: A Retrieval-based LLM Framework for Text-to-SQL
- 2024PET-SQL: A Prompt-Enhanced Two-Round Refinement of Text-to-SQL with Cross-consistency
- 2025Beyond Quacking: Deep Integration of Language Models and RAG into DuckDB
- 2025DynaQuery: A Self-Adapting Framework for Querying Structured and Multimodal Data