Prefer reading instead? The full article is available here. The podcast is also available on Spotify and Apple Podcasts. Subscribe to keep up with the latest drops. Most ML models answer one question: what is likely to happen? The harder question is what will change if you intervene. That gap is where causal reasoning begins. In this episode, we explore how constraint-based algorithms learn causal structure directly from data, and how LLMs can step in to resolve what statistics alone cannot. You’ll learn: * How PC, FCI, and RFCI discover causal graphs using conditional independence tests, and what assumptions each one makes. * How to encode domain knowledge as hard constraints, so the algorithm stops producing edges that are statistically plausible but practically nonsensical. * How LLMs can review and refine the output graph, resolving ambiguous orientations with domain reasoning when the data runs out of signal. By the end, you’ll have a clear picture of a three-layer pipeline that combines statistical discovery, expert constraints, and LLM review into a coherent approach to causal graph learning. If you’d rather read than listen, the full article (with diagrams, code examples, and implementation details) is available on Substack: 👉 Enjoyed this episode? Subscribe to The AI Practitioner to get future articles and podcasts delivered straight to your inbox. Get full access to The AI Practitioner at aipractitioner.substack.com/subscribe
Audio and video play straight from the show's own hosting. PodSubs stores and serves no media.
Transcript
From the show. Tap a time to play from there.
SPEAKER_00Welcome back to the AI Practitioner. I'm Lina Faik, ML Engineer, Consultant and Lecturer and Advanced Machine Learning at Sorbonne University. I help companies turn their data into real outcomes with AI and this is where I share what I learn from actual projects. The deep technical write-ups live on Substack at AIPractitioner.substack.com and these conversations are the audio companion. With me today is Mark, who's been pushing back on my drafts for a while now.
SPEAKER_00He's a senior data scientist, sharp on the practical side, and exactly the right person to keep me honest. Mark, welcome!
SPEAKER_01Happy to be here. So what's on the table today?
SPEAKER_00Okay, picture this. Six months ago, I'm in a meeting with a client. The forecast model works, the error metrics are good, everyone's happy. Then sales come in well below what we predicted and the head of operations asks me, okay, so why? And what do we do about it next quarter? And I had no real answer.
SPEAKER_01Ouch.
SPEAKER_00Yeah. And that's the moment that pushed me into causal discovery.
SPEAKER_01Hold on, though. You had a working forecast. The error was in the normal range. You could have just said the model captured the trend. This quarter was an outlier. Here's the updated forecast. That's a real answer.
SPEAKER_00It feels like one, but it isn't. A forecast tells you what's likely to happen if conditions stay roughly the same. It doesn't tell you why sales dropped and it doesn't tell you what to change. Was it a pricing decision? A competitor move? A stockout we caused ourselves? The forecast model can't see any of that. It just updates and moves on.
SPEAKER_01Hmm. Okay, that's fair.
SPEAKER_00And that's the gap. The business doesn't just want a number for next quarter. They want to know which liver to pull. Prediction models are trained on the system as it run. They don't tell you what happens when you change it.
SPEAKER_01So what does?
SPEAKER_00Causal models. The article zooms in on a family called constraint-based algorithms. The idea is to learn the actual structure of how variables influence each other from data. So when you intervene, you can reason about what cascades.
SPEAKER_01And constraint-based, what's the constraint?
SPEAKER_00Statistical independence. The intuition is simple. If two variables aren't causally connected, then once you know the right intermediate variable, the relationship between them disappears. So you start with everything connected to everything, and you progressively rip out edges where the data tells you the relationship is explained by something else.
SPEAKER_01Process of elimination.
SPEAKER_00Exactly. Classic example, smoking, tar in the lungs, and cancer. Smokers have more cancer, but once you know how much tar is in someone's lungs, smoking gives you no extra information about their cancer risk, so smoking and cancer aren't directly connected. The path goes through tar.
SPEAKER_01So the algorithm picks that up just by testing those independencies?
SPEAKER_00Right. The classic version is the PC algorithm. It runs the tests, builds up a skeleton, and then there are rules for orienting the edges. I'll skip the orientation logic on Mike, it's called Meek Rules, and the article walks through it step by step.
SPEAKER_01Got it. So you run PC on a real data set. Does it just work?
SPEAKER_00Ha. No.
SPEAKER_01I had a feeling.
SPEAKER_00I ran PC on the Adult Census Income dataset. Demographic and socioeconomic variables. Age, sex, education, occupation, hours worked, income. Stuff anyone in industry has seen.
SPEAKER_01Classic dataset.
SPEAKER_00I got back a graph that looked plausible at first glance. Education connects to occupation and income. Age connects to hours and income. Fine. But then I looked closer and there were arrows like income causing sex.
SPEAKER_01Income causes sex?
SPEAKER_00Yeah.
SPEAKER_01That's not great.
SPEAKER_00Sex is determined at birth. Earnings cannot cause it. And there were a few of these. Marital status causing education level. Hours per week causing education. All structurally impossible if you think about time.
SPEAKER_01So the algorithm just got it wrong.
SPEAKER_00Not exactly. It's not a bug. PC is purely statistical. It has no notion of time, no notion of biology, no notion of what's fixed at birth versus what changes over a lifetime. From the data alone, sex causing income and income causing sex look the same. When the data can't decide, the algorithm picks one. Sometimes it picks the absurd one.
SPEAKER_01Honestly, the first time someone showed me an output like that, I assumed they'd flipped a sign somewhere. It didn't occur to me that the algorithm was doing exactly what it was supposed to do.
SPEAKER_00That's the trap. It looks like a bug, but it's the design. And it's exactly why causal discovery on real data needs a human in the loop, or at minimum, real domain knowledge encoded somewhere.
SPEAKER_01Okay, so how do you fix it?
SPEAKER_00Two ways. And they stack. The first is hard constraints. You tell the algorithm, these variables are immutable. Nothing can cause them. So I added a rule that no edge can point into age or sex. Rerun PC. The absurd arrows disappeared.
SPEAKER_01That's almost too easy.
SPEAKER_00For temporal stuff, it is. If you know education comes before occupation, you encode that. The library has a clean API for it.
SPEAKER_01Alright. What's the harder problem?
SPEAKER_00Hidden confounders. PC assumes that every common cause of any two variables in your data is also in your data. That assumption is almost always wrong.
SPEAKER_01Yeah, it has to be. There's always something you didn't measure.
SPEAKER_00Exactly. In the census data, family wealth, neighborhood, parental education, all of these influence both education and income. None of them are in the dataset. And PC has no way to express that uncertainty. It just draws a direct edge between education and income because the correlation is strong.
SPEAKER_01It can't say, by the way, this might actually be something I can't see.
SPEAKER_00Right. There's a sister algorithm called FCI that can. It uses extra edge marks to flag when an edge might be confounded by something hidden.
SPEAKER_01So FCI is more honest about what it doesn't know.
SPEAKER_00Good way to put it. There's also a faster approximation called RFCI for larger graphs and PCMCI for time series. I won't unpack all the edge mark notation here. The article has a comparison table.
SPEAKER_01Okay, so we've got PC, we've got FCI, we've added domain constraints. Where do LLMs come in? The title made me think LLMs were doing something central.
SPEAKER_00This is where it gets interesting. After you run FCI with hard constraints, you still end up with edges the algorithm couldn't fully orient, marked with circles on both ends. The data plus your constraints aren't enough to decide.
SPEAKER_01Leftover Ambiguity Always! And that's the natural place to bring in domain knowledge that's softer than a hard constraint.
SPEAKER_00Take marital status and household relationship. The algorithm leaves that ambiguous. But if you think about it for two seconds, marital status determines household role, not the other way around. That's the kind of judgment a human reviewer makes in five seconds. But it doesn't fit naturally as a hard constraint across every dataset.
SPEAKER_01And this is where you started using LLMs?
SPEAKER_00Right. The setup is straightforward. You take the unresolved edges from FCI. You give the LLM a description of each variable and the available options. You ask it to decide, keep, remove, reverse, or orient. The output is structured. An action, a confidence level, a short justification.
SPEAKER_01Okay, I'm going to push on this. Isn't running multiple LLMs over your edges just expensive theater? It sounds rigorous, but at the end of the day, it's a model guessing.
SPEAKER_00That's a fair pushback. And honestly, that's exactly the worry I had going in. Here's what I actually saw. On things with clear temporal logic, education before occupation, marital status before household role, the LLMs do well. With reasoning that makes sense. On contested edges, they're overconfident. The confidence scores are self-reported and not calibrated. You can't take them at face value.
SPEAKER_01So what do you actually trust?
SPEAKER_00A few things. The justification text is more diagnostic than the confidence number. If the reasoning is circular or vague, that's a signal regardless of what the model says about its own certainty. And running multiple frontier models from different providers, looking at where they agree and where they disagree, gives you real signal.
SPEAKER_01I want to believe that, but I've seen multiple models converge on the same wrong answer plenty of times, especially when the wrong answer is the obvious one from pre-training.
SPEAKER_00You're right, and that's a real failure mode. Convergence isn't proof, it's evidence. The way I treat it, if three models converge with similar reasoning and the reasoning makes domain sense, I lean in. If they converge but the reasoning is generic, I treat it as suspicious. The reasoning has to do work.
SPEAKER_01Okay, that lands better. It's not let the model decide, it's use the model as one input into a process that already has statistical and human checks.
SPEAKER_00That's exactly the framing in the article. The LLM is a soft prior. It complements the statistical engine. It doesn't replace it.
SPEAKER_01Alright, one more thing. We've been talking like this is a finished pipeline, but you ran this on census data. How does it hold up on the messy proprietary data we actually have at work?
SPEAKER_00It gets harder. Constraint-based algorithms assume your independence tests are reliable. On small samples or weird distributions, they're noisy. The choice of test matters too. Chi-squared for discrete, Fisher-Z for continuous Gaussian, kernel-based for nonlinear. The article has a section on choosing the right ones.
SPEAKER_01And the LLM piece. You said it's reliable on common variables and brittle on niche ones. Most of my features are pretty niche.
SPEAKER_00That's the real limitation. The fix is to give the LLM rich context. Variable definitions, units, what the column actually means in your business. The more grounded the prompt, the less the model falls back on generic associations. But on truly proprietary stuff, treat the LLM as a starting point for a human reviewer, not a replacement.
SPEAKER_01Okay, so if I'm sitting at my desk Monday morning and I want to try this on my own data, where do I start?
SPEAKER_00Start small. Pick a slice of your data where you already have strong domain intuition. Run PC. Look at where the graph surprises you and ask whether the surprise is real or whether it's the algorithm missing context. Then add hard constraints for the things you're sure about. Then bring in the LLM layer for the residual ambiguity. The full breakdown, the code, the prompts, the decision schema is on AIPractitioner.substack.com. Links in the caption.
SPEAKER_01GitHub repo too?
SPEAKER_00Linked from the article.
SPEAKER_01Perfect. Lina, this was great.
SPEAKER_00Thanks, Mark. The thing I'd leave people with is this. Causal discovery isn't a one-shot thing where you press a button and get a true causal graph. It's a layered process. Statistics handles what statistics can handle. Domain knowledge handles what statistics can't. And LLMs sit in between as one more source of structured input. The interesting work happens at the seams. That's the practitioner's job. That's the part no algorithm does for you.
Prefer reading instead? The full article is available here. The podcast is also available on Spotify and Apple Podcasts. Subscribe to keep up with the latest drops. What if AI agents could learn from every interaction...
Prefer reading instead? The full article is available here. The podcast is also available on Spotify and Apple Podcasts. Subscribe to keep up with the latest drops. What if AI agents could continuously improve their...
Prefer reading instead? The full article is available here. The podcast is also available on Spotify and Apple Podcasts. Subscribe to keep up with the latest drops. What if AI agents could improve their own prompts...
Prefer reading instead? The full article is available here. The podcast is also available on Spotify and Apple Podcasts. Subscribe to keep up with the latest drops. What if the key to better AI agents isn’t writing...
Prefer reading instead? The full article is available here. The podcast is also available on Spotify and Apple Podcasts. Subscribe to keep up with the latest drops. What if improving an AI agent’s performance had less...