Preprint
Machine Learning

DataGemma

September 1, 2024

0

Citations

0

Influential Citations

Venue

2024

Year

Abstract

A set of models that aims to reduce hallucinations in LLMs by grounding them in the factual data of Google's Data Commons, allowing users to ask questions in natural language and receive responses based on verified information from trusted sources.

Analysis

Why This Paper Matters

Large language models (LLMs) have revolutionized natural language processing, but their tendency to generate plausible-sounding but factually incorrect information—hallucinations—remains a critical barrier to deployment in high-stakes domains like public policy, healthcare, and economics. DataGemma tackles this head-on by anchoring LLM outputs in the verified statistical data of Google's Data Commons, a massive open-source repository containing over 250 billion data points from trusted sources such as the United Nations, CDC, and global census bureaus. By teaching LLMs not just to generate answers but to know when and how to query external data, this work moves beyond pure parametric knowledge toward a more reliable, hybrid reasoning paradigm.

How It Works

Figure 1

DataGemma introduces two complementary approaches for interfacing LLMs with Data Commons: Retrieval Interleaved Generation (RIG) and Retrieval Augmented Generation (RAG). Both methods address three core challenges: teaching the LLM when to ask an external source, deciding which source to query, and generating appropriate queries without requiring knowledge of specific APIs.

Retrieval Interleaved Generation (RIG)

Comparison of Baseline, RIG, and RAG approaches.

In RIG, the LLM is fine-tuned to produce natural language Data Commons queries alongside its statistical answers. A multi-model pipeline then converts these natural language queries into structured data queries. The key insight is that natural language queries are shorter and easier for LLMs to generate than structured queries like SQL, and they avoid the need to hard-code variable IDs. The pipeline breaks down each query into three components: statistical variables or topics (e.g., "unemployment rate"), places (e.g., "California"), and attributes (e.g., "ranking"). Different NLP techniques handle each component: embedding-based semantic search for variables, string-based named entity recognition for places, and regex-based heuristics for attributes. The query is then classified into a predefined template and fulfilled against Data Commons' structured data API.

Figure 4

Retrieval Augmented Generation (RAG)

Comparison of Baseline and RAG approaches.

RAG takes a more traditional retrieval approach. A small, fine-tuned LLM (Gemma 2 9B IT or 27B IT) first translates the user's query into Data Commons natural language queries. These queries are then converted to structured queries using the same pipeline as RIG, and the resulting data tables are retrieved. Finally, a long-context LLM (Gemini 1.5 Pro) is prompted with both the original query and the retrieved tables to generate a grounded response. This approach separates the retrieval and generation steps, allowing each to be optimized independently.

Results

Figure 6

The RIG approach dramatically improved factual accuracy on statistical queries, jumping from a baseline of 5-17% to approximately 58%. However, 33-27% of statistics remained inaccurate, primarily due to precision issues with the Data Commons natural language interface or irrelevant LLM-generated queries. Data coverage was a significant bottleneck: only 23-24% of LLM-generated questions elicited responses from Data Commons, with the majority of failures attributed to missing datasets.

Figure 9

For RAG, the LLM achieved 99% accuracy when citing numeric values directly from Data Commons, but accuracy dropped to 80-94% when drawing inferences from those values. Coverage was similarly limited at 24-29%. Despite these limitations, the RAG approach consistently outperformed the base Gemini 1.5 Pro model, demonstrating that providing relevant data enhances the LLM's ability to make specific statistical claims.

Significance

DataGemma represents a practical step toward trustworthy AI systems that can reason with facts rather than just generating plausible text. By open-sourcing the models and providing a general architecture for bridging LLMs with structured data, Google has given the research community a foundation to build upon. The work highlights that while grounding in external data significantly reduces hallucinations, it also exposes the challenge of data coverage—no repository can contain all the world's knowledge. Future work will likely focus on expanding Data Commons' coverage, improving the precision of natural language to structured query conversion, and developing methods that allow LLMs to gracefully handle cases where data is unavailable. For AI practitioners, DataGemma offers a blueprint for building more reliable systems in domains where factual accuracy is non-negotiable.