AI
New System Converts Plain Language to Database Queries 27× Faster, at Penny-Per-Question Cost
Researchers release SPARQL-LLM, an open-source tool that translates natural language into structured database queries with superior speed and affordability for real-world knowledge graphs.
A team of computer scientists has developed SPARQL-LLM, a production-ready system that transforms everyday language questions into SPARQL queries—the formal language used to search and retrieve data from knowledge graphs. The breakthrough addresses a longstanding gap in large language model research: while prior work emphasizes accuracy, SPARQL-LLM prioritizes speed, cost, and practical deployment.
The Problem with Previous Approaches#
Existing LLM-based systems for converting natural language to structured queries typically excel at accuracy metrics but fall short in real-world scenarios. They often consume significant computational resources, incur high inference costs, and run too slowly for interactive applications. This gap has left most techniques lab-bound rather than production-ready.
How SPARQL-LLM Works#
The system comprises three core components working in concert:
- Metadata indexing: Lightweight reference data that helps the model understand the structure of a knowledge graph
- Prompt building: Intelligent composition of instructions that guide the LLM toward correct queries
- Query generation and execution: Direct translation and immediate testing against the target database
By leveraging minimal metadata overhead and efficient prompt engineering, the system avoids the computational bloat that hobbles competing approaches.
Benchmarked Against Real-World Standards#
Testing across a multilingual challenge dataset and questions drawn from three major bioinformatics knowledge graphs reveals compelling results:
- 59% improvement in F1 score over the second-best competing system
- 27× faster query generation than the runner-up
- Costs no more than $0.01 per question, enabling cost-effective scaling
- Multilingual capability across English, Spanish, and German
- Complex query support for intricate bioinformatics searches

