Llm.sql
Run a 640MB LLM on SQLite, with 210MB peak RSS and 7.4 tok/s
Get picks like this daily. Today's launch numbers, the top launches, AI and tech news, and a daily opportunity pick, straight to your inbox.
Want to reach these readers? Sponsor an issue.
Hi HN,I built llm.sql, an LLM inference framework that reimagines the LLM execution pipeline as a series of structured SQL queries atop SQLite.The motivation: Edge LLMs are getting better, but hardware remains a bottleneck, especially RAM (size and bandwidth).When available memory is less than the model size and KV cache, the OS incurs page faults and swaps pages using LRU-like strategies, resulting in throughput degradation that's hard to notice and even harder to debug. In fact, the memory access pattern during LLM inference is deterministic - we know exactly which weights are needed and when. This means even Bélády's optimal page replacement algorithm is applicable here.So instead of letting the OS manage memory, llm.sql takes over:- Model parameters are stored in SQLite BLOB tables- Computational logic is implemented as SQLite C extensions- Memory management is handled explicitly, not by the OS- Zero heavy dependencies. No PyTorch, no Transformers. Just Python, C, or C++This gives us explicit, deterministic control over what's in memory at each step of inference.Results:Running Qwen2.5-0.5B-INT8 (~640MB model) with a peak RSS ~210MB and 7.40 tokens/s throughput.Alpha version is available on GitHub: https://github.com/xuxianghong12/llm.sqlI'm the developer, happy to answer any technical questions about the design and implementation.
HN · launched Apr 24, 2026 · 8 upvotes (top 52%) · 1 view
Niche: llm inference engines · 133 launches, 4 in the last 7 days ▼ -33% · Explore this niche →
Category and tags
- Horizontal
- Model & infra
- Developer
- AI-native
- Hobby / open-source project
More like this: all 133 launches in llm inference engines →
Could you build this?
No Writing an LLM inference engine where transformer forward-pass tensor operations and matrix multiplications are reimagined as native SQL queries inside SQLite requires deep systems and deep learning runtime engineering.
What it would actually take: The core engine requires custom SQLite C extensions or virtual tables with deeply optimized BLAS/vectorized kernels (SIMD, AVX/NEON) to perform matrix math, KV-caching, and layer-by-layer attention inside SQLite query plans. The hard parts are memory-mapping model weights in low RAM footprints (210MB RSS), avoiding intermediate buffer allocations across relational operations, and achieving non-trivial token speeds (7+ tok/s). This demands elite expertise in database internals, systems programming (C/Rust), and low-level ML compiler/runtime architecture.
Discussion
2 comments analyzed.
Concerns raised: Project still in alpha, validation phase ongoing, Uncertain if suitable for Raspberry Pi despite theoretical possibility
Feature requests: Benchmark across different hardware platforms, Test and optimize for edge devices like Raspberry Pi
Competitors
Other products that read as similar to this one : 449 launches clear the similarity bar, closest 8 shown.
Attention rank: #240 of 450 (itself plus its competitors, highest first, normalized so YC and Product Hunt are compared fairly).
Launched 177 days after the earliest competitor.
- A local-first memory store for LLM agents (SQLite) · hn · 2025-12-14 · 48 upvotes · similarity 0.56
- Long term Memory and 50M token window for LLM · hn · 2026-10-09 · 6 upvotes · similarity 0.53
- Run 500B+ Parameter LLMs Locally on a Mac Mini · hn · 2026-03-09 · 17 upvotes · similarity 0.52
- A Wasm to Go Translator · hn · 2026-02-26 · 7 upvotes · similarity 0.51
- Rekal · hn · 2026-04-12 · 9 upvotes · similarity 0.51
- Mnemo · hn · 2026-06-03 · 60 upvotes · similarity 0.50
- ZSE · hn · 2026-02-26 · 58 upvotes · similarity 0.50
- Misata · hn · 2025-12-16 · 24 upvotes · similarity 0.50
The niche, labels, vibe code rating and competitor comparison on this page are analysis by Nicheloom. If you use them, please credit nicheloom.com. How you may use our data.