Don’t be data poor — Anuj Iravane, Anterior
AI Engineer · 16 min · 164 sentences · from YouTube's caption track
Each timecode opens YouTube at the start of that sentence. Line anchors (#s42) are the cue ids in the WebVTT, and every line carries its start and end seconds. All transcripts has every talk, and the whole corpus as one file.
- 00:01[music]
- 00:12Hello everyone.
- 00:13Welcome to Don't Be Data Poor.
- 00:16My name's Anuj.
- 00:17I I lead AI at Anterior.
- 00:20Um just a bit about Anterior, we are a clinician-led AI company um built for health plans backed by Sequoia and NEA.
- 00:28Um and what we do is we run AI transformations for health plans.
- 00:31Um as part of which we build agents for several high-stakes healthcare administrative workflows in production.
- 00:38Um things like prior authorization, payment integrity, HEDIS measures, etc. Um it's it's okay if you're not familiar with any of these workflows um because a lot of the work that we do
- 00:49can actually be summarized in in the same way.
- 00:53It's uh policy-guided decision-making over highly unstructured data.
- 00:58And the unstructured data looks something like this, right?
- 01:00You have uh you have these scanned fax bundles containing medical records full of patient information.
- 01:07Um a not-so-fun fact is that I think around 70% of medical communication still happens via fax.
- 01:13Um and fortunately or unfortunately, this is the data that we end up working with the most.
- 01:19Um it is a very rich and information-dense data that we see here.
- 01:24Um the data distribution here is it comes from a very long tail of rare um cases with a nuanced scenarios.
- 01:32Uh it models an entire clinical trajectory for a patient.
- 01:35Uh and every single person's journey is very different.
- 01:38Uh it also presents itself in various formats.
- 01:41So, you have like things like bad handwriting, tables, checkboxes, um key-value pairs, images, um a lot of stuff here to deal with.
- 01:50But I personally think it's a very fascinating source of data that we see here.
- 01:53Like it's it's it's like sort of like an observation through a very fuzzy lens over an entire person's lifespan.
- 01:59It's really unique.
- 02:02And I'm sure you must have heard this like enough times today already, but in healthcare the the baselines for accuracy are just exceptionally high.
- 02:1195% is not good enough.
- 02:13Um And at Anterior, this is why we invest very deeply in datasets and emails.
- 02:18And these unstructured medical records are a staple source of data for these emails.
- 02:24And we we work with this kind of data in almost every workflow that we try to automate.
- 02:29But the problem is we can't really keep this data.
- 02:32It's PHI, it's highly protected.
- 02:34We can't retain it, we can't reuse it, we can't even derive information from it.
- 02:38And most of our contracts prohibit us from from doing anything like that.
- 02:42Um even things like redacting it, anonymizing it, and keeping derivative copies like is a strict no-no, completely off the table.
- 02:48So, nothing really survives in any sort of dataset that we want to persist over a period of time.
- 02:54[snorts]
- 02:54So, so what this talk is about is like what do you do when the dataset you most need is also the data you're least allowed to keep.
- 03:05And the and the bet that we the answer that we put our bets on is that we can kind of synthetically generate this data ourselves.
- 03:13There's been a lot of focus on synthetic data recently.
- 03:15You have like Frontier Labs striving to generate synthetic data for continued pre-training, for RL, for computer use, for agents.
- 03:23So, it's it's it's a hot topic and it's it's a hot topic on our minds as well.
- 03:27And the moment you say generate, like the first thing that comes to mind is, okay, can we can we try to use an LLM to generate synthetic data?
- 03:35And I think you can.
- 03:36I personally believe LLMs are a fantastic tool to generate synthetic data.
- 03:40And several teams have already demonstrated this already.
- 03:43There's been some papers in the healthcare space, outside the healthcare space, people have successfully used LLMs to generate synthetic data for for different purposes.
- 03:52There are some known challenges in trying to use these elements to create data especially when you're trying to one shot the whole process.
- 03:59Uh it's really hard to generate diverse realistic looking synthetic records.
- 04:04And this is even more of a problem when you're trying to do when you're trying to do this at scale.
- 04:08So, uh often times these medical records are over 300 pages long and it's like imagining if you wouldn't ask an LLM to write a novel for you in one shot, right?
- 04:17So, it's the same reason why you wouldn't use an LLM to just one shot a synthetic record for you.
- 04:22Um and LLMs seem to suffer from this very strange mode collapse problem when it comes to generating like diverse uh data, creative data.
- 04:30And I think there's two main reasons for it.
- 04:32Uh the first one is uh like I just mentioned in the talk earlier, there's very little exposure to this data source in the pre-training data corpus.
- 04:41Um and today's objectives for pre-training and post-training are are largely uh they're only they're not incentivized for creativity or diversity really.
- 04:48They're incentivized to be helpful systems.
- 04:53So, with these challenges in mind, uh I'll walk you through like one of our approaches in how we uh managed to build a pipeline to generate synthetic data.
- 05:00Um earlier I mentioned our forward tasks look something like this, right?
- 05:04So, you have workflows and tasks that uh start with some unstructured data and a policy.
- 05:09Um and you execute your policy against that data.
- 05:12You follow this reasoning trace through it uh and you arrive at some sort of an outcome, which is your label.
- 05:18So, this is our forward task.
- 05:21Uh and the idea we had was to try and reverse this process.
- 05:24Uh can we actually start by sampling a random label, uh figuring out a a reasoning trace for that label, and then trying to generate data backwards from that?
- 05:35Uh the idea here being that if you can actually uh sample these two things uh with enough diversity, uh we will have we will be able to generate data that's conditioned on diverse set of inputs, allowing us to kind of circumvent the diversity problem a little bit.
- 05:52Uh so just a quick aside on policies.
- 05:53We've talked about policies a bit, but uh let me just clarify what these really mean, right?
- 05:56So, this is an example policy we have for for a CPAP device for patients.
- 06:00Uh this particular one is for a medical necessity review workflow.
- 06:04Uh and it it sort of outlines all these diverse set of conditions uh that a patient might have um in which a CPAP device should be approved or or rejected.
- 06:14Um so and this policy, as well as many other policies, uh you can think of these as uh essentially decision trees that outline all these sorts of conditions um um that that dictate how some outcomes are met.
- 06:27And at Antheir, actually, we we spend a lot of time and energy in trying to model these policies explicitly as decision trees.
- 06:33Um uh we work with uh symbolic representation uh similar to decision trees, uh and it helps us achieve a better accuracy uh and consistency score when executing them in LLM-based workflow.
- 06:44And and the reason why I'm bringing this up is that uh by having this sort of symbolic representation of a policy, you actually have uh a way to kind of deterministically sample
- 06:54different reasoning traces for a given outcome.
- 06:59So, back to our idea of like reversing the process, right?
- 07:01Uh this this sampling of reasoning traces from the policies uh what helps us get that diverse conditioning input to then generate medical records from.
- 07:09Uh and the key idea here is that the distribution here uh that we sample from is is a much more uniform uh and effective prior distribution than what you'd normally get from an LLM.
- 07:19Uh one added benefit of sampling this way is that, in theory, you're able to test uh for far more scenarios than you would likely get from production data sources.
- 07:27So, what I mean by that is like say you get a sample of uh 200 cases from your customer uh um and and and and you try to like have an eval that measures performance against that, and you get a 95% score.
- 07:38Uh it doesn't really tell you about uh what you what your performance would be in those rare edge cases that are not in that data set.
- 07:44There'll always be rare edge cases uh that are outside the distribution just because of the fact that our data is so uh highly variant.
- 07:53So, uh for those for those family with Cynthia, like uh they follow a similar pattern uh of sampling scenarios from a symbolic causal state representation.
- 08:00There's a few of the folks in the space who are uh working with these symbolic representations to uh to generate diversity in synthetic data generation.
- 08:09So, let me walk you through the rest of the pipeline.
- 08:11All right?
- 08:11So, uh once we have this diverse set of samples as a conditioning input, what we did was we built an LLM-based pipeline that uh follows uh a coarse-to-fine pattern
- 08:22to progressively uh uh build up a medical record layer by layer.
- 08:26So, here we first start with creating some patient invariants like the biological sex, the birth date, the blood group.
- 08:33Uh we use that along with a recent trace uh with an LLM again to produce an ordered list of uh events and provider that a patient might have had, and we call this the patient journey.
- 08:43So, this is a high-level uh you can think of it as a high-level uh overview of what a patient might have gone through in their lifespan um uh captured by a list of events
- 08:52on a high uh in natural language.
- 08:56And in the real world, it is actually only during these uh uh encounters provider encounters that documentation is really generated.
- 09:03At least for the data that we get uh uh most of our data source data is generated during these provider encounters.
- 09:09So, we model exactly that in our pipeline.
- 09:12Uh we first generate a document plan for each encounter, and then based on that and the preceding history of the uh of the patient, we uh we fan out into generating the actual documents
- 09:22uh um to hydrate them with actual synthetic information.
- 09:26Uh and this coarse-to-fine layering uh is actually what allows us to keep uh uh the different prompt payloads in the pipeline uh very token efficient uh from both input and output perspective.
- 09:37While also enabling this also helps us enable the scale across longer patient journey.
- 09:41So, you can scale this pipeline.
- 09:43You can have a much longer patient journey and you can just fan out and generate documents that way without overloading the context windows of your LLMs.
- 09:53Finally, we have the sort of refinement loop in the end that we that uses a set of emails to provide feedback to improve specific parts of the generated documents.
- 10:03For example, one of the emails we have is an LLM based check for consistency between all documents.
- 10:09So, this makes sure that there's no contradictions or inaccuracies or conflicting information between two documents that are generated.
- 10:17This is important because we we have a parallel fan out process that is used to generate these documents independently.
- 10:24And because we started with the labels for this particular pipeline run, uh what we actually also have is an ability to kind of use those labels run and and and compare those against the generated
- 10:38medical records to see if the tasks that we originally used actually matches the data is in accordance with the task inputs and outputs.
- 10:45So, we can do this sort of round trip check to ensure that our data is actually in sync and by default get the correct labels by construction.
- 10:52So, in theory, this is a very nice property to have.
- 10:56Like you can basically skip the ground truth and expensive ground truth in process you need for for data for fair data.
- 11:04One thing to clarify here is that so far all the generation has been happening just in plain text and markdown text.
- 11:11It is possible to go from that to a rendered PDF.
- 11:15But we don't really see much value in doing that because we have state of the art PDF parsers today available to everyone and they just allow you to convert any sort of complex PDF into a nice markdown representation.
- 11:28So, all of this synthetic generation Um, evaluation happens in the text domain.
- 11:34So, this is just an example of like a pipeline that we created from scratch and it's it's very easy to build.
- 11:38It's largely fully LM based.
- 11:40Um, but but who came up with this, right?
- 11:42Like who who am I to uh know anything about what a good medical record looks like?
- 11:48Uh So, how do we know if this is any good?
- 11:51And uh I think this has been mentioned a few times today already, but like you really don't.
- 11:55Like uh no way AI engineer would ever would.
- 11:58Like you want your domain experts to be the ones telling you what's good, what's not good.
- 12:03Um, and which is why we believe that uh it is of great value to empower your domain experts to own your whole data pipeline.
- 12:13And specifically, we uh we do this in two ways, right?
- 12:16Uh we enable our clinicians to kind of interject at each point uh in the generation process with a human-in-the-loop mechanism.
- 12:23So, at any point, a clinician can steer the generation process to make uh a medical record in the way they want it.
- 12:29Uh we often see our clinicians use this uh to to first look at cases that happen in production, get some interesting ideas, and then use that use those ideas along with this uh steering in this pipeline
- 12:41to make uh cases that look similar to what we might see in production or they've seen in production.
- 12:46And this is what makes the data generated from this really useful, right?
- 12:49Like you can actually model your uh your failure cases um beforehand or even after they after you see them in production.
- 12:58And secondly, I think most importantly, we let our clinicians also own the whole logic of the pipeline.
- 13:03Um, we do this by modeling the whole pipeline as a skills-based workflow running on a generic uh agent harness that we built internally.
- 13:12So, every every uh kind of section here you see uh all the way from the patient journey to the document generation to the document enrichment to the evals, all of these things are skills
- 13:22uh that run on our agent harness.
- 13:27As an example, if a clinician wanted to uh say maybe add support for a new document type, let's say for a new customer, they wanted their intake forms to look a certain way,
- 13:37they could easily just make a new skill file for it, attach it to the pipeline, and and and voila, there there wouldn't be any engineering changes required.
- 13:44So, it's completely clinician owned from that perspective.
- 13:47And just in a side generally, I feel like skills are really an amazing interface between AI engineers and domain experts, especially in vertical AI.
- 13:55We see this being we see this being modeled in several of our other workflows both for internal use cases and in production as well.
- 14:07So, some results from this, right?
- 14:08So, even though we only really use synthetic data for evaluation at the moment, there's already a lot of merits that we get from it.
- 14:17Roughly 90% of our data sets are already made of synthetic data.
- 14:21This helps us maintain a very high production accuracy score um for across many customer deployments.
- 14:29The pipelines that we just showed you already we are able to achieve a a very high fidelity on this generated data.
- 14:36In a blind review, clinicians were not able were only able to distinguish synthetic from real about 60% of the time.
- 14:42So, room for improvement, but but it's but it's it's close.
- 14:47And I'm I'm quite quite it's a quite promising avenue for us to invest more more here.
- 14:52And and the the the the fact that is the most interesting to me and what I'm really what I'm really excited about is that all of these data sets
- 14:59well, most of our data sets today then are created just in time for these customer deployments, right?
- 15:03You can you when you have the ability to like create data from scratch so quickly, you can kind of you don't need to depend on on on waiting for data from your customer.
- 15:12You can kind of just model all your edge cases, simulate them, and test your workflows before you go live with the production go live in production.
- 15:22So, some takeaways if you're looking to build your own synthetic data pipeline in healthcare or even another domain, try reversing your inference workflow.
- 15:33Diversity should always be sampled from a from an appropriate distribution for your use case.
- 15:38Try to emulate the process in which data was actually generated.
- 15:44So, like I showed you, we were trying to sort of like we were using LLMs we're trying to emulate how our medical records might actually be generated during patient encounters.
- 15:54So, and I I would highly recommend you try doing that.
- 15:57And the fourth most important thing I think is when you're when you're making a data pipeline like this, it's really important to give your domain experts the keys because these are the people who know
- 16:05about your data and and and they will help you drive towards a recursive self-improvement and not the AI engineers.
- 16:14Cool.
- 16:15So, you don't need a PHI problem for this anywhere.
- 16:18The data you need is ephemeral, sensitive, or even expensive to label.
- 16:21You can think about generating data yourself and hopefully you won't be data poor.
- 16:27Thank you, everyone.
- 16:42[music]