Ship It Conversations: The AI Hallucination That Looks Right, With Devansh of Irys on Legal AI, Three-Tier Error Isolation, Models That Change Under You, Overhyped Reinforcement Learning, and Optimizing for Maintenance Over Generation
Try reloading the player or open this episode directly on YouTube.
In this episode, Devansh from Irys discusses the challenges of legal AI, particularly the issue of AI hallucinations using real cases incorrectly. He explains his team's three-tier system for error isolation and emphasizes optimizing for maintenance over generation.
Now Playing
Ship It Conversations: The AI Hallucination That Looks Right, With Devansh of Irys on Legal AI, Three-Tier Error Isolation, Models That Change Under You, Overhyped Reinforcement Learning, and Optimizing for Maintenance Over Generation
Ship It Weekly
0:0033:12
Chapters
Jump to a section in this episode.
Speed & share
Transcript
Think about the breaker panel in your house.
Put everything on one circuit and a single fault
takes out the whole house. Then you are hunting
with a flashlight. Label the breakers and you
know it's the kitchen before you get up. My guest
today builds AI for lawyers and his whole approach
is about labeling the breakers. Everybody's heard
about AI making up court cases. He says the more
interesting hallucination is a real case that
just doesn't apply. And he says even if a fully
agentic system got you 20% better results, you'd
never know how it breaks until it breaks. I'm
Brian Teller from Teller's Tech, and this is
Ship It Weekly.
Welcome back to Ship It Weekly,
where I filter the noise and focus on what matters
when you are the one running infrastructure and
owning reliability. Most weeks, it's a quick
DevOps, SRE, platform, cloud, and security news
recap. In between those, I do conversation episodes
with people building and operating these systems.
Ship It Weekly turns one this month. To celebrate,
through mid-December, you are getting two conversations
a week, Mondays and Wednesdays, with the news
every Friday. Then we're back to our usual rhythm.
Today, I'm joined by Devansh, founder and head
of AI at Irys. He builds reasoning and verification
systems for legal AI, which is a brutal place
for hallucinations and confident wrong answers.
We talk about why the trickiest legal hallucination
is a real case used the wrong way. How his team
splits the system into three tiers so they can
find failures fast what it's like running AI
in production when the model can change under
you and why he calls reinforcement learning the
most overhyped technique in AI all right let's jump in
thank you for joining me thank you for
having me Brian very excited to be here so tell
me a little bit about Irys and and what what
you're working on there and what problems you're
running into with AI and what problems you're
solving. Absolutely. So I think to summarize
something very briefly, what we see in legal
AI, and this is a large problem in AI in general,
is that language models and the fundamental nature
of AI research, et cetera, is getting really,
really good at doing a lot of things somewhat
well. You know, that's the whole phenomenon of
AI slop. But when it comes to going from somewhat
well to being exceptional and being reliable
and like the last mile delivery concept, our
systems are not able to keep up. And what we
are essentially trying to do is we're re-engineering
a lot of structure into the way AI is done with
the whole understanding that if we can have structure.
We can better predict ahead of time when a system
would fail, when it would succeed, how to make
the system work better. And when a user comes
to us and says, hey, can you, this is not working
out for us. Can you improve this? Or this works
really well. Can we double down on this? The
ability to have structure and engineering stuff
allows us to work on that instead of just like,
you know, hoping that a better system prompt
or a better model will solve those problems because
that's not really fair to the user or to ourselves
if we're doing that. Yeah, that makes sense.
So why does AI for professionals break down so
often? And what does it take for a system to
be trustworthy? I think that's a great question.
And I think what it takes depends heavily on
what your system is expected to do. Essentially,
any software system you build is a contract between
the system and the user, where you say the system
has to do certain things, the user has to do
certain things, they're expected to engage with
the system in a certain way the struggle we're
often facing is that these contracts aren't very
well defined and they're always changing you
know new AI tools and new AI workflows will come
around and they'll completely change how you
should be operating it or how to best use certain
things and not use certain things so I think
at its core of where things fail is often it's
either users expect things that are not viable
with the system or they're not educated and What
we really need to be doing is figuring out better
ways to integrate. We need better ways to identify
what users are able to do well and what users
are, what should be taken out of their hands
and done through AI systems. Like right now it's
very vibezy, it's kind of try everything,
stick it, throw it at the wall. And this is where
a lot of things are failing in practice because
users don't, like users don't know what they
have to verify, you know, where they should step
in versus where the AI can be trusted without
too much worry. Yeah. So in legal specifically,
what is the actual failure mode that you're seeing?
Is it wrong facts? Is it fake citations? We've
heard some of that in the industry over the last
couple of years. Or is it like missing nuance
or misreading authority? What are the main issues
that you see? I think the way we've broken it
down, we often talk about three categories of
hallucinations. One category of hallucination
is you say what you're describing fake case citations.
This AI is just saying like Devansh versus Brian,
for the Supreme Court, when it doesn't exist.
The second much more interesting hallucination
is AI says it's a real hallucination. It's a
real case and it is a real case, but it doesn't
apply to the way it's doing because a lot of
legal is interpretation it's not exactly like
this case says this only and this will be applied
in this context you say a lot of what lawyers
do in litigation etc is essentially take what
was already argued and say okay based on this
we can apply it in this format or in this way
so a lot of um AI tools where they're failing
right now is they're misapplying case law they're
they're creating bad legal strategy because of
this and this is the part that a lot of basically
nobody else is solving this was something that
we were one of the first people to actually actively
try to solve for and this is very much the next
domain of problem solving where it would be formed
is when you have very long contexts and very
long amounts of information you have a lot of
like conditional applications like this contract
in this clause will be modified by another clause
somewhere else, or in certain cases you could
apply this kind of an argumentation to it, or
certain law firms have certain ways of operating,
certain lawyers have certain preferences for
how they want to structure arguments, whether
they want to rely on one kind of authority over
another, etc. And that kind of judgment is not
something that AI... gets naturally because again
if you think about what AI is it's trained to
give you the most probable output token at any
given time which is a kind of reversion to the
mean better models mean that you're reverting
to a higher mean than before but you can never
have this outlier-ish final touch application
with just AI averages so on that lens we are um
like you know How does an AI know when to apply
what kind of conditionals and logic and how to
chain different things together is one of the
biggest breakthroughs that we had. And I think
this is where the next generation of products
will differentiate themselves. So in researching
for this episode, I looked at Irys One. Can you
walk me through the three-tier reasoning architecture?
What are the tiers? What do each of them mean?
What do they do? Absolutely. And I think instead
of... really talking about the technicals on
uh what each of those tiers are I think first
it's very important to just understand what kind
of problems we have on our system when we're
talking about stuff like how do you know when
to apply which kind of logic these conditionals
we're talking about contracts modify so the first
tier would just be ingestion you need to be able
to process your input and already here a lot of
legal AI fails completely why would it fail Brian
because if you think about input A lot of the
times your input are not clean, one-shot texts
with everything marked out. A lot of your users
and viewers will probably have either dealt with
it explicitly or would be figuring this out right
now. Like if you had a PDF, you might have handwritten
notes on it. You might have a PDF and an email
chain where the email chain refers to some part
of the PDF. But it's because those are two different
documents. Those aren't going to be chunked in
any meaningful way where it's going to happen.
You will, like you just mentioned, Irys, one
and the three tiers like you're referring to
some document somewhere but that's not in the
nature of this conversation so if you were just
ingesting the way most people are currently doing
it which is just document one document two document
three you will miss these aspects or if some
people are doing with chunks you will miss these
aspects so the first thing that really sets us
apart is the ingestion so ingestion is what allows
us to map different concepts map different ideas
now we do this through a knowledge graph that
allows our AI to build kind of a context map
with the point of it being that when our reasoning
system is looking through something it's really
looking at how those ideas are linked this clause
where which claw if there was a clause a what
other clauses is clause a related to and then
what this allows us to do is we can have that
thing be done at one ingestion time and two now
we're rolling out a lot of work for background
processes, checks, constant repairs, because
what we're realizing is context is exploding
so much. People are uploading so many documents
that it's no longer viable for us to do one-time
ingestion. It's much better for us to have constant
batch of updates and improve the self-organizing
graphs that way. Aspect two of this is we need
to be able to then reason over this. Think of
The ingestion step basically builds the world
that the AI will navigate in. Now the AI needs
to navigate this world better, take use of existing
tools, get use of existing systems. That's where
tier two comes in. That's where our research
goes into latent space reasoning, hierarchical
embeddings, et cetera. What all of these allow
us to do is we are able to navigate the world
better through these. We're analyzing the systems.
We're like, okay, AI has to be like for this
kind of a legal strategy we simulate like 50
different outcomes and we're like this should
work well this doesn't this might not work well
this is how we might synthesize across aspects
and then finally we get to the final tier which
is the delivery and I'm breaking this down more
from a user impact perspective as opposed to
necessarily engineering layers or whatever because
The thing that stuck with me most from this conversation with Devansh is a trade he's willing to make that a lot of AI teams aren't.
I asked him what the hardest part is about running an AI system like his in production. His answer was being able to track everything.
Even if you could get 20% better performance tomorrow by going fully agentic, he said, the problem is "you never know when they break and you never know how they break until they break." With structure, "even when it's failing you know where it's failing."
He'll take the system he can debug over the one that scores better.
Every on-call engineer understands that in their gut. A clever system that performs a little better and fails in ways nobody can explain is worse to own than a boring one you can reason about at 3 AM.
That trade runs through everything he said. Models are getting really good at doing a lot of things somewhat well, but the last mile to reliable is where they fall short. So his team engineers structure back in instead of hoping the next model fixes it.
At the top of the episode I compared his approach to labeling the breaker panel in your house. Here's why it fits.
His team splits the system into three tiers. Ingestion takes messy input and maps it into a knowledge graph. Reasoning navigates that graph. Delivery applies how a particular firm or lawyer likes to work.
What matters is how they use that split when something goes wrong.
If a lawyer says the answer is missing information, they immediately know where not to look. In his words, "We don't need to care about the personalization there." Then they check whether the data is in the graph at all. If it is, ingestion did its job, and the problem is either the way they mapped the structure or the reasoning that moved through it. Two or three targeted queries, and they know which.
That's incident triage. The first useful question in almost every incident is some version of "which layer is this?"
He also described the tiers by their impact on the user, not as engineering layers. You can always go arbitrarily deep on the engineering, he said, but grounding it in what the user experiences means you can always narrow a problem down.
That's the same reason we write SLOs from the user's side. Nobody reports "the cache hit rate dropped." They report that it's slow, or that something's missing. If your boundaries line up with the complaints, the complaint tells you where to look.
The second idea is about which failures are actually dangerous.
Everybody's heard about AI inventing court cases. Those fall apart the moment somebody looks them up. Devansh says the more interesting hallucination is a real case used the wrong way. The case exists. The citation checks out. It just doesn't apply the way the AI is applying it.
So much of legal work is interpretation: taking what was already argued and deciding how it applies here. Get that wrong and, as he put it, you're "creating bad legal strategy." And because the case is real, it looks fine.
His explanation of why it's so hard is worth sitting with. A model is trained to give you the most probable output, which he called "a kind of reversion to the mean." And then: "Better models mean that you're reverted to a higher mean than before." But legal judgment lives in the outliers. How this firm likes to operate. Which kind of authority this lawyer would rather rely on. A clause that gets modified by another clause somewhere else in the contract.
I see the same pull with AI-generated infrastructure code. Ask for a config and you get a very reasonable, very average config. Your environment isn't average. It has the odd network rule, the legacy service, the account set up differently for a reason nobody wrote down.
In the recap I said a config that's valid but wrong hurts more than one that won't parse. The broken one fails in CI. The valid one deploys clean, passes every check, and waits.
The knowledge graph is part of how his team catches those connections. It exists, as he put it, "to teach our AI layers where to look." Chunking documents and searching for similar text hopes that everything relevant sits close together. Real input doesn't. His example was a PDF with handwritten notes and an email chain that refers to part of that PDF. Two documents, one idea, and a chunker treats them as strangers.
When I asked what happens when the corpus goes from 10 docs to 10 gigabytes, he said size isn't always the problem. For most tasks, "it's still only three, four, five documents that actually matter." The hard part is finding them.
That's most incidents. Terabytes of logs and metrics, and the answer is in three lines somewhere. Volume isn't the problem. Knowing where to look is. Service catalogs, dependency maps and good runbooks are our version of that graph.
The third idea is the one I'd point every platform team to. The model can change under you.
When I asked what his team logs and measures, he said it's still an open discussion. But the number one thing they track is simple: "does it behave as expected?" Can they predict ahead of time what path the system will take? If they can, at least they know it's stable.
That's harder than it sounds, because labs change models behind the scenes. Post-training. Quantization. Tokenizer changes. No new version number, and your output shifts anyway.
What I like about his metric is that it isn't "is it good?" It's "is it predictable?"
That's the right order. Without a stable baseline, you can't tell whether a change made anything better. Normally we'd pin a dependency and move on. You can't pin a model someone else is quietly changing, so you watch it. That's drift detection, and we know how to watch for drift.
His pick for the most overhyped technique in AI was reinforcement learning. RL works when the output is truly verifiable and the constraints are hard. The trouble is people using it for open-ended goals, like making an LLM reason better or write better.
"What does better mean? Better has no signals."
So teams fall back on proxies, like whether code compiles in a certain amount of time or a sentence uses fewer emojis. Every SRE has seen this with metrics. Measure how fast tickets close and you get tickets closed, not problems fixed.
Which brings me to his advice for anyone building with AI.
Devansh thinks too many people are building AI for high performance, because that's what gets you the cool demos. It often leads to overly complicated systems that get re-engineered from scratch once people find where they go wrong. So "people should be engineering for error isolation, first and foremost."
That goes double with coding agents, because "these systems will just churn out heaps and heaps of code." His answer, and the line I said I'd tape to my monitor: "optimize for maintenance, not for generation. Because maintenance is where your system either lives or dies."
Generation is the demo. Maintenance is the pager. Code an agent wrote in an afternoon is code your team owns for years.
His closing thought is one I agree with. None of us really know where AI is headed, and there are no true experts, so don't wait for someone to tell you how to build it. Get in the mud. In his words, "the only way to build taste and judgment is for you to fail repeatedly," and then look hard at where things failed and where they worked.
That's how on-call works too. Nobody gets good at incidents by reading about them. You get good by working a lot of them and doing the postmortem honestly.
So my takeaway from this one is simple.
You can't fix what you can't find.
Label the breakers before you need them. Watch for drift in the things you don't control. And when a tool makes it cheap to generate more, make sure it isn't making it expensive to maintain.
A system that's 20% better and impossible to debug isn't better. It's just harder to fix.
📝 Notes
Show Notes
This is a guest conversation episode of Ship It Weekly, separate from the weekly news recaps.
In this Ship It Conversations episode, I talk with Devansh about why the trickiest legal AI hallucination is a real case used the wrong way, how his team splits their system into three tiers to find failures fast, and why he'd rather optimize for maintenance than for generation.
Devansh is the Founder and Head of AI at Irys. He builds reasoning and verification systems for legal AI, a tough place for hallucinations and confident wrong answers. He also publishes open source AI research on Substack.
We start with why AI for professionals breaks down. Devansh thinks models are getting good at doing a lot of things somewhat well, but they fall short on the last mile to reliable. So his team engineers structure back in instead of hoping a better model fixes it. In legal, fake citations are the failure everyone has heard about. The more interesting one is a real case that doesn't apply. So much of law is interpretation, and a model built to predict the most probable token pulls toward the average.
Then he walks through the three tiers behind Irys One. Ingestion maps messy input, like PDFs with handwritten notes and email chains that refer to them, into a knowledge graph so the AI knows where to look. Reasoning navigates that graph. Delivery applies how a firm or a lawyer likes to work. The payoff is error isolation: if a lawyer says something is missing, two or three targeted queries tell them whether it was ingestion or reasoning. We also get into why chunk-based retrieval misses connections, why going from 10 docs to 10 gigabytes is mostly about finding the few documents that matter, and how "answer contracts" handle "it depends."
Then I take a DevOps angle. Devansh says the hardest part of running AI in production is tracking everything. A fully agentic system might perform 20% better, but you never know how it breaks until it breaks. The first thing his team tracks is whether the system behaves as expected, because labs change models behind the scenes with post-training, quantization and tokenizer changes. We also cover why he calls reinforcement learning the most overhyped technique in AI: it works when the output is truly verifiable, and falls apart when "better" has no real signal.
The big takeaway: you can't fix what you can't find. Engineer for error isolation first, and optimize for maintenance, not generation. Coding agents will churn out heaps of code, but maintenance is where a system lives or dies.
Highlights
• Why a real case applied wrong is worse than a fake citation
• Why AI's pull toward the average struggles with legal judgment
• Ingestion, reasoning and delivery as three separate tiers
• Knowledge graphs vs chunking for finding what matters
• Isolating failures with two or three targeted queries
• Models that change under you, and tracking expected behavior
Devansh is the Founder and Head of AI at Irys, where he builds reasoning and verification systems for legal AI. He also publishes open source AI research on Substack.
The thing that stuck with me most from this conversation with Devansh is a trade he's willing to make that a lot of AI teams aren't.
I asked him what the hardest part is about running an AI system like his in production. His answer was being able to track everything.
Even if you could get 20% better performance tomorrow by going fully agentic, he said, the problem is "you never know when they break and you never know how they break until they break." With structure, "even when it's failing you know where it's failing."
He'll take the system he can debug over the one that scores better.
Every on-call engineer understands that in their gut. A clever system that performs a little better and fails in ways nobody can explain is worse to own than a boring one you can reason about at 3 AM.
That trade runs through everything he said. Models are getting really good at doing a lot of things somewhat well, but the last mile to reliable is where they fall short. So his team engineers structure back in instead of hoping the next model fixes it.
At the top of the episode I compared his approach to labeling the breaker panel in your house. Here's why it fits.
His team splits the system into three tiers. Ingestion takes messy input and maps it into a knowledge graph. Reasoning navigates that graph. Delivery applies how a particular firm or lawyer likes to work.
What matters is how they use that split when something goes wrong.
If a lawyer says the answer is missing information, they immediately know where not to look. In his words, "We don't need to care about the personalization there." Then they check whether the data is in the graph at all. If it is, ingestion did its job, and the problem is either the way they mapped the structure or the reasoning that moved through it. Two or three targeted queries, and they know which.
That's incident triage. The first useful question in almost every incident is some version of "which layer is this?"
He also described the tiers by their impact on the user, not as engineering layers. You can always go arbitrarily deep on the engineering, he said, but grounding it in what the user experiences means you can always narrow a problem down.
That's the same reason we write SLOs from the user's side. Nobody reports "the cache hit rate dropped." They report that it's slow, or that something's missing. If your boundaries line up with the complaints, the complaint tells you where to look.
The second idea is about which failures are actually dangerous.
Everybody's heard about AI inventing court cases. Those fall apart the moment somebody looks them up. Devansh says the more interesting hallucination is a real case used the wrong way. The case exists. The citation checks out. It just doesn't apply the way the AI is applying it.
So much of legal work is interpretation: taking what was already argued and deciding how it applies here. Get that wrong and, as he put it, you're "creating bad legal strategy." And because the case is real, it looks fine.
His explanation of why it's so hard is worth sitting with. A model is trained to give you the most probable output, which he called "a kind of reversion to the mean." And then: "Better models mean that you're reverted to a higher mean than before." But legal judgment lives in the outliers. How this firm likes to operate. Which kind of authority this lawyer would rather rely on. A clause that gets modified by another clause somewhere else in the contract.
I see the same pull with AI-generated infrastructure code. Ask for a config and you get a very reasonable, very average config. Your environment isn't average. It has the odd network rule, the legacy service, the account set up differently for a reason nobody wrote down.
In the recap I said a config that's valid but wrong hurts more than one that won't parse. The broken one fails in CI. The valid one deploys clean, passes every check, and waits.
The knowledge graph is part of how his team catches those connections. It exists, as he put it, "to teach our AI layers where to look." Chunking documents and searching for similar text hopes that everything relevant sits close together. Real input doesn't. His example was a PDF with handwritten notes and an email chain that refers to part of that PDF. Two documents, one idea, and a chunker treats them as strangers.
When I asked what happens when the corpus goes from 10 docs to 10 gigabytes, he said size isn't always the problem. For most tasks, "it's still only three, four, five documents that actually matter." The hard part is finding them.
That's most incidents. Terabytes of logs and metrics, and the answer is in three lines somewhere. Volume isn't the problem. Knowing where to look is. Service catalogs, dependency maps and good runbooks are our version of that graph.
The third idea is the one I'd point every platform team to. The model can change under you.
When I asked what his team logs and measures, he said it's still an open discussion. But the number one thing they track is simple: "does it behave as expected?" Can they predict ahead of time what path the system will take? If they can, at least they know it's stable.
That's harder than it sounds, because labs change models behind the scenes. Post-training. Quantization. Tokenizer changes. No new version number, and your output shifts anyway.
What I like about his metric is that it isn't "is it good?" It's "is it predictable?"
That's the right order. Without a stable baseline, you can't tell whether a change made anything better. Normally we'd pin a dependency and move on. You can't pin a model someone else is quietly changing, so you watch it. That's drift detection, and we know how to watch for drift.
His pick for the most overhyped technique in AI was reinforcement learning. RL works when the output is truly verifiable and the constraints are hard. The trouble is people using it for open-ended goals, like making an LLM reason better or write better.
"What does better mean? Better has no signals."
So teams fall back on proxies, like whether code compiles in a certain amount of time or a sentence uses fewer emojis. Every SRE has seen this with metrics. Measure how fast tickets close and you get tickets closed, not problems fixed.
Which brings me to his advice for anyone building with AI.
Devansh thinks too many people are building AI for high performance, because that's what gets you the cool demos. It often leads to overly complicated systems that get re-engineered from scratch once people find where they go wrong. So "people should be engineering for error isolation, first and foremost."
That goes double with coding agents, because "these systems will just churn out heaps and heaps of code." His answer, and the line I said I'd tape to my monitor: "optimize for maintenance, not for generation. Because maintenance is where your system either lives or dies."
Generation is the demo. Maintenance is the pager. Code an agent wrote in an afternoon is code your team owns for years.
His closing thought is one I agree with. None of us really know where AI is headed, and there are no true experts, so don't wait for someone to tell you how to build it. Get in the mud. In his words, "the only way to build taste and judgment is for you to fail repeatedly," and then look hard at where things failed and where they worked.
That's how on-call works too. Nobody gets good at incidents by reading about them. You get good by working a lot of them and doing the postmortem honestly.
So my takeaway from this one is simple.
You can't fix what you can't find.
Label the breakers before you need them. Watch for drift in the things you don't control. And when a tool makes it cheap to generate more, make sure it isn't making it expensive to maintain.
A system that's 20% better and impossible to debug isn't better. It's just harder to fix.