Database as Runtime: Compiling LLMs to SQL for In-database Model Serving
Deploying large language models (LLMs) often requires specialized hardware and complex frameworks, creating barriers for CPU-based environments with resource constraints. These systems, common in air-gapped or edge scenarios, lack support for maintenance due to security, budget, or technical limits. To address this, we introduce TranSQL+, a compiler that translates LLM inference into SQL queries, enabling deployment on relational databases. By converting transformer operations into relational algebra, TranSQL+ generates vector-oriented SQL queries that leverage native database features (buffer management, indexing) to manage computations without hardware accelerators or deep learning frameworks. Demonstrated with the LLaMA3.1 8B model on DuckDB, results show relational databases can effectively serve LLMs, reducing deployment barriers and expanding access to advanced AI.
Authors
- Rihan Hai (ORCID: https://orcid.org/0000-0002-3720-6585)
- Ziyu Li (ORCID: https://orcid.org/0000-0001-9403-572X)
- Wenbo Sun (ORCID: https://orcid.org/0009-0004-7849-7771)
Institutions
- Delft University of Technology (NL)
Publication Details
- Published
- 2025-06-17
- DOI
- https://doi.org/10.1145/3722212.3725093
- Primary Topic
- Advanced Database Systems and Queries
- Type
- article
- Field-Weighted Citation Impact
- 0.00