Improving Databricks Genie Answer Accuracy Through Semantic Modeling and Evaluation

Michał Adamczyk
Michał Adamczyk
November 26, 2026
•
7 min read
Loading the Elevenlabs Text to Speech AudioNative Player...

When large language models (LLMs) are used on enterprise datasets through natural language interfaces, they promise friction-free self-service analytics. However, without proper guardrails, they frequently struggle. Stripped of business context and domain knowledge, raw LLMs often fall into the trap of hallucination—misinterpreting data schemas, executing flawed multi-table joins, or missing critical domain-specific distinctions.

As established in recent research on schema linking and prompt optimization by Gao et al. (2023) (DAIL-SQL: A Data-Aware Framework for Text-to-SQL Using Large Language Models), zero-shot text-to-SQL models struggle significantly when database schemas lack explicit structural evidence and rich semantic metadata. Furthermore, to reliably measure improvements, teams must move beyond simple syntax checks and adopt semantic execution validation frameworks—such as the test-suite evaluation methodology pioneered by Zhong et al. (2020) (Semantic Evaluation for Text-to-SQL with Distilled Test Suites)—to verify that generated queries return mathematically correct data results.

In this post, we bridge this gap using Databricks AI/BI Genie. Drawing on these foundational principles of schema linking and semantic evaluation, we demonstrate through a hands-on case study of a multi-table e-commerce dataset how semantic modeling in Unity Catalog and evaluation benchmarks transform an unguided AI into a precise, trustworthy data analyst assistant.

Databricks AI/BI Genie

Databricks AI/BI Genie is a no-code, conversational analytics interface that allows business users to query data using natural language. Genie agents provide conversational analytics for selected data sources, enabling rapid answer generation to questions that otherwise require writing queries and oftentimes a long process of iterating, debugging etc.

However, even if the agent gets access to the relevant tables, it doesn’t know all the relationships, business context and hidden data pitfalls.

Test dataset – The Olist Brazilian E-Commerce dataset

The selected dataset is a Brazilian ecommerce public dataset of orders made at Olist Store. The dataset has information of 100k orders from 2016 to 2018 made at multiple marketplaces in Brazil. Its features allow viewing an order from multiple dimensions: from order status, price, payment and freight performance to customer location, product attributes and finally reviews written by customers. Olist also released a geolocation dataset that relates Brazilian zip codes to lat/lng coordinates.

This is real commercial data which has been partially anonymised. It is openly available on Kaggle.

Example of a product listing on the marketplace
Example of a product listing on the marketplace
Data schema. The data is divided into multiple datasets, covering orders, ordered items, customers, payments and sellers.
Data schema. The data is divided into multiple datasets, covering orders, ordered items, customers, payments and sellers.

Examples of traps / missing information in the Data

Below are a few examples of questions that are going to be answered incorrectly or won’t be answered because of missing information, when the agent is simply fed the dataset and asked some analytical questions.

Revenue calculation

The issue: the agent doesn’t know that some of the orders weren’t actually complete.

Let’s start by asking a simple question – what are the top 5 product categories by revenue?

Agent’s response.
Agent’s response.

The nice thing about the genie agent is that we can dive into the actual queries that it’s used to generate the answer. Let’s do that to inspect the thinking process.

The actual query that agent used to calculate top products by revenue.
The actual query that agent used to calculate top products by revenue.

There is a serious problem with this calculation. Let’s ask the agent about the different order statuses observed in data.

Genie agent listing the distinct order statuses found in the Olist orders table

Well, the original query didn’t account for the different statuses. Clearly, some of them shouldn’t be counted as actually sold, for example the canceled or unavailable ones!

The currency

The issue: the agent doesn’t know the actual currency of the orders. It also does not warn you about it!

Recall the answer about the top products, and the presented revenues per top category. They were assumed to be in dollars by the agents and presented as such. The database stores information about the orders in Brazilian reals, which is a completely different currency, so the agent made an incorrect assumption.

Let’s test the model's awareness of this issue when we ask a different currency-related question. First, I’ve asked the model about the customers who spent over 200 dollars.

Genie agent answering which customers spent over 200 dollars, assuming prices are in US dollars

And let’s proceed to ask a similar question, but this time about the customers who spent over 200 euros.

Genie agent answering which customers spent over 200 euros and admitting the currency is unknown

And only now, after a few questions that made the model anxious a bit about the currency, it admitted that it doesn’t know what it actually was.

Unique customers

When examining the customers table, there are two columns that seem to identify customers. It turns out that there is an id that identifies a human (customer unique id) and another one – customer id, which will change from order to order. When analyzing repeated customers, their count should be estimated from customer unique id then.

Columns of the customers table
Columns of the customers table

However, when we ask a question regarding the number of people getting the package, the agent walks straight into the trap – it counts the distinct values over the customer id column which is the incorrect choice.

Agent's thought process when asked about the number of people getting their package during certain date range
Agent's thought process when asked about the number of people getting their package during certain date range

Ways of improving the answer quality

Measure, evaluate, benchmark!

The first necessary step of objectively improving performance of any kind of model is to measure it fairly. Luckily for us, the Databricks interface enables evaluation of genie agents.

The three tabs of any created genie agent. The benchmark tab enables evaluation of the models.
The three tabs of any created genie agent. The benchmark tab enables evaluation of the models.

Let’s say that we’d like to first measure all the issues discussed above. For each of them we’ll need to add a test by clicking “+ Add benchmark”. Then, we’ll provide a question along with an evaluation note which will instruct the agent on what the expected answer is. It doesn’t have to be a specific number or a detailed phrase which is perfect for our purposes – we'd like to test specific aspects of the answers in some of the cases.

Four questions (test cases) specified for our agents along with the evaluation notes for the agent to run during evaluation.
Four questions (test cases) specified for our agents along with the evaluation notes for the agent to run during evaluation.

Another way of calibrating the models is to provide ground truth SQL, which will tell the agent specifically what query should be used to get the correct answer.

Triggering full evaluation (“Run all benchmarks”) quickly measures the problem – the agent was correct 0/4 times. We’ve measured the problem. Now is the time to fix it.

Provide context by comments in the data source

The first weapon to improve the agent’s performance is enhancing the data sources by providing comments with extra context. It seems like a perfect way of adding an additional, crucial piece of information that the raw table is lacking initially.

Let’s add the currency info to all the columns that carry prices. It is as simple as going into Catalog -> your table -> Overview tab, and simply adding “Comment” to the columns.

Order items with the comments that specify the currency of prices.
Order items with the comments that specify the currency of prices.

And now, let’s re-run the evaluation test case for the question about currency of prices.

Improved answer now directly quotes the schema description of the price-related columns.
Improved answer now directly quotes the schema description of the price-related columns.

Now the test cases directly related to currency pass, correctly taking Brazilian reals as the currency.

General instructions for the agent

General, initial instructions can be specified to provide initial necessary context for the agent.

You can access the instructions by going into “Configure” tab of the agent, and “Instructions” section. Let’s now tell the agent two important things to fix the abovementioned problems:

  1. Mention the order status and the fact that to calculate revenues, by default, only the delivered orders should be taken into account
  2. Define customer unique id as the default field to analyze people
Simple general instructions, aligning the agent with our definitions of some of the metrics.
Simple general instructions, aligning the agent with our definitions of some of the metrics.

After providing these instructions on top of the extra column comments, all the previously raised concerns have been fixed, and the test set is correct in 100% cases.

Final evaluation, with all the test cases marked as ‘good’.
Final evaluation, with all the test cases marked as ‘good’.

Ground truth SQL answer

One more option available is to provide a ground truth SQL statement that correctly answers a benchmark question. Such a statement will be executed, and the answer will be compared to the output of the genie agent. If the precise query is not provided, then the manual instruction will be executed.

Summary

Natural language interfaces like Databricks AI/BI Genie offer immense potential for democratizing analytics, but raw large language models cannot bridge the gap of missing domain context on their own. Without explicit guidance, LLMs succumb to schema misinterpretation, incorrect metric aggregations, and unstated domain assumptions. By anchoring our approach in proven text-to-SQL research—specifically schema linking and semantic evaluation—we demonstrated how to transform AI/BI Genie into a reliable data analyst assistant:

  1. Establish a Semantic Evaluation Baseline - Build benchmark suites with targeted evaluation criteria and ground-truth SQL to objectively score accuracy before making adjustments.
  2. Enrich Metadata at the Source - Use Unity Catalog data source context to embed core domain facts directly into the data layer.
  3. Set Governance Rules via Instructions - Provide clear global guidelines for business definitions, default metric logic (e.g., filtering for completed order statuses), and primary entity keys (e.g., unique customer identifiers vs. order IDs).

Combining strong semantic modeling in Unity Catalog with systematic benchmark evaluation allows data teams to confidently deploy AI/BI Genie, turning natural language queries into accurate, trustworthy business insights.

If you are preparing Unity Catalog for Genie, read our follow-ups on what to fix in Unity Catalog for Genie Ontology and on building a Databricks semantic layer with metric views. Need help making Genie answers trustworthy on your own data? Talk to our team.

Sources

  1. Gao et al. (2023) - DAIL-SQL: A Data-Aware Framework for Text-to-SQL Using Large Language Models
  2. Zhong et al. (2020) - Semantic Evaluation for Text-to-SQL with Distilled Test Suites
  3. Kaggle - Brazilian E-Commerce Public Dataset by Olist
  4. Databricks Docs - Test and monitor a Genie agent (benchmarks)
  5. Databricks Docs - Curate an effective Genie agent
Share this post
Data Analysis
Michał Adamczyk
MORE POSTS BY THIS AUTHOR
Michał Adamczyk

Curious how we can support your business?

TALK TO US

More insights

More news

No items found.