Database as Runtime

Compiling LLMs to SQL for In-database Model Serving

Conference Paper (2025)
Author(s)

Wenbo Sun (TU Delft - Web Information Systems)

Ziyu Li (TU Delft - Web Information Systems)

Rihan Hai (TU Delft - Web Information Systems)

Research Group
Web Information Systems
DOI related publication
https://doi.org/10.1145/3722212.3725093
More Info
expand_more
Publication Year
2025
Language
English
Research Group
Web Information Systems
Pages (from-to)
231-234
Publisher
ACM
ISBN (electronic)
9798400715648
Reuse Rights

Other than for strictly personal use, it is not permitted to download, forward or distribute the text or part of it, without the consent of the author(s) and/or copyright holder(s), unless the work is under an open content license such as Creative Commons.

Abstract

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.