Skip to main content

Generating Zero-Shot Hard-Case Hallucinations: A Synthetic and Open Data Approach

Summary

  • Synthetic benchmark generation: Present a novel framework for creating fully-synthetic benchmarks by inducing controlled hallucinations in LLM long-form content generation across diverse domains.
  • Data designer architecture: Use Gretel Data Designer to build realistic, high-quality long-context datasets, enabling the creation of complex, nuanced training data for hallucination detection without manual labeling.
  • Automated hard-case mining: Apply chain-of-thought-based generation and consensus labeling to identify zero-shot hard cases—the edge-of-capabilities examples that best represent model limitations.

Generating Zero-Shot Hard-Case Hallucinations: A Synthetic and Open Data Approach

Watch: Generating Zero-Shot Hard-Case Hallucinations: A Synthetic and Open Data Approach
Talk by Eric Tramel, Principal Research Scientist, NVIDIA
We present a novel framework for designing and inducing controlled hallucinations in long-form content generation by LLMs across diverse domains. The purpose is to create fully-synthetic benchmarks and mine hard cases for iterative refinement of zero-shot hallucination detectors. We will first demonstrate how Gretel Data Designer (now part of NVIDIA) can be used to design realistic, high-quality long-context datasets across various domains. Second, we will describe our reasoning-based approach to hard-case mining. Specifically, our methodology relies on chain-of-thought-based generation of both faithful and deceptive question-answer pairs based upon long-context samples. Subsequently, a consensus labeling & detector framework is employed to filter synthetic examples to zero-shot hard cases. The result of this process is a fully-automated system, operating under open data licenses such as Apache-2.0, for the generation of hallucinations at the edge-of-capabilities for a target LLM to detect.
Databricks Named a Leader in the 2025 Gartner® Magic Quadrant™ for Data Science and Machine Learning Platforms: https://www.databricks.com/blog/databricks-named-leader-2025-gartner-magic-quadrant-data-science-and-machine-learning
Build and deploy quality AI agent systems: https://www.databricks.com/product/artificial-intelligence
See all the product announcements from Data + AI Summit: https://www.databricks.com/events/dataaisummit-2025-announcements

FAQs

What are hallucinations in LLM context?

Hallucinations are instances where LLMs generate plausible-sounding but factually incorrect content. This video demonstrates building detection systems to identify these errors, which is critical for production AI systems.

How does Gretel Data Designer help?

Gretel Data Designer enables the automated construction of complex synthetic data generation pipelines. It allows creation of realistic long-context datasets across various domains without requiring extensive manual data collection or annotation.

What is hard-case mining?

Hard-case mining identifies the most challenging examples where hallucination detectors struggle. The methodology uses chain-of-thought-based generation to create both faithful and deceptive question-answer pairs that test detector capabilities.

Can small models detect hallucinations?

Yes, this approach demonstrates that small language models fine-tuned with high-quality synthetic data can perform comparable to models twice their size at hallucination detection. The key is using challenging, synthetic hard cases for training.

Full transcript

All right. So, hi everybody. I'm a research scientist at NVIDIA. And the work I'll present today was done while I was at Gretle AI, which was a startup focused on synthetic data generation, uh, which was acquired by Nvidia earlier this year. So today we're going to be discussing synthetic data generation and a product that we built while at Gretto called data designer uh to facilitate the easy construction of complex synthetic data generation pipelines uh which will be coming to NVIDIA's Nemo microservices platform later this year.
So since this is a lightning talk I'm just going to go ahead and start with a punchline. Um, and so the punch line is this. Using data designer, uh, we were able to build a synthetic hallucination detection fine-tuning data set starting from zero data, zero annotations, which can help a small language model perform on par with a model twice its size. So in this talk, I'm going to share how we got to this result, how you can get to this result uh, with tools like data designer.
Um and but I also want you to keep in mind while we'll be talking about hallucination detection and some specificities of that workflow um synthetic data generation is a generic process and tools like data designer facilitate that in a generic way and the techniques I'll talk about today can be taken away to any other use case. All right. So the main takeaways from this talk that you should have in your mind over the rest of the presentation are as follows.
So synthetic data generation with compound AI systems unlocks the possibility of uh competent open for business AI systems for your individual use case and specifically what you thought synthetic data couldn't do a year ago it can do today. Also small language models in light in the right context and fine-tuned with the right data can provide strong tradeoffs for your particular use case. Uh also you'll see today LM as a judge um can be approached as a flexible incontext classifier and not just answering uh liyker scale rubrics or as uh you've heard in maybe some other talks vibes based judgments.
Uh also too quality counts when it comes to training data and creating challenging clean highquality examples that exhibit the properties and nuance of your use case are highly valuable and should be the target of your synthetic data generation process. Okay, so let's focus on today's use case. What are in context hallucinations and how do they impact AI systems in production? So we'll define an incontext hallucination as a failure of an LLM or or an assistant or an agent framework to report the correct response to a question or query despite the answer being present in the LLM's inputs.
So you can think of a rag or co-pilot scenario. Um here we have an assistant being asked about the state of a database provided some input data uh and context in SQL. So given a simple question which could be answered from a single localized line in the context the assistant probably does very well. Okay. And conversely if the assistant is asked a question whose answer requires connecting dots from across a large context window answer accuracy might degrade.
So this is common failure mode for language models related to a common weakness that many uh non-reasoning models have which is a weakness in multihop reasoning. So for critical or userfacing applications obviously we don't want to give a false answer right. So how can we know at scale and with some reliability that answer was wrong or not. So an LM judge model could be employed in such a setting as a guardrail to detect cases of reasoning failure and take some remediation like causing a response to be regenerated or issuing a correction instruction.
But why should the LM judge model do well at this task? Well, um experience is borne out that LMS are often better at reflection and discernment than on the-fly generation when it comes to correctness. So two-step processes or multi-step processes are generally used to come to a correct answer. It's a form of test time compute. However, employing LMS as a judge to detect incorrect responses in this particular scenario comes with some challenges that we have to take into account when applying judges as guardrails.
So uh judge models um often times folks appeal to a large judge model to assist with a smaller base model. Well larger means higher cost per token. If you want to have high reliability, maybe you then at inference time want to take multiple passes on a judge model, further overhead. Maybe that judge model needs to refer back to a long sequence of conversation or to a large set of contacts from a rag um or re-ranker. All right.
Well, that also lowers throughput and uh de or increases latency. Okay. But also if you have a situation where you want to have high reliability for everything that you're outputting, you need to check everything also higher costs. And furthermore, uh, judge models that you might take off the shelf are generic, just as a base language model is generic. I want to highlight this point because while discernment might be strong in a base model that you're using as a judge, if your business use case is in the tail of that model's training distribution or worse, say your business data is completely niche and local and not doesn't exist on the internet.
Well, then the performance of the judge model might suffer too. So what can you do in this scenario where you want to have reliability of your outputs? You would like to use a guardrail LM as a judge, but you have to consider these costs. Well, it's completely simple, right? Build your own small, fast, performant model. Terrific. The end. Well, it seems good in theory. Um, and in the present year, we've got many great tools that can help us, right?
So in 2025, we've got easy to access GPU compute. We've got ready to go libraries and platforms to do this. Many companies that you can talk to today will help you do this. There's efficient training paradigms, right? So that even if you want to do this on a budget, you can do it on a budget. We've got strong openlicicensed instruction tuned models that are out there, right? That you can start from. But it all comes back down to the central problem where likely for the challenge that you're facing, open data for your use case to train such a model likely doesn't exist.
Right? So despite all these common advances from industry and academia, the core challenge always remains the same as it's ever been in machine learning, which is how do you have the data to train this model? And if you don't have it, where does it come from? Well, generally a very likely annotation process or likely expensive annotation process. But our proposal here is that you can generate it. So compound system performance is today arriving at a state of quality and maturity that was not uh that makes what was not feasible even one year ago feasible today.
Uh both in terms of the engineering complexity to put together the workflows to be able to generate such data but also in terms of the quality of the final result. So uh in this particular use case for hallucination detection uh and in this example that we'll go through today and that got the result that you saw at the beginning uh our proposal is this. So we want to train an in domain open for business small language model that's great at hallucination detection but we want to do it with zero data and zero human annotation as a starting point.
What can we do? All right. So uh to do that we're going to employ the following workflow. uh we're going to use open first off we're going to use openlic licensed uh models to help us every step of the way. That way we're sure that the data that we produce and the models that we produce using that data can also be licensed in however we see fit and don't come with big strings attached. Right? So uh so the first thing that we're going to do is use those models to help us generate long form context.
Then we're going to generate both false and faithful question and answer pairs based on uh based on context examples. Then we're going to use a judged labeling and intent filtering approach to create a high quality set of synthetic labels for the synthetic data we produce. And lastly, uh we're going to use an ensemble of small language models to help us rank and filter those examples to the most informative and challenging examples for our small language models to include in our uh SLM training set.
And the last step is of course training the SLM. But as I said, there's tons of um tools that you can use for that. So let's just go into the details by looking at how we generate this uh data generation pipeline and specifically how we're going to do that with uh data designer. So when we break that down u we have these different steps along the way to produce this workflow for synthetic data. And you'll see this as a common theme when you're trying to produce high quality synthetic data.
There is a creativity and a process that goes into how do you abstract the data that you're trying to make? How do you put it together in a step-by-step fashion to ensure that it has the qualities and properties that you desire. Right? So context generation can be done generically. Um but in the next slides I'll show you a process of how we did long form generation of diverse SQL content um to use as context for question and answer pairs um that we'll use to fine-tune our model.
And uh some of the key concepts that you'll see in this part are uh when you're creating a synthetic data generation workflow um are seating and diversity. So to be sure to use randomization to condition your LLM generation and to sample from potentially a hierarchy of relevant topics and categories to make sure that you have consistent um uh consistent relationships between the properties of your data. And furthermore, when you're creating a synthetic data generation workflow to do so in a multi-step fashion, not just creating one great prompt and asking a language model to give you a good output.
Uh that would might work for a few examples, but you'll quickly see that the quality degrades. Okay, so let's see how to do this in data designer. So um the first step of our context generation workflow is going to be to set up some random samplers. So on the left you're going to see uh some representative code for how we do this with data designer while on the right you're going to see a representation of the current state of our synthetic data generation workflow as we build it.
Okay. So in this particular case I'm setting up um a hierarchical sampler which connects the concept of an industry sector to a software topic that might be relevant for that industry sector. So on the left those industry sectors uh might be it's a little hard to read over here but they might be uh things as diverse as healthcare, finance, technology. You know you can make this as long as you want. You can even go to claude and ask it for a list of these things.
So uh on the right uh you'll see for each one of those sectors we might have a particular software topic that we care about and uh here we have tele medicine platforms a AI powered diagnostic tools etc. So the idea is that we set up these random samplers so that each time we generate a new example, we're going to pick one and the other from this in a hierarchical way. And so we can do that with data designer with our category and subcategory samplers.
Next, um what we're going to do in this SQL context uh generation example is maybe diversify the kinds of ex uh the kinds of concepts or tasks that might be present in the SQL context that we're about to generate. So uh here we can see there might be different concepts that we want to appear in the SQL. So uh here maybe multiple joins, window functions, triggers etc. Um and you can think of this when you're doing your synthetic data generation.
What are the levers that you want to control for um diversity, complexity or difficulty of your examples? Uh what do what should be uh represented in your data set? So you can place those here with more categories um on even particular tasks that we might want for a SQL. So we set up these samplers. Okay. Okay. That's great. So we have a bunch of random samplers. We could get that out of sci. Fine. Great. What do we do?
What's next? Well, with data designer, it's a process of creating a multi-step workflow where we string these things together and sort of dynamically create this DAG of relationships between the samplers and columns, the fields that we're setting up in our data set and how they relate to the next step of generation. So here we see our first LLM generation call where we're kind of trying to generate a query that's going to help us ground the whole SQL example that we're going to generate.
Okay, so we're going to um use this uh Ginga templating framework to refer back to the uh random samplers that we created in the first place. So we set up a goal for SQL. Then we're going to actually start generating SQL code where we're going to refer uh back to the task that we set up in the in the goal. We're going to generate some tables complying to that schema. Okay. And then here we're going to make use of a feature in data designer which allows us to um handle code natively where we're going to do some validation some structural checks to make sure that what we get out of the model is actually SQL code.
So we can do that we generate some schemas then for further complexity right because we're trying to make hard examples for a small language model. Hard a lot of times means longer context. The longer your context is the more opportunity for models to make mistakes. So a big part of generating hard examples in your data set is about lengthening that context, creating more ambiguity for um all of the attention blocks in the transformer.
Okay, so here we're going to add some more records uh to it in SQL. we're going to update um uh maybe the goal or intent of our data set and finally add a uh prospective user query to that data set just to add more flavor to our overall um uh uh SQL context data. So the result of all of this is that we have a series of um objects that we can just concatenate together to get one big um SQL context you know over over 10,000 tokens of valid representative cohesive um uh SQL content from zero using that is diverse using our samplers and then at the end of the day we've got a great big chunk of context that just came from nowhere.
All right. So you had no SQL data. Now you have as much of it as you want. Okay. So uh now that we've defined a workflow for generating context data from scratch, we can turn our attention to question answer pair generation based on that context. Okay? Because our goal here in this data set is context a question and answer. What to fine-tune our SLM? Then was that a hallucination or not a hallucination in the answer.
So to generate these questionans answered pairs some takeaways are use structured uh outputs make sure that uh what you get back from your model is something that you can parse very easily and an interesting thing here is if you want to make difficult examples um a lot of times we mean difficult for a certain class of models like small language models. So we can make things difficult uh in this case by using uh multi-step reasoning like from a reasoning model to help them generate our question answer pairs.
So that's fairly straightforward. We're going to take the synthetic context that we generated, feed it through an open model like distilled quen 32B. We have props for generating both falsehoods and faithful question answer pairs where the answers uh supposed to be right or wrong. And then we can set that up also through data designer with structured outputs to ask for those. So the uh these prompts are quite detailed.
So I didn't include them here for brevity, but they have instructions for the particular case about what the model should do. So after we generated that, so it's great to ask a model for something that is faithful. It's great to ask it for something that's false, but how do you actually know, right? You can ask a model for anything that's just going to spit out whatever. So how do you even know that these things are valid or could actually be useful or not?
So it's not enough just to ask for something. You need to have some confidence in it. So to get this step, we and we want to get this kind of step correct because this is the crux of the whole data set. So wrong labeling will introduce noise and likely degrade our capability to actually fine-tune the model on. So here we can get reliability um through like a a seve or Swiss cheese approach, right? Where we can't promise that any one particular step is going to have instantaneous accuracy.
But if we have multiple consensus judges reviewing these examples, then uh we can go through and come up with a label at high confidence. So uh again we can do that uh using reasoners for a multihop f in a multihop fashion where we provide them with context the question answer pair and then ask whether or not this is faithful or not. Um so we can ask multiple judges have multiple rollouts of reasoning traces. So we arrive at different answers right and when we arrive at different answers then we take a consensus uh between these and where things line up.
Then we say that's a likely label. And then furthermore, um we're going to throw out borderline examples where there's no consensus. We're going to throw out examples um where the intent doesn't really match what the judges intent. And so through this process, we can come up with a uh we can come up with a clean um a clean label um which we can have some confidence in. And the last step of this workflow is saying, okay, all that's great.
We've um we've got some synthetic labels. We've got synthetic question answers. we've got synthetic context that's relevant for our domain. So, um how do we then produce a data set that is actually going to be very effective at training our language models? So, here uh what we propose to do is to search for informative examples by setting up a process that lets us classify whether or not these examples are difficult or easy for the class of models that we want to train.
And so we do that um by uh appealing to an ensemble of small language models where we take all of the question answer pairs and all the uh synthetic labels that we produced in the previous steps. And then we go to a set of small language models and then we just ask them given this context was this right or wrong. Right? And then the key thing we make this a bit more efficient by decoding only one token taking a look at the logits for positive and negative tokens and then coming up with a normalized probability of saying okay was that likely uh a hallucination or not for our set of small language models.
And based on that um then we can come up with kind of the confidence level that our class of small language models have for a given example. And when that contradicts what our synthetic label is to a large degree, then we say, "Aha, that is a difficult example for the class of 3B small language models that we care about." So this lets us have a way of filtering and ranking these based on difficulty. So what we did was we took all of that um all of that together to produce a small data set um just like 560 training examples um uh using a set of Apache 20 and MIT uh open open models, open license models um here and uh open models for the small uh language models that we use to measure difficulty where we generate um just a small set of uh context and then we filter this down based on difficulty. here um we retain only the 13% most difficult examples and we produce a training set and furthermore we did this not just for SQL but also for uh legal text generation you can imagine uh a bunch of other workflows to put together and the result of this is that you can use the small 560 examples to do a pft of uh a small 3B model get it to perform at the level of a 7B all right and not just perform well on synthetic data uh here great we performed well on the synthetic examples but also performed well on human annotated uh benchmark data sets.
Haloo bench is a aggregation of those um where even in that case when it's not SQL or legal text it too uh we saw that the small language model that was fine-tuned on this completely synthetic data set was able to boost that performance. So it's a nice demonstration that through a compound AI system, through the right approach and considering how you set up judgments, how you filter examples, and how you set up that synthetic data generation pipeline, you can arrive at effective models even starting from zero.
Great. So that's the talk. If you want to know more about the work that we do at Gretle or at NVIDIA, um you can follow these QR codes here. And I know we're out of time, so if you have any questions, feel free to come up after the talk and uh let me know. All right. Thanks,

Learn more about the Databricks Data and AI platform.

The information provided herein is for general informational purposes only and may not reflect the most current product capabilities or configurations.