DataKernelBench: Can LLMs Optimize Database Queries on GPUs?

Gokul Karthik Kumar, Yotam Perlitz, Corey Lammie, Andrea Giovannini, Katja Hose


Abstract
GPUs increasingly accelerate database systems, but query-specific peak performance still often relies on hand-written kernels. Existing LLM kernel benchmarks focus on machine learning operators, leaving irregular, heterogeneous, data-movement-heavy database-style operators untested. We introduce **DataKernelBench**, which translates SQL into validated PyTorch **TorchPlan** programs and evaluates LLMs that optimize either the core tensor-bounded snippet or the full query in CUDA or Triton through execution-guided repair. Across ten proprietary and open-weight models on **TPC-H SF10** with an H100 GPU, the strongest full-query CUDA configuration achieves **2.11× speedup over ‘torch.compile‘** at full pass rate. We find that higher-performing implementations commonly use kernel fusion and execution-strategy changes, stronger models benefit most from full-query specialization, and workload context matters more than hardware context. To handle data larger than GPU memory, we extend TorchPlan with Dask-cuDF for on-demand partition loading on **TPC-H SF100** with four H100 GPUs, achieving **2.54×** speedup.

**Project page:** https://kerneldf.github.io/datakernelbench
Anthology ID:
2026.findings-emnlp.436
Volume:
Findings of the Association for Computational Linguistics: EMNLP 2026
Month:
October
Year:
2026
Address:
Budapest, Hungary
Editors:
Hung-Yi Lee, Sunipa Dev, Jessy Li, Desmond Elliott
Venue:
Findings
SIG:
SIGDAT
Publisher:
Association for Computational Linguistics
Note:
Pages:
9153–9168
Language:
URL:
https://aclanthology.org/2026.findings-emnlp.436/
DOI:
Bibkey:
Cite (ACL):
Gokul Karthik Kumar, Yotam Perlitz, Corey Lammie, Andrea Giovannini, and Katja Hose. 2026. DataKernelBench: Can LLMs Optimize Database Queries on GPUs?. In Findings of the Association for Computational Linguistics: EMNLP 2026, pages 9153–9168, Budapest, Hungary. Association for Computational Linguistics.
Cite (Informal):
DataKernelBench: Can LLMs Optimize Database Queries on GPUs? (Kumar et al., Findings 2026)
Copy Citation:
PDF:
https://aclanthology.org/2026.findings-emnlp.436.pdf