Extending GPU Databases with Semantic Queries over Multimodal Data
Sen & Interlandi in Inference & systems
What if semantic operators ran beside GPU SQL?
Extending GPU Databases with Semantic Queries over Multimodal Data
Semantic SQL splits the database from its AI
Most keep relational execution on the CPU; when a GPU is present, it serves the model rather than the database query.
They accelerate relational queries but, to the authors’ knowledge, lack first-class semantic operators. GSQ targets that gap.
One plan, two semantic paths
- 1
Lower and route
T-SQL lowers to GPU relational operators; a static router picks a proxy by operator, modality and predicate intent, not row values.
- 2
Proxy or server
Off-the-shelf, non-generative single-pass proxies, not smaller LLMs, run in-process on the same GPU; uncovered tasks such as OCR use a served model.
Why short answers hit a serving ceiling

On omni/A100, a tiny-prompt, one-token request reaches a measured prefill ceiling of ~686 inferences/s. A DistilBERT proxy avoids autoregressive decoding and reaches ~6K inferences/s.
The proxy path stays inside the query
- 1
Reuse and prepare
GSQ evaluates each distinct semantic input once; text tokenization, JPEG decoding and audio features run on GPU where supported.
- 2
Return results to SQL
For selected queries, GPU preparation is up to 4.5× faster than CPU prep for the same proxy; cuDF keeps exact relational SQL semantics.
The proxy wins throughput across covered workloads

Bars compare semantic ops/s for omni, phi4 and per-operator proxies. Labels report task-specific scores; the proxy is faster than the faster MLLM on all 80 workloads it can serve.
Quality varies with task fit, especially for ranking
Per-operator accuracy was no more than 10 percentage points below omni on 55 of 68 gold-scored tasks, and phi4 on 64.
The cross-encoder beat phi4 on four of five ranking sets. On HellaSwag’s 200 validation contexts ranking 500 MiniLM candidates, nDCG@10 was 0.418 versus omni’s 0.655.
A direct comparison with semantic-query systems
On 54 SemBench workloads GSQ could serve with proxies, prompts, outputs and joins were matched to GSQ. LOTUS used an embedding cascade for joins; ThalamusDB issued join requests serially.
GSQ was faster on every workload either system ran: median speedup was 118× over LOTUS and 63× over ThalamusDB. Six baseline runs hit 30 minutes, so those ratios are lower bounds.
Cheap inference can expose relational work

Ratios compare GSQ’s GPU path with alternatives. In movie/Q7, the served-MLLM path needs 16,256 inferences and has 0.14% relational time; the proxy path uses 256 DistilBERT inferences and reaches 52.2%, though SQL backend also changes.
Blocking turns semantic joins into candidate reranking
- 1
Embed records
MiniLM handles text pairs; CLIP maps text and images into a shared space for cross-modal joins.
- 2
Keep top-k
GPU cosine similarity retains k right-side candidates per left row, shrinking the full cross product before semantic calls.
- 3
Rerank survivors
AI_FILTER scores only candidates: a 925-row text × 923-image join drops from 853,775 pairs to 9,250, about 92× fewer.
A memory cap contains huge inputs, but slows them

On synthetic images, a 2 GiB budget and downscale-on-decode held total GPU memory to 0.65 GiB from 2K to 24K pixels per side. At 4K, throughput was 2.2 vs 74 semantic ops/s without the budget.
What these results do not establish
Coverage and labels
Five of 85 workloads had no suitable proxy; five more lacked available gold. On four accuracy tasks, proxies trailed both MLLMs by over 10 percentage points.
Join evidence is blocked
Proxies and MLLMs score the same top-k candidates; no full-cross-product MLLM run tests pairs blocking removes.
Scope and budget trade-offs
GSQ uses one A100; warm timings exclude setup and table loads. Tight budgets reduce throughput, and image downscaling or Wav2CLIP windowing can affect fidelity.
Why it matters
- When inference gets cheap, relational execution can become a major query cost.
- Use task-matched, single-pass proxies on the database GPU; keep served models for operators without a suitable proxy.
- Open question: can proxy selection, accuracy targets and join blocking be coordinated to bound answer quality as well as runtime?
1 like 13 slides, 3 min
1 day ago