Amazon Scientist Links LLMs to Econometric Tools for Causal Tasks

LLMs in Causal Inference With Amazon — Ai4

Ai4

Large language models fail at quantitative treatment estimation unless paired with specialized statistical libraries, while interventional causal methods allow researchers to isolate and diagnose the internal mechanisms driving model hallucinations.

AI-assisted summary of LLMs in Causal Inference With Amazon — original source. Check the original for full context.

Source published:

Detailed notes

## Background Published on YouTube by the channel Ai4 on August 26, 2025, this talk features Abhimanyu Mukerji, Manager of Economics & Applied Science at Amazon. According to the page description, the session explores how large language models (LLMs) and generative AI can be applied to causal inference, while also demonstrating how causal methodologies can enhance the explainability, robustness, and enterprise value of LLMs.

## TL;DR Mukerji contrasts predictive machine learning with causal inference, framing observational causal problems around the Rubin Potential Outcomes Framework and missing counterfactuals. He details how LLMs can transform unstructured text into structured features and assist in causal discovery, though he cautions that models often act as 'causal parrots' and struggle with combinatorial graph complexity or high-dimensional numerical estimation. To overcome these direct estimation limits, he advocates pairing LLMs as orchestration layers with specialized causal libraries like EconML or DoWhy. Finally, he demonstrates how viewing transformer architectures as structural causal models enables interventional techniques, mediation analysis, and parameter tracing to debug hallucinations and perform principled model pruning.

## Atmosphere & style The presentation carries the practical, grounded tone of an applied enterprise scientist speaking candidly to a technical conference audience. Mukerji establishes an approachable, pedagogical rapport from the opening show of hands, demystifying econometric rigor without resorting to hype or academic pretension. It feels pragmatic and methodologically disciplined—consistently puncturing generative AI overpromising by highlighting combinatorial bottlenecks, numerical estimation failures, and the necessity of specialized statistical tooling during both the structured slides and the thoughtful audience Q&A.

## Key takeaways - [00:00](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=0s) Causal inference differs fundamentally from predictive machine learning by identifying the direct counterfactual impact of an intervention rather than relying on correlation patterns. - [03:43](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=223s) Under the Rubin Causal Model, causal inference is fundamentally a missing data problem because counterfactual outcomes for treated units remain unobservable. - [06:45](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=405s) LLMs provide unique value in econometrics by extracting variables from unstructured textual data and automating feature engineering to limit researcher degrees of freedom. - [10:10](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=610s) Contextual narratives enable LLMs to assist causal discovery, but models risk behaving as 'causal parrots' by regurgitating pretraining priors rather than inferring true data-generating processes. - [12:58](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=778s) While fine-tuned LLMs achieve 90% accuracy on isolated pairwise causal benchmark decisions, accuracy drops sharply when tasked with inferring full, combinatorially complex causal graphs. - [15:37](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=937s) Enterprise decision-making requires causal estimation metrics (like ATE and CATE) to quantify effect magnitudes rather than relying solely on directional causal discovery. - [17:34](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=1054s) Standalone LLMs collapse on quantitative estimation and high-dimensional spaces, requiring an orchestration architecture paired with specialized libraries like EconML and DoWhy. - [23:28](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=1408s) Causal sensitivity and counterfactual analysis offer principled paths for transformer pruning and interpretability where correlation-based saliency methods fall short. - [27:59](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=1679s) Formulating transformer architectures as Directed Acyclic Graphs allows practitioners to apply Judea Pearl's do-calculus to intervene directly on internal attention heads and activations. - [30:01](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=1801s) Mediation analysis decomposes prompt effects into direct and mediated internal activation pathways, providing a structured mechanism for debugging model hallucinations. - [36:37](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=2197s) The most effective enterprise workflow uses LLMs to parse qualitative domain knowledge and structure feature spaces, while offloading numerical causal estimation to dedicated statistical engines.

## Detailed walkthrough ### [00:00](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=0s) Introduction: Prediction vs. Causal Inference

Abhimanyu Mukerji opens the session by taking a quick show of hands from the audience to gauge their familiarity with causal inference and its underlying modeling frameworks. Seeing that causal inference is completely new to the vast majority of attendees, he assures the room that this is entirely fine and outlines the two-way goal of the presentation: exploring how large language models (LLMs) and generative AI can solve key problems in causal inference, and conversely, how traditional causal methods can be applied back to transformer architectures to make LLMs more explainable, robust, and generalizable.

He emphasizes that causal inference represents a fundamentally different paradigm from prediction, which is where "99% of ML and AI has generally been applied towards" and where Gen AI is currently concentrated. While prediction models focus on estimating outcomes based on correlations, causal inference revolves around understanding the direct impact of an intervention or treatment on a population of interest—akin to A/B testing or randomized controlled trials (RCTs). In digital contexts like web pages or apps where experiments can be run directly, determining treatment effects is relatively straightforward. However, outside of controlled experiments, businesses and researchers are forced to rely on observational data where experiments are prohibitively expensive or impossible, making it extremely difficult to establish whether a change in an outcome $Y$ is truly caused by a particular input $X$.

```mermaid flowchart TD accTitle: Causal Inference vs Predictive ML subgraph Pred["Standard Predictive ML"] P1["Input Features (X)"] -->|Correlation & Pattern Matching| P2["Predicted Outcome (Y)"] end subgraph Causal["Causal Inference Framework"] C1["Intervention / Treatment (T)"] -->|Identifiable Causal Effect?| C2["Potential Outcomes (Y(1) vs Y(0))"] C3["Confounders / Observational Data"] -.->|Distorts| C1 C3 -.->|Distorts| C2 end ```

- **Observational Data Challenges**: Moving beyond A/B tests introduces non-random assignment, making it hard to separate true causal effects from spurious correlation. - **Traditional Requirements**: Classical statistics and econometrics demand structured formats like panel data (tracking the same units over multiple time periods) alongside specialized identification methods like instrumental variables (IV) or satisfying the backdoor criterion in causal DAGs. - **New Opportunities with LLMs**: Foundation models bring textual data capabilities and agentic causal workflows into econometrics.

---

[03:43](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=223s) The Rubin Potential Outcomes Framework as a Missing Data Problem

Mukerji introduces the dominant paradigm used by causal practitioners: the Rubin Causal Model (Potential Outcomes Framework). In this setup, an outcome variable $Y$ for any given unit (a customer, user, or patient) exists across two potential states depending on a binary treatment $T \in \{0, 1\}$: the outcome under treatment ($Y(1)$) and the outcome under control ($Y(0)$).

Framing causal inference through potential outcomes transforms the challenge into a fundamental problem of missing data. If an individual receives a treatment ($T=1$), such as a new medicine, marketing campaign, or updated web interface, only $Y(1)$ is observed, while their counterfactual outcome under control ($Y(0)$) remains completely unobservable. In randomized experiments, random assignment ensures that treatment and control groups remain balanced and comparable across their distribution. In observational settings, however, treated and untreated units often systematically differ. Traditional econometric techniques and machine learning approaches attempt to bridge this gap by predicting or imputing the unobserved counterfactual state so researchers can calculate the average treatment effect (ATE) or conditional treatment effects.

| Method Category | Common Techniques | Primary Role in Causal Inference | |:--- |:--- |:--- | | **Weighting & Matching** | Inverse Propensity Weighting (IPW), Propensity Score Matching | Balances observed covariates across treatment and control groups | | **Semi-Parametric ML** | Double Machine Learning (DML) | Uses predictive ML models for nuisance parameters while preserving root-$N$ inference | | **Structural Modeling** | Directed Acyclic Graphs (DAGs), Structural Equation Models (SEMs) | Encodes domain knowledge and explicit causal pathways to satisfy identification criteria |

---

[06:45](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=405s) Why Integrate LLMs into Causal Frameworks?

Mukerji addresses the natural skepticism about why LLMs belong in causal inference, noting that standard Gen AI concepts like RAG or vector search do not immediately seem applicable to structural econometrics. He breaks down four major functional categories where LLMs add unique value:

1. **Unstructured Textual Data Extraction**: Immense causal signal is locked in unstructured free text—such as experiment documentation, user reviews, logs, or corporate qualitative notes—which LLMs can extract and transform into usable structured variables. 2. **Automating Feature Engineering & Reducing Subjectivity**: Constructing features from complex panel data traditionally requires deep domain expertise. However, human specification introduces subjectivity, where researchers may tweak feature definitions to suit their own objective functions. LLMs can systematically automate feature generation, effectively "limiting the researcher degrees of freedom." 3. **Reasoning and Counterfactual Prompting**: Foundation models can be prompted to reason about experimental designs, data structures, and counterfactual questions ("what would happen if we executed intervention X?"). 4. **Model Explainability and Translation**: Once causal models are estimated, LLMs can articulate the underlying mechanisms, interpreting estimated parameters and statistical assumptions for non-technical business stakeholders.

---

[09:04](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=544s) Causal Discovery and Graph Disentanglement

Mukerji transitions to the specific problem of **causal discovery**, which involves learning the underlying causal graph and identifying the directional arrows between variables directly from data. A central challenge here is separating true causal relationships from simple correlation.

He illustrates this with a classic confounding thought experiment: if an underlying variable $A$ causes both $B$ and $C$, then $B$ and $C$ will appear strongly correlated in observational data, even though neither variable exerts any causal effect on the other ($B \not\to C$ and $C \not\to B$). While this distinction is obvious when the true data-generating process is known, deducing directional arrows purely from observational covariance is an exceptionally difficult computational and statistical problem that classical causal discovery algorithms have historically struggled to resolve without strong parametric assumptions.

```mermaid flowchart LR accTitle: Confounding Example in Causal Discovery A["Common Cause (A)"] -->|Causes| B["Observed Variable (B)"] A -->|Causes| C["Observed Variable (C)"] B -.-|Spurious Correlation Only| C ```

[10:10](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=610s) Enhancing Traditional Causal Discovery with Problem Context

Traditional causal discovery relies on a spectrum of classical statistical methods, but each carries distinct practical drawbacks. Constraint-based algorithms run statistical hypothesis tests for conditional independence between variables to rule out edges where two features are unlikely to be causally linked. Alternatively, score-based methods simulate data over candidate causal graphs to determine which topology best fits the observed data, while semi-parametric approaches enforce functional assumptions—such as linearity in conditional relationships—to make estimation computationally tractable. These classical frameworks are notoriously hard to scale and remain intensely fragile to how features are parameterized and structured.

```mermaid flowchart TD accTitle: LLM-Assisted Causal Discovery and the Causal Parrot Risk subgraph InputContext["Input & Context"] A["Metadata & Rich Descriptions<br/>(e.g., Clinical trial drug history)"] B["Tabular Observational Features"] end

subgraph Reasoning["Causal Reasoning Engine"] C["LLM Contextual Interpretation"] D{"Reasoning Mode"} E["Grounded Causal Discovery<br/>(Contextual Variable Links)"] F["'Causal Parrot'<br/>(Memorized Pretraining Priors)"] end

A --> C B --> C C --> D D -->|Utilizes Prompt Context| E D -->|Over-relies on Training Data| F ```

Large language models offer a way to break through these limitations by incorporating semantic problem context that cannot easily be reduced to standard feature matrices. In a clinical trial setting, for instance, a researcher can supply detailed narrative paragraphs describing a drug's mechanism, expected physiological behavior, and historical side-effect profiles of related compounds. While a conventional tabular pipeline struggles to assimilate that unstructured domain knowledge, an LLM can ingest the narrative alongside a causal discovery framework to reason through expected patient outcomes. The challenge closely mirrors retrieval-augmented generation (RAG): ensuring the model grounds its inferences in the supplied metadata rather than acting as a "causal parrot," regurgitating pretraining priors that may be entirely irrelevant to the specific problem setting.

- Classical constraint-based models prune causal links via conditional independence tests. - Score-based methods evaluate and score candidate directed acyclic graphs against observed data. - Semi-parametric models enforce mathematical restrictions (e.g., linear conditional interactions) to achieve computational tractability. - LLM ingestion of rich textual background enables reasoning over interactions that traditional structured features cannot represent.

---

[12:58](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=778s) Pairwise Link Benchmarks and the "Causal Parrot" Fallacy

Evaluating LLM performance on causal discovery exposes sharp contrasts between toy benchmark tasks and realistic structural modeling. When presented with narrative scenario benchmarks from recent literature, models are tasked with determining the causal orientation between pairs of variables. Because any given pair can only exhibit three potential states—no causal link, variable A causing B, or variable B causing A—the benchmark operates within a heavily constrained decision space. Base models display erratic performance across benchmarks, but task-specific fine-tuning dramatically closes the gap: base Mistral models benchmarked at approximately 75% accuracy jump to roughly 90% accuracy once fine-tuned on relational task structures.

```mermaid flowchart LR accTitle: Degradation from Pairwise Causal Discovery to Full Graph Inference A["Pairwise Identification<br/>3 discrete states: A→B, B→A, None<br/>Accuracy: ~75% - 90%"] -->|Scale to all pairs| B["Full Graph Discovery<br/>Combinatorial Edge Selection<br/>Substantial Performance Drop"] ```

However, pairwise accuracy masks fundamental scaling limitations. When models are evaluated on standardized causal datasets like COPA and e-CARE, asking the model to construct an entire causal graph rather than score isolated pairs causes accuracy to degrade significantly. The combinatorial complexity of selecting the correct subset of active edges from all possible variable pairs overwhelms the model. While extensive domain context and prompt optimization reliably elevate benchmark numbers, assembling that context requires deep human expertise. Consequently, an LLM tuned to infer graphs within one specialized domain cannot easily transfer that causal competence to an adjacent discipline.

- In simple pairwise discovery, models choose between only three states: no edge, forward direction, or reverse direction. - On standard benchmarks, fine-tuning improves Mistral's pairwise edge accuracy from 75% to 90%. - Performance drops sharply when models shift from isolated pairwise evaluations to inferring complete, end-to-end causal graphs. - High-performing causal discovery prompts require intensive, domain-specific contextual framing that limits cross-domain portability.

---

[15:37](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=937s) Moving Beyond Discovery to Causal Estimation

Identifying whether a causal link exists is only the preliminary half of the problem; real-world decision-making hinges on causal estimation—quantifying the precise magnitude of the effect. In enterprise environments, directional intuition is practically useless on its own: "Let's say that you ran a very expensive marketing campaign... I could tell you that you have generated some lift and that's not going to be very useful to you. What you really want to know is was it 5%, 15% or 50%." To make capital allocation decisions, teams must compute statistical measures such as the Average Treatment Effect (ATE) to evaluate population-wide lift, or the Conditional Average Treatment Effect (CATE) to isolate heterogeneous treatment impacts across specific user segments.

Beyond estimating treatment effects from user data, causal estimation is becoming a cornerstone of deep learning explainability. Engineers increasingly rely on causal methods to dissect network behavior: measuring how outputs vary when specific input tokens change, determining what occurs when internal layer connectivity is altered, or observing the impact of modifying loss functions and optimization routines. Before delving into deep model explainability, however, the immediate operational hurdle remains deploying LLMs to estimate grounded treatment effects from observational data.

- Directional causal discovery answers whether an effect exists; causal estimation quantifies its magnitude. - Key target metrics include the Average Treatment Effect (ATE) for population impact and Conditional Average Treatment Effect (CATE) for subgroup heterogeneity. - Causal estimation methods also serve as an interpretability framework for deep learning architectures by analyzing model behavior under structural and hyperparameter perturbations.

---

[17:34](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=1054s) Structural Limitations and Tool-Augmented Estimation

Although fine-tuned LLMs augmented with structured prompts exhibit genuine causal reasoning traits, applying them directly to quantitative statistical estimation introduces severe architectural hurdles. A standalone language model cannot compute rigorous treatment statistics internally. Instead, it must serve as an orchestration layer paired with dedicated causal computing libraries—such as EconML or DoWhy:

```mermaid flowchart TD accTitle: Causal Estimation Architecture and Tool Orchestration subgraph Orchestrator["LLM Orchestration Layer"] L["Language Model Agent"] D{"Estimator Selection"} end

subgraph CausalEngines["Statistical Estimation Libraries"] CF["Causal Forests<br/>(e.g., EconML)"] CDL["Causal Deep Learning<br/>(e.g., DoWhy)"] end

subgraph HighDimScale["Dimensionality Bottleneck"] G["10,000+ Feature Spaces<br/>(Genomics & Biology)"] Fail["Unbounded Hallucination & Failure"] end

L --> D D -->|Algorithmic Structuring| CF D -->|Algorithmic Structuring| CDL G -.->|Unstructured LLM Execution| Fail ```

Selecting the correct statistical library and configuring the estimator—whether that requires parameterizing a causal forest or setting up a causal deep learning architecture—demands rigid algorithmic constraints. Without guardrails, the model defaults to testing random statistical configurations, introducing subtle hallucinations into the output.

Furthermore, LLMs collapse when confronted with massive feature spaces. While an LLM can parse intuitive causal pairs across a dozen variables, it cannot reliably map relationships across datasets with 10,000 continuous features, a dimensionality standard in biological and genomic applications. Empirical benchmarks underscore these weaknesses: on synthetic benchmarks featuring 10,000 ground-truth causal graphs, unassisted LLMs score barely above 60% accuracy, frequently performing worse than elementary natural language processing baselines unless constrained by meticulous prompt engineering and external estimation tooling.

- Direct statistical estimation requires pairing the LLM with specialized Python causal libraries such as EconML or DoWhy. - LLMs struggle to independently determine whether an empirical question requires a causal forest or a causal deep learning model without rigorous system constraints. - High-dimensional settings (such as biology and genetics datasets exceeding 10,000 features) exceed current LLM causal mapping abilities. - On benchmark evaluations across 10,000 ground-truth datasets, unassisted LLM causal estimation hovers around 60% accuracy, falling behind traditional NLP baselines.

[20:10](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=1210s) Prompting, Knowledge Bases, and Tracing LLM Behavior

The underlying knowledge base and targeted fine-tuning remain crucial for detecting causal links, but strategic prompting can significantly boost model performance. This mirrors broader generative AI dynamics: effective prompt engineering often dictates whether an application succeeds. Beyond basic performance tuning, sensitivity analysis—evaluating how model outputs shift in response to varied inputs—provides deep insight into how generative systems reason.

One primary application is tracing generative AI behavior back to internal model mechanics. When an algorithm surfaces an association between two concepts—such as linking the "Eiffel Tower" directly to "Paris"—understanding which sub-components of the network generate that specific factual connection is essential. Research into the GPT family of models demonstrates that factual associations are often localizable to specific parameters and layers. Identifying these localized sub-networks allows practitioners to perform surgical, highly efficient parameter updates tailored to specific domain tasks without retraining the entire model.

A parallel challenge appears in mathematical reasoning, where large language models notoriously struggle with basic arithmetic. While scaling model size generally improves performance, simply increasing parameter counts is neither a sustainable nor a universally extensible strategy. Instead, analyzing causal sensitivity—such as tracing which internal parameters show high variance when modifying an input from "1+1" to "1+2"—reveals the specific architectural choke points that cause models to stumble.

- **Localized Parameter Tuning**: Tracing localized sub-networks in GPT models enables targeted parameter adjustments, drastically reducing computational overhead compared to broad fine-tuning. - **Arithmetic Sensitivity**: Analyzing parameter variance across subtle input perturbations (e.g., swapping single arithmetic operands) helps isolate the exact components driving reasoning errors.

---

[22:20](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=1340s) The Problem of Causal Attribution in Large Language Models

Determining which specific internal components are responsible for an observed output is a classic causal attribution problem. In traditional settings with structured data and defined features, causal attribution relies on controlled experiments where every variable is held strictly constant while a single feature is manipulated to observe its direct effect on the outcome variable $Y$.

Translating this methodology to large language models presents fundamental obstacles:

```mermaid flowchart LR accTitle: Causal Attribution Challenge in LLMs subgraph Traditional ["Traditional Structured Data"] direction TB F["Controlled Features"] -->|"Strict Ceteris Paribus"| O["Direct Outcome (Y)"] end subgraph Generative ["Large Language Models"] direction TB P["Pre-trained Priors"] --> B["Correlation/Causation Conflation"] R["RAG Context"] --> B B --> Out["Generated Response"] end ```

Pre-trained weights act as a massive, opaque confounding prior that dictates downstream behavior. Disentangling the influence of these pre-trained representations from new context introduced via retrieval-augmented generation (RAG) is exceptionally challenging. When confronted with complex prompts, models routinely default to prior statistical correlations learned during pre-training rather than genuinely reasoning through the causal dependencies presented in the prompt.

---

[23:28](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=1408s) Extending Causal Methods to Explainability and Architecture Optimization

Standard interpretability frameworks rely heavily on correlation-based feature importance metrics such as SHAP (Shapley Additive explanations). While helpful, these methods fall short of answering counterfactual questions: How would the model output change if a specific prompt feature were altered? Because language generation is inherently probabilistic, causal techniques are required to separate genuine prompt-driven causal effects from stochastic sampling noise.

Causal inference also provides a principled framework for architecture search and cost reduction. Rather than treating transformer architectures as black boxes, causal methods can evaluate the impact of modifying structural hyperparameters—such as pruning layers, removing attention heads, or consolidating feed-forward nodes. If causal sensitivity analysis proves that an output is insensitive to certain sub-networks, engineers can safely strip away model complexity, reducing operational latency and hosting costs without degrading generation quality.

- **Counterfactual Output Estimation**: Quantifies how an LLM's response would diverge under specific, isolated prompt edits. - **Stochastic Disentanglement**: Isolates whether output variations stem from probabilistic token sampling or genuine prompt interventions. - **Architectural Pruning**: Measures the causal necessity of individual attention heads, layers, and nodes to enable principled model compression. - **Data & Component Attribution**: Identifies whether a generated statement is directly traceable to specific pre-training corpora or particular transformer sub-modules.

---

[25:19](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=1519s) Benchmark Challenges: Memorization, Redaction, and Saliency Limits

Evaluating causal reasoning in language models typically involves benchmark datasets containing structured question-and-answer pairs embedded with specific causal dependencies. Researchers then manipulate these prompts to observe performance degradation. However, evaluating LLMs through static benchmarks introduces two major complications: memorization and the limitations of heuristic perturbations.

| Benchmark Challenge | Mechanism | Core Limitation | |:--- |:--- |:--- | | **Data Contamination & Memorization** | The model absorbs benchmark challenges or identical QA pairs during pre-training. | The model outputs correct causal answers via rote recall rather than dynamic reasoning. Prompting the model with partial challenges reveals high variance across phrasing. | | **Input Redaction & Perturbation** | Evaluating behavior by masking, redacting, or perturbing specific prompt segments. | It is difficult to know *ex ante* which prompt tokens are functionally relevant versus which redacting actions destroy necessary semantic context. | | **Correlation-Based Saliency** | Inspecting attention heatmaps, gradient-based saliency scores, and feature attributions. | These metrics show which tokens activate during forward passes, but fail to demonstrate whether the model would have produced a different counterfactual outcome under intervention. |

---

[27:59](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=1679s) Formulating Transformers as Causal Graphs and Interventional Systems

To overcome the shortcomings of simple prompt perturbation and correlation-based saliency, transformer inference can be formally cast as a Structural Causal Model (SCM). The prompt represents a treatment $T$, the generated text represents an outcome $Y$, and the intermediate transformer components act as internal mediating channels.

```mermaid flowchart TD accTitle: Transformer Formulated as an Interventional Causal Graph subgraph TreatmentStage ["Input Layer"] T["Prompt / Treatment (T)"] end

subgraph InternalNodes ["Transformer Architecture as Causal DAG"] E["Token Embeddings"] H1["Attention Head 1"] H2["Attention Head 2 (Intervened / Zeroed)"] FFN["Feed-Forward Sub-Layer"] end

subgraph OutcomeStage ["Output Layer"] Y["Generated Response (Y)"] end

T --> E E --> H1 E --> H2 H1 --> FFN H2 -.->|"do(Head = 0)"| FFN FFN --> Y ```

By mapping the transformer architecture directly into a Directed Acyclic Graph (DAG), each internal module—token embeddings, multi-head attention blocks, and feed-forward layers—functions as an explicit node. Rather than treating internal activations as a passive forward stream, researchers can apply Judea Pearl’s *do-calculus* to intervene at arbitrary intermediate stages.

Practitioners can hold specific token embeddings constant, freeze intermediate activations, or mathematically zero out the output vectors of individual attention heads (`do(Attention Head = 0)`). Systematically applying these targeted interventions allows researchers to trace exactly how causal information propagates through internal representations, providing a mathematically rigorous foundation for model explainability and circuit discovery.

[30:01](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=1801s) Causal Discovery, Hallucination Debugging, and Graph Mediation in LLMs

Interventional methods provide a rigorous way to assess causal impacts inside a model by holding everything else constant and perturbing a single variable at a time. This technique proves invaluable for causal discovery and identifying the specific components or internal activations that drive downstream behavior. One area holding substantial potential is debugging large language model (LLM) hallucinations: when a model produces false information, analyzing activation patterns helps identify which pathways drove the flawed output, enabling practitioners to isolate and target specific failure modes. However, these techniques face serious computational bottlenecks. LLMs are massive, sophisticated networks; constructing the complete causal graph or running sufficient iterations to map internal components requires numerous runs, making repeatable automated workflows computationally expensive.

```mermaid flowchart LR accTitle: Mediation Analysis in LLMs accDescription: Direct and mediated causal pathways from input treatment through internal activations to output.

subgraph Inputs ["Input Layer"] T["Input / Treatment (T)"] end

subgraph Internal ["Internal Representations"] M["Activations / Mediators (M)"] end

subgraph Outputs ["Output Layer"] Y["Output / Response (Y)"] end

T -->|"Direct Effect"| Y T -->|"Mediated Effect"| M M --> Y ```

To break down transformer internals systematically, researchers treat the model architecture as a causal graph analyzed through mediation analysis. When an input is fed into the network, its influence propagates across multiple pathways, starting at an initial node and cascading through combinations of subsequent layers (such as pairs $1 \to 2$, $1 \to 3$, $1 \to 4$). By framing the input prompt as a treatment $T$, the final output as $Y$, and intermediate internal activations as mediator set $M$, researchers can decompose the total impact into the direct effect of $T$ on $Y$ and the indirect effect operating through $M$. Performing targeted interventions—holding specific activations fixed, tweaking $M$, or ablating pathways entirely—clarifies how internal mechanisms produce observed model behavior.

[32:12](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=1932s) Summary: Synergies Between Causal Inference and Generative AI

Outside of tightly controlled, narrow experimental setups, causal inference remains an exceptionally difficult problem. The strongest synergies and most fruitful research areas lie in using LLMs to ingest unstructured textual data, convert it into structured statistical representations, and feed those representations into traditional causal inference models to solve real-world industry problems.

Using LLMs for causal discovery shares risks comparable to retrieval-augmented generation (RAG) and fine-tuning: while models demonstrate respectable causal learning capabilities, their performance depends heavily on meticulous context-setting. Concurrently, applying causal graph estimation, perturbation, and mediation analysis offers actionable paths toward understanding why models hallucinate. As generative models are integrated into critical enterprise workflows and customer touchpoints, reducing hallucinations while boosting explainability and reliability becomes paramount.

[33:35](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=2015s) Audience Q&A: Managing Complexity and Inferring Infrastructure Graphs from Terraform

In the Q&A session, an audience member follows up on the computational bottleneck of graph intervention. The speaker notes that the combinatorial search space can be pruned significantly when addressing targeted problems, such as auditing bias or ensuring strict adherence to prompt context. Because only a subset of network regions activate in response to specific prompt alterations, developers can focus interventions solely on sensitive sub-networks rather than the entire model, even if a universal graph mapping remains intractable.

Another attendee asks how causal techniques could help infer infrastructure dependency graphs directly from Terraform code (such as determining the causal dependency between a provisioned virtual machine and an attached disk), pointing out that raw LLM prompting causes frequent hallucinations. The speaker explains that LLM reasoning benchmarks rely on domains with established scientific ground truth (like ecology or biology), where the model leverages rich background literature.

For technical domains like Terraform code: - General pretraining corpora often contain noisy discussions, which degrades deterministic reasoning. - Reliable graph extraction requires supplying a highly specific, curated domain knowledge base via targeted context or RAG. - Practitioners must benchmark how sensitive the model is to pretraining noise before relying on raw outputs.

[36:37](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=2197s) Audience Q&A: Missing Counterfactuals and Text-Assisted Causal Estimation

An attendee asks about using LLMs to infer counterfactuals in episodic settings—such as medical treatments where the factual outcome under treatment $T_1$ is observed, but the counterfactual outcome without treatment is unknown. The question centers on whether an LLM can serve as a repository of world knowledge ("the internet in a box") to provide probabilistic estimates for unobserved potential outcomes.

The speaker explains that LLMs excel at qualitative, narrative-level extrapolations (e.g., describing typical disease progression over successive days from clinical histories when a drug is withheld), but fail when tasked with precise quantitative estimation:

| Dimension | LLM Performance | Recommended Methodology | |:--- |:--- |:--- | | **Qualitative / Episodic Logic** | High | Use LLM over a structured domain knowledge base to map general causal relationships and patient timeline narratives. | | **Numerical Trajectories & Quantified Effects** | Low (High Hallucination) | Avoid direct numerical estimation in prompts; LLMs struggle to quantify exact physiological metrics (e.g., exact daily temperature shifts). | | **Hybrid Workflow (Optimal Approach)** | Robust | Use the LLM to extract structural relationships from text, select the relevant feature space (temperature, drug status, physiological markers), and pass those features into a dedicated statistical causal model for estimation. |

[39:26](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=2366s) Integrating Autoregressive Priors and LLMs in a Bayesian Framework

Addressing an audience question about combining language models with autoregressive or probabilistic methods, Abhimanyu Mukerji candidly admits that he is not personally aware of practitioners using this setup in production and has not encountered a specific application for it in practice. However, he explores how the concept could function theoretically under a Bayesian lens. In such a conceptual setup, an autoregressive framework or external statistical model could establish the baseline prior distribution.

The LLM could then ingest contextual domain signals or unstructured text to inject additional information into the model. By combining the model-derived prior with the contextual evidence contributed by the language model, one could update the beliefs and calculate a posterior distribution over the parameters or target outcomes. While Mukerji remarks that "that might work" in principle as a valid Bayesian formulation, he caveats his thoughts by emphasizing that he has no firsthand empirical experience implementing or testing such an architecture.

```mermaid flowchart LR accTitle: Bayesian Updating with an LLM subgraph S1["Prior Estimation"] A["Autoregressive / External Model"] --> B["Prior Distribution"] end subgraph S2["Evidence Integration"] C["LLM Contextual Data"] end subgraph S3["Inference"] B & C --> D["Posterior Distribution"] end ```

- **Theoretical Bayesian formulation**: An autoregressive baseline generates the initial prior, while the LLM contributes supplemental qualitative or contextual conditioning data. - **Practical caveats**: Despite the theoretical viability of calculating a posterior from an LLM-augmented prior, Mukerji notes that real-world use cases remain untested in his direct experience.

## Notable quotes > [00:00](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=0s) 99% of ML and AI has generally been applied towards — Abhimanyu Mukerji

> [06:45](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=405s) limiting the researcher degrees of freedom — Abhimanyu Mukerji

> [10:10](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=610s) causal parrot — Abhimanyu Mukerji

> [15:37](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=937s) Let's say that you ran a very expensive marketing campaign... I could tell you that you have generated some lift and that's not going to be very useful to you. What you really want to know is was it 5%, 15% or 50%. — Abhimanyu Mukerji

> [20:10](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=1210s) Eiffel Tower — Abhimanyu Mukerji

> [20:10](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=1210s) Paris — Abhimanyu Mukerji

> [27:59](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=1679s) do(Head = 0) — Abhimanyu Mukerji

> [36:37](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=2197s) the internet in a box

> [39:26](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=2366s) that might work — Abhimanyu Mukerji

## Mentioned Abhimanyu Mukerji, Amazon, Ai4, Rubin Causal Model, EconML, DoWhy, Mistral, COPA, e-CARE, GPT, SHAP, Judea Pearl, Terraform

## Video description Abhimanyu Mukerji, Manager, Economics & Applied Science, Amazon

Abstracts

LLMs and Gen AI have compelling applications to problems in causal inference, and recent improvements in benchmark models have increased the potential for synergies between these modeling paradigms. There are also opportunities to use causal methods to make LLMs more explainable and robust. This talk will provide an overview of research in this area, and discuss how these methods can be used to solve major business problems.

[Source](https://www.youtube.com/watch?v=XJHtZWZo3RU)

中文简报

亚马逊科学家将大语言模型与计量经济工具结合以处理因果任务 大语言模型在定量处理效应估计上表现欠佳,除非与专用统计库配合使用;而干预性因果方法使研究人员能够隔离并诊断导致模型幻觉的内部机制。 Mukerji对比了预测性机器学习与因果推断,围绕鲁宾潜在结果框架与缺失反事实阐明了观测因果问题。他详细说明了大语言模型如何将非结构化文本转化为结构化特征并协助因果发现,但同时提醒模型往往表现得像“因果鹦鹉”,难以应对复杂的组合因果图或高维数值估计。为克服直接估计的局限,他主张将大语言模型作为编排层,与EconML或DoWhy等专业因果库结合使用。最后,他展示了将Transformer架构视为结构因果模型如何支持利用干预技术、中介分析和参数追踪来调试幻觉,并实施有原则的模型剪枝。 因果推断不同于依赖相关性的预测型机器学习,它聚焦于量化干预的直接反事实影响;在鲁宾潜在因果框架下,由于受试单元的反事实状态不可观测,其本质上是一个缺失数据问题。 (0:00) 大语言模型(LLM)能够提取非结构化文本并自动化特征工程以减少研究者主观自由度,但在因果发现中面临过度依赖预训练先验的“因果鹦鹉”风险,且在构建全图时准确率显著低于成对因果推断。 (6:45) 企业决策需要通过 ATE 和 CATE 等指标量化效应大小,而独立 LLM 难以直接应对定量估计及万级高维空间,必须编排 EconML 或 DoWhy 等专业因果计算库进行协同。 (15:37) 将 Transformer 建模为结构因果图并结合干预手段与中介分析,能有效拆解幻觉路径并度量内部子网络必要性,为大模型架构剪枝与可解释性提供了远优于相关性显著图的数理基础。 (27:59)

Reading summary

Abhimanyu Mukerji argues that while large language models cannot reliably perform quantitative causal estimation alone, they provide critical value by transforming unstructured text into structured representations for specialized econometric engines. Conversely, casting transformer architectures as interventional causal graphs offers a mathematically grounded framework for debugging hallucinations and auditing model internals. Potential Outcomes and Observational Data Challenges (3:43) Causal inference operates under a fundamentally distinct paradigm from conventional predictive machine learning, which Mukerji notes accounts for roughly 99% of historical AI applications. Rather than mapping correlations from input features to predicted outcomes, causal modeling evaluates the real-world impact of interventions under the Rubin Potential Outcomes Framework. This setup treats causal discovery as a missing data problem: researchers observe either the treated outcome or the control outcome for a given unit, but never both simultaneously. While randomized controlled trials balance treatment and control groups naturally, observational settings introduce confounding and non-random assignment. Classical econometrics relies on techniques like inverse propensity weighting, Double Machine Learning (DML), and Directed Acyclic Graphs (DAGs) to satisfy identification criteria across panel data. Mukerji highlights that generative AI bridges a longstanding gap in these workflows by extracting usable variables from unstructured free text—such as trial notes and customer reviews—while standardizing feature engineering to limit researcher degrees of freedom. Qualitative Discovery and the Causal Parrot Risk (10:10) Causal discovery attempts to infer directional causal relationships directly from observational data, a task classical constraint-based and score-based algorithms struggle to scale without strict functional assumptions. LLMs assist this process by parsing unstructured domain narratives that tabular models cannot interpret, such as pharmacological mechanisms in clinical trials. However, Mukerji cautions against the 'causal parrot' fallacy, where a model merely regurgitates memorized pretraining correlations rather than reasoning from contextual metadata. Benchmarks illustrate severe scaling bottlenecks when moving from simplified setups to full graphs. On pairwise evaluations, where models only distinguish between three states (no link, forward, or backward), fine-tuning raises Mistral's accuracy from roughly 75% to 90%. Yet on standardized benchmarks like COPA and e-CARE, model performance degrades sharply when constructing entire causal graphs due to combinatorial edge complexity. Furthermore, prompts requiring extensive contextual framing exhibit low portability across different technical domains. Hybrid Orchestration for Quantitative Causal Estimation (17:34) Enterprise decision-making requires estimating effect magnitude—such as Average Treatment Effect (ATE) or Conditional Average Treatment Effect (CATE)—rather than basic directional links. Standalone language models fail at direct numerical estimation, frequently hallucinating parameter configurations or generating imprecise physiological trajectories in episodic counterfactual tasks. Empirical benchmarks evaluated over 10,000 ground-truth causal graphs reveal that unassisted LLMs achieve barely 60% accuracy, lagging behind basic natural language baselines. They also collapse when handling feature spaces exceeding 10,000 continuous variables, which are common in genomics. Consequently, Mukerji emphasizes that LLMs must act strictly as orchestration layers paired with dedicated causal computing libraries like EconML or DoWhy, leaving statistical computation to causal forests and semi-parametric estimators. Auditing Transformers via Interventional Causal Graphs (27:59) Standard model interpretability approaches rely on correlation-based metrics like SHAP or attention heatmaps, which fail to establish whether specific tokens or layers causally determine an output. Mukerji advocates formulating transformer inference as a Structural Causal Model, treating the input prompt as a treatment, internal activations as mediators, and output tokens as outcomes. Using Judea Pearl's do-calculus, researchers can systematically intervene on intermediate components—such as zeroing out attention head outputs—to isolate direct versus mediated effects. This mediation analysis provides a causal foundation for diagnosing hallucinations and pruning redundant network sub-modules to lower latency and hosting costs. While mapping full graphs across billions of parameters remains computationally intractable, Mukerji notes practitioners can prune the combinatorial search space by targeting interventions only on sub-networks activated by specific prompt changes. Mukerji concludes that near-term practical value centers on hybrid workflows that combine LLM text extraction with established statistical estimation libraries. Theoretical extensions, such as updating autoregressive priors with contextual LLM signals in a Bayesian framework, remain unproven in production environments, leaving scalable mediation analysis and high-dimensional estimation as key operational hurdles.

精炼阅读摘要

Abhimanyu Mukerji 指出,大语言模型(LLM)与因果推断之间存在双向赋能空间:LLM 能够从非结构化文本中提取特征并提供语义上下文辅助因果发现,但无法独立胜任精确的量化因果估计;与此同时,利用因果图与中介分析等因果方法反哺 Transformer 架构,为模型解释性、架构剪枝与幻觉调试提供了严密的数学工具。 因果推断与预测的分野及LLM切入点 (0:00) 演讲者指出,当前 99% 的机器学习和生成式 AI 均属于预测范式,侧重于利用特征相关性预测已知结果;因果推断则关注干预或处理对目标群体的直接作用。在鲁宾潜在结果框架(Rubin Causal Model)下,因果推断本质上是一个“数据缺失问题”,即研究者无法同时观测到同一实体在接受处理与未接受处理下的潜在结果。在缺乏 A/B 测试的真实观测数据中,非随机分配会导致混杂偏差,传统计量经济学必须依赖双重机器学习(DML)、面板数据或工具变量等方法来剔除伪相关。 Mukerji 阐述了将 LLM 引入因果推断的四大核心价值:首先,LLM 能从实验记录、用户评论等非结构化文本中提取传统表格无法涵盖的因果特征;其次,通过自动化特征工程限制研究人员的主观干预,收窄“研究者自由度”;第三,可利用提示词进行反事实推演;第四,LLM 能够将复杂的因果模型假设与统计参数翻译为业务人员可理解的决策依据。 语义增强因果发现与“因果鹦鹉”局限 (9:04) 因果发现的目标是从数据中推断变量之间的有向因果拓扑图。基于独立性检验或图评分的传统统计算法不仅计算复杂度极高,而且严重依赖线性等功能假设。LLM 的核心优势在于能够吸收非结构化领域背景,例如在临床试验中理解药物作用机理与历史副作用叙述。然而,这同时带来了类似检索增强生成的风险:模型可能退化为“因果鹦鹉”,仅仅复述预训练阶段记忆的高频先验,而非根据具体上下文进行因果推演。 基准评测进一步揭示了 LLM 在因果图推理上的尺度局限。在成对变量因果方向识别任务中,因其仅涉及三种离散状态(正向、反向或无因果),经过微调的 Mistral 模型准确率可从基线的 75% 跃升至约 90%。但一旦扩展至 COPA 或 e-CARE 等完整因果图构建任务,面对全图边缘选择的组合爆炸,模型准确率会出现断崖式下跌。此外,高表现提示词高度依赖特定领域的精细设计,跨学科泛化迁移能力极弱。 量化因果估计的工具链协同与高维局限 (15:37) 在实际业务决策中,仅定性识别因果关系远远不够,核心痛点在于因果效应的定量估计。Mukerji 举例说明,告知企业营销活动带来了正向提升并无实际决策价值,企业必须明确提升幅度是 5%、15% 还是 50%,以计算平均处理效应(ATE)或异质性子群处理效应(CATE)。然而,独立的语言模型不具备计算统计估计量的能力,在定量数值轨迹与生理指标预测上极易发生幻觉。 因此,落地应用必须采用工具链架构:LLM 仅作为编排中枢,负责解析语境和挑选特征,底层的因果森林或因果深度学习算法则由 EconML 或 DoWhy 等专用 Python 库执行。一旦脱离专门工具与严格系统约束,LLM 在高维空间中极易崩溃。在包含 10,000 个因果图的基准评估中,未获工具辅助的 LLM 估计准确率仅在 60% 左右浮动,甚至落后于基础 NLP 基线,完全无法处理基因组学等动辄超过 10,000 个特征的高维场景。 借助因果图与中介分析实现模型解释优化 (27:59) 因果推断框架正被反向应用于深度学习模型的可解释性分析。传统的特征归因(如 SHAP)或注意力热力图主要基于相关性,既无法回答反事实假设,也无法剥离自回归采样带来的随机噪声。研究人员将 Transformer 推理过程形式化为结构因果模型(SCM):将输入提示词视为处理变量 T,输出文本视为结果 Y,内部的多头注意力与前馈网络层则构成中介变量集合 M。 借助 Judea Pearl 的 do-演算(do-calculus),研究人员可以直接实施干预,例如冻结特定层激活值或在数学上置零特定注意力头(如 do(Attention Head = 0)),进而通过中介分析将总体效应分解为直接效应与间接效应。这种因果分析为定位模型幻觉传播路径提供了确定性手段,并能将特定事实关联定位到具体的参数子网络中。在工程部署中,团队还可据此评估网络组件的因果必要性,在不损伤生成质量的前提下安全裁剪注意力头与前馈节点,从而降低推理延迟与托管成本。 Mukerji 总结认为,除狭窄受控的实验环境外,现实世界的因果推断依然极端复杂。目前最具确定性的实践路径在于利用 LLM 结构化非结构化文本,并交由传统计量库完成效应估计。尽管将 Transformer 建模为因果图为解释内机制与缓解幻觉开辟了新途径,但全图干预仍面临巨大的算力开销。对于将 LLM 上下文引入自回归贝叶斯框架以更新后验的设想,演讲者坦言这在理论上具有可行性,但在实际工业生产中尚无经过验证的落地范式。

Detailed notes — zh

## Background 本内容由频道 Ai4 于 2025 年 8 月 26 日发布在 YouTube 平台上,演讲人为亚马逊经济学与应用科学经理 Abhimanyu Mukerji。视频简介指出,本次演讲主要探讨大语言模型(LLM)与生成式 AI 在因果推断领域的协同应用,以及如何借助传统因果推断方法提升大模型的可解释性与鲁棒性以解决重大商业问题。 ## TL;DR 演讲系统性地梳理了大语言模型与因果推断之间的双向赋能路径。一方面,LLM 凭借强大的文本语义理解能力,能够辅助完成非结构化特征工程、因果发现并约束研究人员自由度,但在高维复杂数据和定量因果效应估计上依然严重依赖外部统计工具库。另一方面,研究人员可以通过将 Transformer 架构映射为因果图与中介分析框架,利用干预试验和反事实推断深入剖析模型的内部激活、幻觉成因及注意力机制。最终,讲者提出了定性语义理解交由大模型、数值量化与强度估计交由传统统计模型的解耦式工程落地最佳实践。 ## Atmosphere & style 整个演讲呈现出严谨、求实且极具洞察力的工业界科研风格,Mukerji 以沉稳从容的语调将深奥的计量经济学理论与前沿深度学习架构娓娓道来。现场互动自然且富有启发性,讲者不仅毫不避讳地指出现有大模型在数值计算与因果估计上的局限和硬伤,还在面对观众关于基础设施拓扑与贝叶斯融合推断等前沿工程提问时展现了极高的坦诚与专业素养。整体听感既像是一场兼具学术深度的前沿研讨课,又充满着紧扣真实业务痛点的工程落地智慧。 ## Key takeaways - [00:00](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=0s) 因果推断与绝大多数解决预测问题的机器学习范式有着本质区别,大语言模型与因果推断之间存在双向赋能的巨大潜力。 - [01:09](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=69s) 在缺乏随机对照试验的观察性数据场景中,因果推断面临严格的结构性假设约束,而大语言模型为挖掘非结构化文本及构建自动化因果 Agent 工作流带来了新契机。 - [03:43](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=223s) 基于鲁宾潜在结果框架,因果推断的核心本质是一个“缺失数据”问题,其关键在于利用模型对无法同时观测到的反事实结果进行最佳填补。 - [06:45](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=405s) 大语言模型切入因果推断的四大核心维度包括:非结构化文本挖掘、自动化特征工程以约束“研究人员自由度”、反事实逻辑推演以及自然语言可解释性输出。 - [10:10](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=610s) 传统因果发现方法面临难以大规模扩展且极度依赖特征工程的瓶颈,引入大语言模型的背景语义与非结构化文本先验能显著改善因果图谱的推断表现。 - [12:18](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=738s) 大语言模型在因果任务中存在过度依赖预训练记忆的“因果鹦鹉”风险;其在成对因果关系识别上表现良好,但在推断完整复杂因果图时性能会出现大幅下滑。 - [15:37](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=937s) 在真实业务决策中,相较于定性的因果发现,量化因果效应强度的因果估计(如 ATE 和 CATE)更具实际业务价值。 - [17:34](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=1054s) 大语言模型缺乏直接进行底层复杂统计计算的能力,且高维特征推理容易失效,若未经强力约束和针对性微调,直接进行因果估计的准确率极低(仅约 60%)。 - [22:20](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=1340s) 传统的特征归因工具(如 SHAP、注意力热力图)仅停留在相关性层面,而基于反事实的因果归因方法能够解耦模型内在随机性与架构敏感度,为模型可解释性与架构精简提供新路径。 - [27:59](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=1679s) 可以将 Transformer 架构形式化为因果有向无环图(DAG),将提示词视为处理变量、内部激活视为中介变量、输出视为结果变量,利用 do-演算与反事实干预进行机制分析。 - [30:01](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=1801s) 借助因果中介分析(Mediation Analysis)能够精准定位驱动模型幻觉与偏见的敏感网络区域,工程上通过收窄关注的子网络可在可接受的算力成本内完成因果调试。 - [36:37](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=2197s) 当前工业界落地的最佳实践是混合架构:利用大语言模型从非结构化文本中提取定性因果图谱,再将其转化为特征交由传统统计因果计量模型进行精准数值量化。 ## Detailed walkthrough ### [00:00](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=0s) 开场互动与双向视角:因果推断与预测范式的根本差异 演讲伊始,来自亚马逊(Amazon)的经济学与应用科学经理 Abhimanyu Mukerji 首先与现场观众展开了互动。他现场询问大家有多少人对“因果推断”(Causal Inference)完全陌生,或者是否有人曾在这个建模框架下工作过。现场举手的结果显示,绝大多数参会者此前并未接触过因果推断。Mukerji 随即表示这完全没有关系,并为本次演讲确立了核心主线:不仅要梳理大语言模型(LLM)与生成式 AI 在因果推断领域的关键应用场景,还要探讨其“反向赋能”——即如何将传统的因果推断方法引入 Transformer 架构中,以此提升 LLM 的可解释性(Explainability)与泛化能力(Generalizability)。 Mukerji 特别强调,因果推断与机器学习/AI 领域绝大多数人所熟知的“预测”(Prediction)在逻辑上截然不同。目前 99% 的机器学习算法以及主流的生成式 AI 落地场景,本质上都是在解决预测问题;而因果推断则关注事物之间的驱动机制与干预效果。 ```mermaid flowchart LR accTitle: 双向赋能框架:LLM 与因果推断的融合 subgraph S1["LLM 赋能因果推断"] A["非结构化文本解析"] --> B["因果发现与特征工程"] B --> C["自动化 Agent 工作流"] end subgraph S2["因果推断赋能 LLM"] D["因果图与结构建模"] --> E["注意力机制可解释性"] E --> F["模型泛化与鲁棒性提升"] end ``` ### [01:09](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=69s) 实验与观察性数据的分水岭:因果推断的严苛前提与新机遇 理解因果推断最直观的切入点就是 A/B 测试或随机对照试验(RCT)。其核心思想是对目标人群施加某种干预(Treatment / Intervention),进而评估该干预对业务或目标指标产生的实际影响。在能够低成本运行 A/B 测试的场景(例如移动应用或网页界面的改版实验)中,推断干预效果相对简单直接。然而,一旦脱离了实验环境,面对无法轻易进行随机分组的“观察性数据”(Observational Data)时,推断特定自变量 $X$ 是否真正导致了因变量 $Y$ 的变化就会变得极具挑战且成本高昂。 在计量经济学(Econometrics)和统计学的传统体系中,要在观察性数据中获得有效的因果推断,必须依赖非常严格的结构性条件。例如,研究人员通常需要使用面板数据(Panel Data),即在多个时间周期内持续追踪同一批研究单元,结合干预发生的具体时间节点及其外生变异来测算处理效应。此外,传统方法高度依赖工具变量法(Instrumental Variables, IV)或满足因果图中的“后门准则”(Backdoor Criterion)等复杂数学假设。正是在这种复杂的背景下,LLM 与生成式 AI 带来了全新的契机:一方面,现实世界中海量的数据是以自由文本(Free Text)等非结构化形式存在的;另一方面,基于 Transformer 的模型能够构建 Agent 化的自动化因果工作流。 ### [03:43](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=223s) 鲁宾潜在结果框架与因果推断的本质:“缺失数据”难题 因果推断领域最主流的理论基石是“鲁宾潜在结果框架”(Rubin Potential Outcomes Framework)。在该框架下,对于任何一个观测单元(可以是一位客户、一个活跃用户或一名临床患者),其结果变量 $Y$ 都存在两种潜在状态: $$Y = \begin{cases} Y(1), & \text{当施加干预 } T = 1 \\ Y(0), & \text{当未施加干预 } T = 0 \end{cases}$$ 将因果推断形式化为潜在结果后,其核心痛点便一目了然——**因果推断在本质上是一个“缺失数据”(Missing Data)问题**。当一个单元接受了处理(如服用了新药、看到了特定营销活动或访问了新版网页,即 $T=1$)时,研究人员只能观测到其实际结果 $Y(1)$,而永远无法直接观测到该单元在同一时刻若未接受处理时的反事实结果 $Y(0)$。 在随机对照试验中,随机分配机制能够保证处理组与对照组在统计分布上具有可比性;但在现实业务的观察性数据中,接受处理的人群和未接受处理的人群往往存在内在的选择偏差(Selection Bias),二者并不具备天然可比性。传统计量方法与现代机器学习方法在此处的思路是一致的:即利用预测模型对无法观测到的反事实潜在结果进行最佳外推与填补。一旦为每个单元同时补齐了 $Y(1)$ 与 $Y(0)$ 的估计值,便可以通过计算二者差值得出个体处理效应,进而计算平均处理效应(Average Treatment Effect, ATE)或条件平均处理效应(Conditional Average Treatment Effect, CATE)。 - **传统与现代估计工具**: - 逆倾向得分加权(Inverse Propensity Weighting, IPW) - 样本匹配法(Matching) - 双重机器学习(Double Machine Learning, DML) - 结构方程建模(Structural Modeling) ```mermaid flowchart TD accTitle: 鲁宾潜在结果框架中的反事实缺失机制 subgraph Unit["观测单元(用户 / 客户 / 样本)"] T["分配状态 T"] end subgraph Real["现实观测到的数据"] T1["T = 1(处理组)"] --> O1["观测到 Y(1)"] T0["T = 0(对照组)"] --> O0["观测到 Y(0)"] end subgraph Counterfactual["永远无法观测的反事实(缺失数据)"] T1 -.-> M0["反事实 Y(0) 缺失!"] T0 -.-> M1["反事实 Y(1) 缺失!"] end Unit --> T1 Unit --> T0 ``` ### [06:45](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=405s) 大语言模型切入因果推断的四大核心维度与“研究人员自由度”约束 对于习惯了检索增强生成(RAG)或对话问答的工程师而言,LLM 为何能融入这一套严肃的统计因果框架并不显而易见。Mukerji 将 LLM 在因果推断中的应用价值拆解为四个关键维度: 1. **非结构化文本的价值挖掘**:现实中大量关键信息潜藏在实验描述、数据元数据以及用户或企业生成的自由文本中,LLM 能将这些文本语义转化为因果模型可用的高价值变量。 2. **特征构建的自动化与去主观化**:即便面对结构化的面板数据,如何构建特征往往极大影响最终模型的估计质量。人工特征工程不仅耗时费力,还容易引入专家的主观偏见——分析人员可能会有意无意地通过调整特征构造方式来迎合自身预设的结论。利用 LLM 自动、无偏地构造特征,能够有效限制“研究人员自由度”(Researcher Degrees of Freedom)。 3. **因果推断与反事实推理机制**:LLM 能够理解数据的内在结构与实验假设,分析人员可以通过 Prompt 直接向模型提出假设性推演问题(“如果采取某项干预,系统会发生什么变化?”)。 4. **模型可解释性输出**:在因果模型完成参数估计后,LLM 可以充当“解释层”,用自然语言向跨职能业务方解释复杂的因果参数与底层机制,降低因果推断工具的使用门槛。 ### [09:04](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=544s) 因果发现(Causal Discovery):从相关性中解耦因果图谱 Mukerji 随后深入探讨了第一个具体应用方向——**因果发现**(Causal Discovery)。因果发现的核心目标在于直接从观察数据中自动挖掘变量之间的因果图谱(Causal Graph),用有向边标示出“谁导致了谁”,并精准剔除伪相关。 为了阐明这一任务的艰巨性,Mukerji 提出了一个经典的思维实验:假设真实世界中存在变量 $A$,它同时直接导致了变量 $B$ 和变量 $C$(即 $A \rightarrow B$ 且 $A \rightarrow C$)。在这种情况下,数据中变量 $B$ 和变量 $C$ 之间会表现出极强的统计相关性,但 $B$ 和 $C$ 之间实际上完全不存在任何因果联系。如果我们预先知晓真实因果方向,这种逻辑很容易理解;但如果我们面对的只是一堆冰冷的观察性数据,仅仅看到 $B$ 和 $C$ 同步波动,从算法上判定因果方向将极其困难。历史上统计学家提出了多种算法来尝试解决因果发现问题,而 LLM 的先验常识与推理能力正在为该领域注入全新的解决思路。 ### [10:10](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=610s) 传统因果发现方法的局限性与 LLM 的引入 因果发现(Causal Discovery)在传统统计学与机器学习中有多种经典路线。其一是基于约束的模型(Constraint-based models),它们主要通过检验变量之间的条件独立性(Conditional Independence),从而推断出哪些变量对之间不大可能存在因果关系;其二是基于模拟与评分的方法,即在特定的因果图假设下进行数据模拟,观察哪种图结构最拟合实际观测数据并进行打分;其三则是为了提升可扩展性而采用的半参数方法(Semiparametric methods),例如直接假定变量间的条件关联为线性结构来进行效应估计。然而,这些传统方法面临着巨大的瓶颈:它们普遍难以大规模扩展(Not super scalable),而且对特征工程的设定方式极其敏感。 大语言模型(LLM)能够为因果发现带来全新的突破,核心优势在于它们能够理解变量的语义信息和具体的问题背景。如果向 GPT 类模型输入变量所代表的具体现实含义,并用简单的文本描述变量交互的上下文(例如一段详尽的医药试验描述:某批患者服用了特定新药,该药物预期具有某种生化机制,且与过去具有某些已知副作用的旧药存在关联),LLM 就能根据这些丰富的文本先验,推测出患者可能经历的反应和因果走向。这种非结构化的上下文信息在传统特征工程与结构化数据中极难表达,但结合了因果发现框架与 LLM 后,整体推断表现能得到显著改善。 ```mermaid flowchart TD accTitle: 传统因果发现与LLM增强因果发现对比 subgraph Traditional["传统因果发现方法"] T1["基于约束的方法<br/>(条件独立性检验)"] T2["基于模拟打分的方法<br/>(拟合评估因果图)"] T3["半参数/线性假设方法<br/>(可扩展性尝试)"] end subgraph Limitation["传统核心瓶颈"] L1["难以大规模扩展"] L2["极度依赖特征设定"] L3["无法利用非结构化文本先验"] end subgraph LLM_Enhanced["LLM 增强因果发现"] E1["输入变量现实语义与文本上下文"] E2["结合因果发现框架联合推理"] E3["挖掘难以结构化表达的因果联系"] end Traditional --> Limitation Limitation -.->|引入上下文理解| LLM_Enhanced ``` --- ### [12:18](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=738s) “因果鹦鹉”困境与 LLM 在因果图发现中的评测表现 将 LLM 应用于因果推断时面临着与检索增强生成(RAG)类似的挑战:如何确保 LLM 的输出真正基于用户提供的特定上下文与元数据,而不是完全依赖其庞大的预训练记忆?如果模型过度依赖预训练记忆胡乱猜测,就会沦为所谓的“因果鹦鹉”(Causal Parrot),完全脱离用户给定的具体应用场景。因此,如何把 RAG 的排序与上下文注入技术有效迁移过来,成为了关键问题。 在具体性能表现方面,基准测试呈现出几项关键结论: - **两两变量关系识别(Pair-wise Links)**:在给定丰富情境故事的成对因果推断任务中(选项仅有无因果、正向因果、反向因果三种),以 Mistral 为例,未经微调的基础模型准确率约为 75%,微调(Fine-tuning)后可跃升至 90%。虽然由于问题空间被局限在三选一,这一指标不能完全说明问题,但仍证明了 LLM 具备良好的基础能力。 - **全因果图推断(Complete Causal Graph)**:当在标准因果数据集(如 E-COPA 等)上进行测试时,如果仅推断成对关系,模型表现相对稳健;但一旦要求模型推断完整的底层因果图(必须在所有可能节点对中找出所有正确连接),性能便会出现大幅下滑(图表中显示为断崖式下跌)。 - **微调与上下文的价值与代价**:在提供深入上下文并结合微调后,全图推断性能有了显著回升。但这揭示了一个两面性——优质的上下文确实能带来极高的准确率,但构建这些专业上下文不仅极其耗费人力与专家经验,且在一个领域微调好的 LLM 很难直接迁移到另一个全新的业务上下文中。 --- ### [15:37](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=937s) 从因果发现迈向因果估计(Causal Estimation) 仅仅识别出“变量 X 导致了变量 Y”在真实业务场景中往往是远远不够的,业务决策真正需要的是量化因果效应的强度。以实际商业场景为例:企业耗费巨资开展了一场获客营销活动,数据科学家如果仅仅得出“该活动带来了增长提升(Lift)”的结论几乎毫无业务价值,管理层真正关心的核心指标是这个提升究竟是 5%、15% 还是 50%。这便引出了因果估计(Causal Estimation)的核心议题。 在因果估计的实际应用中,学术与工业界重点关注两类核心应用与量化指标: 1. **数据中的处理效应估计**:包括平均处理效应(Average Treatment Effect, ATE,即整体平均带来的提升量)以及条件平均处理效应(Conditional Average Treatment Effect, CATE,即在特定用户特征与观测变量细分下的平均提升量)。 2. **模型输出的可解释性与因果归因**:理解模型为何产生某种输出。例如,当输入变量发生改变、神经网络架构调整、增加隐藏层节点或改变优化算法时,模型输出会发生怎样的因果变化。 ```mermaid flowchart LR accTitle: 因果推断从定性发现到定量估计的演进 A["因果发现 (Causal Discovery)<br/>判断定性关系: X 是否引起 Y"] --> B["因果估计 (Causal Estimation)<br/>量化因果强度与效应大小"] B --> C["业务指标估计<br/>ATE (平均处理效应)<br/>CATE (条件平均处理效应)"] B --> D["模型机制可解释性<br/>输入/架构/优化器变化<br/>对模型输出的因果影响"] ``` --- ### [17:34](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=1054s) 因果估计中的统计落地挑战与基准评测现状 尽管引入 RAG、微调和结构化先验可以让 LLM 展现出类似因果推理的能力,但在落地到严格的因果估计时,仍面临多重严峻挑战: - **统计计算能力的缺失与工具调用**:LLM 本身无法直接完成底层复杂的统计计算,必须与专业的外部因果推断库(如 EconML、DoWhy 等 Python 库)协同工作。然而,如何教会 LLM 在面对特定数据和业务场景时正确选择最合适的库,是一个极具挑战的问题。 - **估计模型结构设定的严谨性**:即便 LLM 选对了工具库,它在具体模型架构选择上仍有极大的自由度(例如选用因果森林 Causal Forest 还是因果深度学习 Causal Deep Learning)。必须对其施加严密的外部结构约束,以防止 LLM 随机尝试模型进而产生严重的“因果幻觉”。 - **高维特征扩展瓶颈**:LLM 或许能处理简单因果图和小规模变量,但如果直接给它 10,000 个特征(如生物学、基因组学等典型的高维实际场景)并要求其评估所有变量间的因果关联,模型将彻底失效。高维因果推理仍是 LLM 尚未攻克的领域。 在评测基准方面,相关研究(基于 arXiv 公开发布的论文)构建了包含 10,000 个拥有绝对事实基准(Ground Truth)的合成案例。在这些通过真实因果推断引擎构建的标准环境中,即使向 LLM 提供了图结构和目标关系先验,如果在没有严密提示词工程或针对性微调的情况下,LLM 的直接估计准确率非常糟糕,"勉强达到 60%"(barely 60%)。这种表现甚至不如传统的简单 NLP 基础方法,直接证明了目前纯纯依靠未经强力约束的 LLM 进行因果估计仍存在巨大缺陷。 ### [20:10](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=1210s) 提示工程与因果归因:定位大模型的知识关联与数学推理弱点 知识库与微调在检测因果关联中依然扮演着至关重要的角色,而高质量的提示工程(Prompting)能够显著提升模型的因果推理表现。这种现象与生成式 AI 在其他诸多应用中的局限性非常相似——"提示词真的非常非常重要"。然而,除了单纯优化提示词,更深层的需求在于理解模型对不同输入的敏感性,并追溯生成式 AI 的输出机制。 理解这种敏感性的一个核心应用场景是追踪模型内部的知识关联。例如,当模型建立起“埃菲尔铁塔”(Eiffel Tower)与“巴黎”(Paris)之间的关联时,研究人员需要搞清楚究竟是模型的哪个部分催生了这一输出。针对 GPT 系列模型的研究表明,神经网络中存在可局部化的特定参数区域,这些区域对特定类型的预测具有更高的相关性;识别这些区域能让开发者在微调模型时精准聚焦于特定用例的参数,从而极大提升效率。另一个亟需深入探究模型决策机制的领域是基础数学推理——众所周知,许多大语言模型在应对简单的数学问题时仍然会陷入挣扎。尽管扩大模型体量通常能带来改善,但这绝非一种“完全可持续或具备可扩展性”的解法。要彻底弄清模型为何被这些问题难倒,必须探究当输入发生微小变化时(例如将 $1+1$ 变为 $1+2$),模型内部架构的哪些特定部分在剧烈波动或表现出极高的方差与敏感性。 --- ### [22:20](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=1340s) 从相关性特征归因到反事实推断:LLM 可解释性的新维度 要彻底搞清模型的哪些组成部分真正对观测结果负责,本质上面临的是一个通用的“因果归因”(Causal Attribution)问题。在传统的结构化数据场景中,特征定义清晰且易于控制,研究人员可以通过严谨的实验设计,在保持其他所有变量完全不变(ceteris paribus)的前提下仅扰动单个变量,从而观测其对目标变量 $Y$ 的因果效应。但在大语言模型中,这种分析面临着巨大挑战:模型的预训练先验知识是所有决策的主导因素,既无法轻易将其剥离,又极难准确评估模型对检索增强生成(RAG)等外加上下文信息的真实敏感度。这也导致大语言模型极易依赖其训练先验和历史趋势,从而“将相关性误认为因果性”。 为了更有效地解释大模型,必须将因果方法引入模型分析中。目前基于相关性的可解释性方法(如 SHAP)只能提供静态的特征重要性,但研究人员更渴望回答反事实问题:如果改变某个特定特征或提示词,模型的输出会发生多大变化?由于大模型本身具有概率随机性,因果分析需要精确解耦这种输出波动有多少源自内在的随机性,又有多少真正由提示词的结构所决定。此外,因果分析对模型架构的缩放与成本优化也极具价值:如果调整网络层数、隐藏层节点或注意力头(Attention Heads),输出会受到多大影响?若因果评估证明较小模型在核心任务上对架构精简完全不敏感,企业便可以大幅简化模型结构并削减运行成本。最终目标是在大模型给出回答时,能够确切指出究竟是提示词中的哪一部分、训练数据中的哪个片段,或是模型架构中的哪些特定部分主导了该输出。 ```mermaid flowchart TD accTitle: Causal Attribution Framework in Large Language Models subgraph InputStage["输入干预(Treatment T)"] T["提示词 Prompt / 上下文"] Perturb["输入微扰 / 遮蔽 Redaction"] T --> Perturb end subgraph ModelInternals["Transformer 因果计算图(Mediators)"] L1["网络层 / 节点 Layer & Nodes"] Attn["注意力头 Attention Heads"] Param["可局部化参数 Localized Parameters"] L1 <--> Attn Attn <--> Param end subgraph OutputStage["反事实结果(Outcome Y)"] Y["模型响应 Response"] Counterfactual["反事实输出比较 What-If Analysis"] Y --> Counterfactual end InputStage --> ModelInternals ModelInternals --> OutputStage ``` --- ### [25:19](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=1519s) 基准测试的困境:记忆效应、局部遮蔽与传统梯度的盲区 在理论上理解大模型行为固然理想,但在实践中建立客观的性能评估框架却困难重重。业界目前普遍采用问答基准(Benchmark Q&A)来测试模型,即在提示词中嵌入特定的因果关联,检验大模型能否进行正确的因果推理,并通过微调或扰动提示词来观察其性能退化程度。然而,这种测试方法面临两大核心挑战: - **预训练记忆效应(Memorization)**:如果大模型的预训练数据中已经包含了基准测试的具体问题或上下文,模型展现出的可能只是死记硬背而非真正的推理能力。尽管可以通过仅提供部分挑战让模型补全来探测其是否具备先验记忆,但不同提示词类型与任务挑战之间的方差极大,极难彻底规避。 - **输入遮蔽与扰动的局限性(Redaction & Perturbation)**:一种常见的应对方案是对提示词进行部分遮蔽或变动输入,以此评估输出变化。但其硬伤在于人们很难在事前(ex-ante)准确预知提示词的哪一部分是关键因果要素,容易误删关键信息从而导致评估失效。 此外,注意力热力图(Attention Maps)、显著性得分(Saliency Scores)以及特征归因梯度(Feature Attribution Gradients)等非因果的可解释性工具,虽然能展示输入变化时网络各部分的激活状态,但它们依然停留在相关性层面。这些工具无法回答最根本的反事实因果问题——“如果我改变输入,模型是否还会给出相同的回答?输出的形态又会发生多大的改变?” --- ### [27:59](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=1679s) 形式化因果推断框架:将 Transformer 建模为因果图与干预试验 为了突破相关性分析的局限,可以将大语言模型的内部机制直接映射为传统的因果推断框架。在这个框架中,输入的提示词被定义为**处理变量(Treatment $T$)**,最终生成的响应被定义为**结果变量(Outcome $Y$)**。当模型接收到处理变量 $T$ 时,信息会流经整个神经网络的各个中介通道(Channels),最终聚合生成结果 $Y$。通过这一映射,研究人员可以系统性地识别出哪些内部模块被激活、哪些模块真正驱动了最终结果,而哪些模块与输出关联微弱,并可通过固定特定嵌入(Embeddings)来测试模型不同部分对输入扰动的敏感度。 进一步地,研究者可以把 Transformer 架构中的各个组件视为独立的因果特征,运用反事实推理与 **do-演算(do-calculus)** 进行深入分析。不同于将模型视为单向固定信息流的传统视角,该方法将整个 Transformer 建模为一个因果有向无环图(Causal DAG),图中的节点代表具体的网络组件与注意力头。在明确因果图的拓扑结构后,研究人员可以在任意节点实施因果干预(Intervention): - 固定某个特定节点的参数值或其传递到下一层的输出; - 实施反事实阻断操作,例如将某个正在独立运行的注意力头的输出强行置零(Zero-out); - 精确评估被干预组件对下游网络及最终输出的因果效应,使复杂的深度网络重回可控、可证伪的经典因果分析体系。 ### [30:01](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=1801s) 借助中介分析与因果图剖析大模型内部机制与幻觉 在探索大语言模型内部运作机制时,因果推断方法提供了一种严谨的分析框架——即通过控制其他所有变量不变、一次仅改变一个因素来评估因果效应。这种方法不仅对因果发现(Causal Discovery)极具价值,还能精准定位模型中起关键影响作用的组件。特别是在调试大模型的幻觉(Hallucinations)问题时,如果已知模型产生了幻觉,研究人员可以通过观察内部激活是否存在特定模式、输出究竟是由哪些节点驱动的,从而更有针对性地排查并修复具体缺陷。 然而,将 Transformer 架构形式化为因果图也面临着巨大的计算复杂度挑战。大语言模型架构精细且参数规模庞大,如果要完整描绘因果图或将其拆解为可管理的组件,通常需要运行极其多次的测试才能描绘出因果图的全貌。如果要将该流程作为可复现的工作流嵌入日常工程中,算力开销将非常可观。 ```mermaid flowchart LR accTitle: 大模型中介分析因果路径示意图 T["输入干预 (Treatment: T)"] --> M["内部激活节点 (Mediator: M)"] M --> Y["模型输出 (Outcome: Y)"] T -->|"直接路径 (非 M 路径)"| Y ``` 从因果中介分析(Mediation Analysis)的视角来看,当模型接收到输入时,该输入对最终输出产生影响的路径是多样化的,往往通过不同的节点组合传播。例如从节点 1 出发,流向节点 2、3、4,形成诸如 (1, 2)、(1, 3)、(1, 4) 等路径对,效应因此分散在模型的多个区域。在因果框架中,可以将输入定义为处理变量 $T$,最终输出定义为结果变量 $Y$,模型内部的激活集合定义为中介变量 $M$。分析时可以分别评估 $T$ 经过 $M$ 传递给 $Y$ 的间接效应,以及不经过 $M$ 的直接效应。通过干预手段——例如固定特定激活值、修改扰动 $M$、或直接在图中移除该部分子图——便能清晰揭示特定内部激活对模型生成行为的真实影响。 ### [32:12](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=1932s) 演讲总结:因果推断与大模型的结合点及挑战 演讲在此处进行了高层总结:因果推断在狭窄的实验设计之外本身就是一个极其困难的领域。目前研究最为丰富且最具潜力的方向,是将大模型作为文本特征提取工具,把文本信息转化为统计特征输入到传统的因果推断模型中,从而解决大量工业界实际业务问题。 - **因果发现与上下文依赖**:大模型进行因果发现虽然表现尚可,但与 RAG 或微调面临类似的风险,高度依赖于人类为其设定的精确上下文。 - **因果分析赋能模型可解释性**:利用因果图估计、扰动测试以及中介分析,可以反向剖析大模型产生幻觉的内在机理及特定输出的成因。 - **业务落地的可靠性诉求**:随着大模型被越来越深地嵌入到各类生产工作流与客户交互节点中,借助因果方法降低幻觉、增强模型可解释性与可靠性变得愈发关键。 ### [33:35](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=2015s) 问答一:控制计算复杂度与定位敏感网络区域 在随后的问答环节中,针对因果分析面临的“组合爆炸”与计算复杂度问题,讲者进一步阐述了实际落地的权衡策略。若要对所有提示词在所有情境下做全局因果图绘制,计算上确实不可行。但在实际工程中,通常只关注非常具体的指标(例如验证模型是否存在某种偏见,或者确认模型是否完全遵循了给定的上下文)。 通过限制提示词的修改范围,研究人员会发现模型中被激活并产生波动的并非全量神经元,只有特定区域对特定变化表现出高敏感度。因此,工程上可以通过将关注点收窄到这些高敏感度子网络来大幅缩小搜索空间,从而在可接受的算力成本内完成因果调试。 ### [34:21](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=2061s) 问答二:从 Terraform 代码推断基础设施拓扑与因果关系 现场观众提出了一个具体工程场景:团队希望输入一段用于创建基础设施的 Terraform 代码(例如创建虚拟机 VM 以及关联的磁盘 Disk),让大模型识别出二者之间的拓扑依赖与因果图结构(如“VM 使用 Disk”)。但直接向大模型提问时,模型频繁出现幻觉,观众询问能否引入因果推断框架来改进。 讲者分析指出,大模型在此类任务中能否成功,关键取决于提供给它的上下文与背景知识。此前学术界展示大模型具备良好因果推理能力的基准测试(如覆盖上万个因果场景的评测集),大多基于生物学或生态学等具有公认客观规律的成熟学科,模型是基于背景科学知识来进行逻辑推导。 对于 Terraform 这种专业垂直的领域: - **评估训练分布的影响**:需明确此类代码依赖关系的讨论在大模型预训练数据中的分布密度,若训练语料充斥大量噪声(类似金融市场数据),模型往往很难做出稳定判断。 - **构建高精度专业知识库**:对于高度特定且技术性极强的垂直领域,哪怕构建一个相对小规模但精度极高的专用知识库,也能显著降低幻觉并提升推导效果。 ### [36:37](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=2197s) 问答三:缺失反事实推断与大模型在定性/定量任务中的边界 另一位观众针对演讲前半部分提到的“利用大语言模型填补缺失反事实知识”进行了深入探讨。在观测性数据中(例如医疗场景下的特定病患),我们知道患者接受某种治疗($T_1$)后的实际结果,但永远无法直接观测到该特定个体在“若未接受治疗”这一反事实条件下的结局。观众询问,利用大模型这个“装在盒子里的互联网”来进行逻辑推导,是否本质上是在为该反事实变量提供一个概率估计。 ```mermaid flowchart TD accTitle: 文本大模型与传统因果估计模型的混合分工架构 subgraph LLM_Stage ["大语言模型阶段 (定性与语义关系)"] A["患者文本病史与用药记录"] --> B["LLM 提取语义因果关系<br/>('用药导致某生理维度发生变化')"] end subgraph Stat_Stage ["传统统计/因果模型阶段 (数值量化与强度估计)"] B --> C["构建结构化特征<br/>(体温序列、用药标记、生理指标)"] C --> D["传统因果估计模型<br/>(精准量化因果效应数值)"] end ``` 讲者对此表示赞同,并深入剖析了大模型在处理该问题时的能力边界: - **定性外推表现良好**:如果任务仅是用自然语言描述患者病程(如“患者持续发热”或“患者退烧”),大模型结合完备的病历背景知识库,可以较为合理地进行跨场景定性推演。 - **数值与强度量化严重失真**:一旦任务涉及密集的数值量化(例如患者第 1 天体温 100°F,第 2 天 99°F,随后升至 101°F,服药后降至 97°F),直接让大模型定量估算因果效应的大小,大模型极易出现严重幻觉。 - **最佳实践架构**:当前最前沿的研究范式是将任务解耦——利用大模型理解文本病历中的实体逻辑,推导出“施加了某药物,因此预期某生理维度会发生改变”的定性因果图谱;再将提取出的结构化特征(体温、用药状态、生理特征)交给传统的统计因果计量模型进行精确的数值效应估计。 ### [39:26](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=2366s) 理论探讨:结合自回归先验与大模型信息的贝叶斯更新 在问答环节的尾声,针对观众提出的一种融合设想,演讲者坦诚地表示自己并不确定业内是否有人实际这样做过,至少在他自己的视野范围内,尚未见过任何具体的落地应用。然而从统计学理论的角度来推演,这种思路在逻辑上是完全说得通的。 演讲者将这一潜在方案拆解为一个标准的贝叶斯推断框架(Bayesian Framework):可以将其设想为一个两阶段过程,首先由自回归模型(Autoregressive Framework)或某种现有的基准模型来提供一个先验分布(Prior),随后利用大语言模型(LLM)提取或补充额外的定性/上下文信息,最后结合这些新信息去更新并计算出后验分布(Posterior Distribution)。演讲者认为这种机制在理论上或许能够奏效,不过他也非常实事求是地反复强调,自己在这方面并没有亲身尝试过的实操经验。 ```mermaid flowchart LR accTitle: 贝叶斯框架下结合自回归先验与LLM的推断流程 subgraph InputStage ["先验与信息输入"] A["自回归/外部模型"] -->|"提供基准分布"| B["先验分布 (Prior)"] C["LLM 大语言模型"] -->|"注入额外信息"| D["增量上下文 / 特征"] end subgraph UpdateStage ["后验推断"] B & D --> E["贝叶斯更新计算"] E --> F["后验分布 (Posterior)"] end ``` - **理论架构构想**:由经典时间序列或自回归模型输出先验分布,再将 LLM 作为引入非结构化或补充知识的观测源。 - **现实应用现状**:目前尚无明确公开的成熟应用案例,仍处于理论探索与开放性构想阶段。 ## Notable quotes > [03:43](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=223s) 因果推断在本质上是一个“缺失数据”(Missing Data)问题。 — Abhimanyu Mukerji > [20:10](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=1210s) 提示词真的非常非常重要 — Abhimanyu Mukerji > [20:10](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=1210s) 完全可持续或具备可扩展性 — Abhimanyu Mukerji > [22:20](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=1340s) 将相关性误认为因果性 — Abhimanyu Mukerji > [25:19](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=1519s) 如果我改变输入,模型是否还会给出相同的回答?输出的形态又会发生多大的改变? — Abhimanyu Mukerji > [12:18](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=738s) 因果鹦鹉 — Abhimanyu Mukerji > [17:34](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=1054s) 勉强达到 60% — Abhimanyu Mukerji > [36:37](https://www.youtube.com/watch?v=XJHtZWZo3RU&t=2197s) 装在盒子里的互联网 — 现场观众 ## Mentioned Abhimanyu Mukerji, Amazon, Ai4, Transformer, Rubin Potential Outcomes Framework, Mistral, E-COPA, EconML, DoWhy, GPT, SHAP, Terraform ## Video description Abhimanyu Mukerji, Manager, Economics & Applied Science, Amazon Abstracts LLMs and Gen AI have compelling applications to problems in causal inference, and recent improvements in benchmark models have increased the potential for synergies between these modeling paradigms. There are also opportunities to use causal methods to make LLMs more explainable and robust. This talk will provide an overview of research in this area, and discuss how these methods can be used to solve major business problems. [Source](https://www.youtube.com/watch?v=XJHtZWZo3RU)

Source quotes

[3:43] Abhimanyu Mukerji: 因果推断在本质上是一个“缺失数据”(Missing Data)问题。 [20:10] Abhimanyu Mukerji: 提示词真的非常非常重要 [20:10] Abhimanyu Mukerji: 完全可持续或具备可扩展性 [22:20] Abhimanyu Mukerji: 将相关性误认为因果性 [25:19] Abhimanyu Mukerji: 如果我改变输入,模型是否还会给出相同的回答?输出的形态又会发生多大的改变? [12:18] Abhimanyu Mukerji: 因果鹦鹉 [17:34] Abhimanyu Mukerji: 勉强达到 60% [36:37] 现场观众: 装在盒子里的互联网

Source quotes

[0:00] Abhimanyu Mukerji: 99% of ML and AI has generally been applied towards [6:45] Abhimanyu Mukerji: limiting the researcher degrees of freedom [10:10] Abhimanyu Mukerji: causal parrot [15:37] Abhimanyu Mukerji: Let's say that you ran a very expensive marketing campaign... I could tell you that you have generated some lift and that's not going to be very useful to you. What you really want to know is was it 5%, 15% or 50%. [20:10] Abhimanyu Mukerji: Eiffel Tower [20:10] Abhimanyu Mukerji: Paris [27:59] Abhimanyu Mukerji: do(Head = 0) [36:37] the internet in a box [39:26] Abhimanyu Mukerji: that might work

Original transcript

[0:00] Before [0:04] I get started, show of hands for how [0:06] many people is causal inference [0:08] completely new? Has anyone already [0:10] worked in this area or familiar with the [0:12] modeling framework? [0:16] Okay, most people have not. Um, sounds [0:18] good. That is not a problem. So I will [0:21] so high level what I'm going to do here [0:23] is I'm going to give you an overview of [0:26] some of the key problems that can [0:28] potentially be addressed with LLMs and [0:30] genai in the causal inference space. [0:33] I'll also do the reverse. I'll talk [0:35] about how methods from causal inference [0:37] and more traditional techniques can be [0:39] applied to transformer architecture to [0:42] try to understand how to make LLMs more [0:45] explainable and more generalizable. [0:50] Okay. Um, so puzzle inference is a very [0:54] different area than prediction which is [0:57] what 99% of ML and AI has generally been [1:02] applied towards and is also where Gen AI [1:04] is mostly being applied to right now. [1:07] Um, so [1:09] the easiest way to think about causal [1:11] inference is AB testing or random [1:14] control trials. Um the idea is that you [1:17] have some kind of intervention or [1:19] treatment and you're trying to [1:20] understand from that what was the impact [1:22] on some population of interest. So when [1:26] you can run experiments when you can run [1:27] AB tests which is what many people might [1:29] have already done for applications or [1:31] web pages um it's pretty easy to [1:34] actually infer treatment effects. Um but [1:37] it becomes extremely difficult when you [1:39] move outside of that domain and you're [1:41] kind of working with observational data [1:43] where there is no easy way to run an [1:45] experiment. Um it can be very expensive [1:47] to run these experiments and so [1:49] understanding when it is that your Y is [1:53] being caused by a particular X can be an [1:55] extremely challenging problem. [1:57] So traditionally um in econometrics and [2:00] statistics more broadly causal inference [2:03] has required some very specific [2:05] conditions to allow you to actually make [2:07] useful inferences. So for starters data [2:11] cannot be arbitrary. You need it to be [2:13] structured in a particular format. So [2:15] you would usually work with panel data [2:17] uh where you observe the same group of [2:19] units over and over again for many time [2:21] periods and you try to use that [2:23] variation along with some information on [2:25] when an intervention or a treatment [2:27] occurred to try to understand what was [2:29] the impact of that treatment. [2:31] So for those familiar like there are [2:34] techniques like such such as [2:35] instrumental variables uh which is on [2:37] the slide. There's also uh formal causal [2:40] graph logic where you can satisfy the [2:42] backd dooror criteria and so on. So [2:44] there's a lot of complexity in how this [2:46] is being done. Um and LLMs offer some [2:50] new opportunities, some new [2:52] methodologies that can potentially be [2:54] extremely valuable. Um so for starters [2:58] like you can think about a lot of data [3:00] is text like the bulk of data that is [3:03] being produced is going to be in some [3:05] form free text and being able to use [3:07] that information can enhance the [3:09] performance of a lot of existing [3:10] methods. um LLMs and uh transform models [3:14] more broadly can be used in automation. [3:16] So if you if you can think of agentic [3:18] workflows for causal applications like [3:20] something like that is also pretty um [3:22] exciting. So what I'll go into now is [3:26] some of these applications and I'll [3:28] start with a with a high level framework [3:30] to help us kind of get through the [3:31] technical parts and then towards the end [3:33] I'll talk about um how explanability in [3:36] AI can be um improved using causal [3:39] methods. [3:43] Okay. So, um, generally the vast [3:47] majority of practitioners in causal [3:49] inference would be using what is called [3:51] the Reuben potential outcomes framework. [3:53] Um, so that's the first line on my slide [3:55] over there. Um, and what that means is [3:57] that the outcome variable Y can be [4:00] thought of as existing in two possible [4:03] states. So you have a t a treatment can [4:06] be one or zero. Um and accordingly the y [4:09] would either be y1 or y z. And so the [4:12] reason we frame it this way is because [4:14] the idea is that for every unit that [4:16] you're observing, it could be your [4:17] customer, your user, a patient, whatever [4:19] it is, for every single user or unit, [4:22] there is two possible conditions [4:24] depending on whether or not they were [4:25] given the treatment T. And so the beauty [4:29] of framing it this way is that now you [4:32] can think of causal inference as being a [4:34] problem of missing data. And the reason [4:37] there is this problem is because if [4:39] somebody has been given a t equals 1 [4:42] condition, so they've been given a [4:43] medicine or they've seen some kind of [4:45] marketing campaign or they've seen a new [4:47] version of your web page. Um all you are [4:49] going to be able to observe is y1. You [4:51] have no idea what y zero for that [4:53] individual would have been. Um and so [4:56] really that creates a problem because it [4:58] could be the case that the people who [5:00] who were given the t equals 1 condition [5:02] and the people who give were given the t [5:03] equals0 condition they may not be [5:05] comparable. And so if you ran an [5:06] experiment then randomization ensures [5:08] that on average and at certain points in [5:10] this in the distribution they are going [5:11] to be comparable. But for an [5:13] observational setting where you're not [5:15] running an experiment this is a really [5:16] really big problem and most of the field [5:18] is focusing on how to solve this problem [5:20] of missing data. [5:23] So the challenge you never observe y1 if [5:25] t equals z and you will only observe y1 [5:28] if t equals 1. So you have you always [5:30] have this missing uh like potential [5:33] outcome that you don't see. So the way [5:36] traditional approaches have worked um [5:38] they've tried to find specific settings [5:40] where you can make assumptions that [5:42] allow you to fill in the blanks and [5:44] extrapolate the missing data that you [5:47] don't see. And a lot of machine learning [5:49] and AI methods are applied in a similar [5:51] way. Um and so the idea there is that um [5:54] you use a predictive model to try to [5:58] make a best guess at the missing [6:00] potential outcome that you don't see. [6:02] And if you're able to do this well then [6:03] you for every individual you have a y1 [6:06] and a y z you can take the difference [6:07] and that is the effect of your [6:09] treatment. You can calculate the average [6:11] the mean the average treatment effect. [6:13] You can calculate the treatment effect [6:14] conditional on other things. Um, and you [6:16] can pretty much uh do whatever you'd [6:19] like with that with that from an [6:20] inferial standpoint. Um, but these [6:24] settings are still hard to hard to do [6:26] and it's very hard to know when you've [6:28] done a good job and when there is in [6:29] fact a problem with your estimation [6:31] strategy. So I've mentioned at the [6:33] bottom some of the estimation tools. So [6:34] in IPW, inverse propensity waiting, [6:37] matching, double machine learning and [6:38] structural modeling. These are all [6:40] techniques that try to do this in [6:41] different ways. [6:45] So why would an LLM fit into this kind [6:49] of problem? So far I've said nothing [6:50] that will make people think of rag or [6:53] querying or anything like that. So it's [6:55] it's not immediately obvious why you [6:58] might want to use an LLM. So I'll I'll [7:00] break this out into a few categories. So [7:03] like the first reason is what I already [7:04] mentioned that there is potentially a [7:07] lot of information in textual data that [7:09] is unstructured. Um, so it could be [7:12] descriptions of experiments, it could be [7:13] descriptions of your data itself, it [7:15] could be a lot of free text uh created [7:17] by your users or created by your [7:19] company. And you can use that to try to [7:22] make your model better. Um, the second [7:25] reason why you might want to use an LLM [7:27] is even when we think about structured [7:30] data like panel data, um, how you [7:32] construct the features can have a lot of [7:35] influence on the performance of your [7:37] model. And so trying to do this manually [7:40] is a difficult process. Um and it [7:43] requires expertise and even among [7:45] experts uh it creates a sense of [7:48] subjectivity where you can construct [7:50] features to suit your own objective [7:53] function and that may not be the best [7:54] way to do it. So ideally you want to try [7:56] to find a way to construct these [7:57] features in as automatic automated and [7:59] unbiased a way as possible and so [8:01] limiting the research of degrees of [8:02] freedom is another thing that you can [8:04] use LLMs for. [8:06] So to summarize um you can think about [8:09] extracting variables um from your data. [8:11] You can think about um creating a [8:14] framework where the LLM can reason about [8:17] the structure of your data and and and [8:19] you can actually ask it questions in a [8:21] prompt kind of framework where you ask [8:22] it what would happen if I did this and [8:24] you might get an answer back. um you can [8:27] think of using um information on the [8:30] assumptions or the structure of the [8:32] experiment you're running and use that [8:34] as to try to inform the quality of your [8:36] model. And the last one is you can once [8:39] your model is in place, you can now have [8:41] the LLM essentially explain what is [8:43] going on, explain specific aspects or [8:45] parameters which are of interest to you [8:48] and therefore make this more accessible [8:50] to a wider range of of users. [8:55] So what I'll do in the next few slides [8:56] is I'll go through some uh more narrow [8:59] applications and some examples of how [9:00] LLMs might be usable. So the first one [9:04] is uh related to the point I made before [9:06] about extracting uh relationships from [9:08] your data using LLMs. Um so this area is [9:11] called causal discovery. And so what [9:13] it's trying to do is essentially you [9:15] know that there are relationships uh in [9:17] your data. You know that certain things [9:19] are causing certain other things. And [9:21] you want to be able to frame this full [9:24] set of relationships. You can picture it [9:25] as a graph. So like things are pointing [9:27] to other things and that direction is [9:29] indicating what causes what. Um and you [9:32] also want to be able to disentangle when [9:34] something is actually causal versus when [9:37] it is merely correlation. Um and on that [9:40] point a simple thought experiment is if [9:42] I have a variable A and it causes both B [9:45] and C then B and C will be correlated [9:48] but they are not causing each other. Um, [9:50] and something like this, it's easy on [9:52] when you know what the directions are [9:54] supposed to be. But if you just have [9:56] data and all you can see is what is [9:57] moving in a correlated way, it's very [9:59] difficult to infer the direction of [10:01] causality. [10:03] So causal discovery has been uh has been [10:06] addressed in a number of different ways [10:08] in the past. Um so some classes of [10:10] models that do this you can have [10:12] constraint based models which are [10:14] essentially trying to um run statistical [10:17] tests for conditional independence [10:18] between variables and from that you can [10:20] kind of make a statement about these two [10:22] are not likely to be causally linked. Um [10:24] you can think of running simulations [10:26] where you try to um simulate based on a [10:30] particular causal graph and see which [10:32] one is most likely to fit your actual [10:34] data. So you can score different causal [10:36] graphs based on that. Um and then you [10:38] can think of of like of methods which [10:40] are trying to become more scalable. So [10:42] semiparametric methods where you say for [10:44] example that the relationships have to [10:45] be linear. Um and conditional [10:48] relationships being linear you can try [10:49] to do estimation from that. Um and so [10:52] all this is kind of just trying to give [10:54] you a sense that this problem is not an [10:57] easy one and generally most of the most [11:00] of the approaches that you have are not [11:02] super scalable and they are kind of very [11:04] subject to how you set up the features. [11:09] So an LLM can enhance this by using the [11:13] information about the variables the [11:15] problem context. So if I was to give a [11:18] GPT type model information on what the [11:20] variables represented and if I gave it [11:23] some context on what the situation is [11:25] like how are these variables interacting [11:27] in a very simple textual way um you [11:30] could then allow it you could then [11:32] imagine that it can uncover some of the [11:34] relationships. So if I was to give a [11:35] description saying that um I have uh a [11:39] pharmaceutical study and I have given [11:41] certain patients a medicine. The [11:42] medicine is expected to have certain [11:44] behavior. It is associated with some [11:45] other medicines in the past which have [11:47] been which have shown certain side [11:49] effects. If I gave it a very detailed [11:52] set of paragraphs from that it could [11:54] probably give me a pretty good guess as [11:56] to what patients are going to experience [11:59] when they were given this medicine. Um [12:01] and so that can help in the sense that [12:04] you like this additional information is [12:06] very difficult to express in terms of [12:08] traditional features and structured [12:10] data. But you can give this to an LLM in [12:13] conjunction with the causal discovery [12:14] framework and actually expect it to do a [12:16] better job. [12:18] So, similar to the challenges of rag, um [12:22] the problem that you'll have here is how [12:23] do you make sure that the LLM is [12:25] actually giving you um outputs that are [12:28] based on the um information and metadata [12:31] you've given it versus its training data [12:33] which might not be relevant to the [12:35] specific application. Um, and so this is [12:37] where you kind of come into the problem [12:38] of a causal parrot where it's [12:40] essentially using heavily its training [12:43] data to try to make guesses as to what's [12:45] going to happen and it's not actually [12:46] using the context that you've given it. [12:48] And so like now the problems of how do [12:50] you make sure the drag ranking and and [12:52] and context is being properly expressed [12:54] in the model like that some of those [12:56] techniques can be applied here as well. [12:58] So let me get into uh how performance [13:01] with these methods looks. So this is [13:04] from a paper a couple years ago um which [13:07] is essentially just looking at if you [13:09] were to frame out uh stories essentially [13:12] like if you give like a lot of [13:13] situational data to an LLM, how often is [13:17] it actually able to correctly infer the [13:19] relationships between pairs of uh [13:21] variables or pairs of features? Um and [13:24] so like they they tested a whole range [13:27] of models and so what you'd see here is [13:28] that it varies um but fine-tuning does [13:32] make things a lot better. So if you look [13:33] at the last two rows, it starts with [13:35] Mistl and then it it gets a 75% accuracy [13:38] and after fine-tuning it goes up to 90%. [13:41] So so this might give you the impression [13:44] that it's doing a pretty decent job. Um [13:47] I I'll just say that it's a restricted [13:49] problem space in the sense that for any [13:51] two variables, there's only three things [13:52] that you can say. Either they're not [13:53] linked, they're linked in direction one, [13:55] or they're linked in direction two. So [13:57] it's it's it's not it's not the best [13:59] kind of way to measure performance, but [14:01] it is it is some indication that the [14:03] LLMs are able to do a decent job with [14:05] this. [14:09] So like so now there's this evidence is [14:11] from a different paper. Um and so each [14:14] of these columns ecopa these are [14:16] standard data sets which are essentially [14:18] compiling causal relationships. So [14:20] there's an implied graph of uh [14:22] relationships underlying the data. Um, [14:25] and the LLMs here are essentially asked [14:27] the same question like how would you be [14:29] like how like what pair what pairs are [14:31] causally linked with each other and how [14:33] often is it able is it able to correctly [14:34] identify that. Um, so the last column in [14:38] blue you'd notice that um the [14:40] performance appears to degrade quite a [14:42] bit. Um, and so the reason for that is [14:44] because that last column is not checking [14:46] for pair-wise uh causal links any [14:48] longer. It's actually asking the LL to [14:50] infer the complete causal graph. Um and [14:53] so it has to basically figure out of all [14:56] the possible pairs which ones are are [14:58] relevant. Um the second thing I want to [15:01] highlight on this table is the this the [15:04] numbers below the double line like that [15:06] represents the performance after [15:08] fine-tuning and giving it um more [15:11] context and you'd see that performance [15:13] has improved a lot. Um and so this kind [15:16] of signals both the value and the [15:18] limitation. So the value being that with [15:21] good context you can actually get very [15:23] high performance but providing that [15:25] context is intensive and requires [15:28] expertise and it's not easy for it's not [15:31] easy for a trained LLM in one context to [15:33] be able to do this in other context. [15:37] So causal discovery we like I think to [15:41] summarize the state-of-the-art we are we [15:43] are able to do it to an extent there's [15:46] many limitations um but it's usually not [15:49] sufficient to be able to just say that [15:51] variable X is causing variable Y uh what [15:54] you really want to understand is the [15:55] strength of that relationship [15:58] um and so to give a more practical [16:00] example so let's say that you ran a very [16:03] expensive marketing campaign um you were [16:05] trying to get more users for for your [16:07] website or for your application. Um, I [16:10] could tell you that you have generated [16:11] some lift and that's not going to be [16:13] very useful to you. What you really want [16:14] to know is was it 5%, 15% or 50%. Um, [16:18] and so being able to quantify the [16:20] strength of causal relationships is [16:22] where we where we want to see how LMs go [16:25] next. Um, and so this is the problem of [16:27] causal estimation. Um, so generally [16:30] people would look at a few different [16:32] types of quantities. You can think of [16:33] the average treatment effect which in [16:35] simple terms is on average what would [16:37] the lift have been or the conditional [16:39] average treatment effect which is on [16:41] average given certain other obser obser [16:44] observations about the users what would [16:46] their lift have been. Um so that goes to [16:50] the first uh bullet point at the bottom [16:52] which is estimating treatment effects in [16:54] data. Um there's also a second [16:56] application of causal estimation here [16:58] that is very that is increasingly [17:00] potentially a good application for the [17:02] methods. Um and that is understanding [17:05] why a model is giving the output that [17:08] it's giving. So what that means is can I [17:11] can I state what is likely to happen [17:14] when my input changes? What happens if I [17:16] change the architecture of the network? [17:18] What happens if I add more nodes or if I [17:20] modify the optimization? Um what does [17:22] that do to my model output? And so I'll [17:24] spend some time on that last point um [17:26] towards the end of the talk, but for now [17:28] I'll I'll spend I'll I'll go into [17:30] estimating treatment effects from data. [17:34] So with rag uh fine-tuning and some some [17:38] structure added to the problem, um there [17:40] is evidence that LLMs are able to [17:42] demonstrate what what looks like causal [17:44] reasoning. um even if we accept that [17:48] this is this is doing well the there are [17:51] still some additional challenges when it [17:53] comes to actual estimation. So the first [17:55] one is that the LLM by itself is not [17:58] going to be able to do the statistics. [18:00] It's going to require uh pairing with [18:02] some kind of library for actual [18:04] estimation and how how to decide or how [18:07] to teach the LLM which library is most [18:10] appropriate to use in a particular [18:11] setting like that is that is a difficult [18:13] problem to solve. Um and even if you [18:16] even if it knew that it it should be [18:18] using for example Econ ML or DY or or [18:21] another Python library there is still [18:24] flexibility in terms of how does it [18:26] actually structure the model that is [18:28] intended to estimate the effect. So for [18:30] example like do you want to use a causal [18:33] forest? Do you want to use a causal deep [18:34] learning approach? Like how do you [18:36] actually think about doing that? So [18:38] external structure is still important. [18:40] um you want to make sure that it's not [18:42] trying random models and coming out with [18:44] essentially hallucinations. [18:46] Um and the final challenge is it might [18:49] be able to reason in terms of pairs and [18:52] relationships with very simple graphs, [18:54] but if I was to give an LLM 10,000 [18:58] features and ask it to measure all the [19:00] relationships between them and identify [19:02] which ones are causal, that's most [19:04] likely not going to work. And that [19:05] problem is very real in biology or [19:07] genetics where you do actually have that [19:09] scale and you need to be able to make [19:11] inferences at that dimensionality and [19:13] that's where LLMs have still not been [19:15] tested very well. [19:19] So how is the current performance? So I [19:23] I refer to this paper here from it's [19:25] it's freely available in archive. I [19:26] encourage people to go and take a look [19:28] at it. Um so what this is doing is it's [19:30] basically constructing 10,000 examples [19:33] of ground truth. uh where you have a [19:35] true causal inference engine which is [19:37] known to be correct by construction and [19:40] then you you give the LM a lot of [19:42] information. You give it the graphs, you [19:44] tell it uh what kinds of relationships [19:46] it should be looking for and then you [19:48] ask it to make estimations. Um and so [19:51] the headline is that without uh like [19:54] tuning it more or structuring the [19:56] prompts very carefully, accuracy is [19:57] really bad. It's like barely 60%. And so [20:00] you could have done much simpler NLP [20:02] based methods and it would have actually [20:04] done a better job um compared to the LLM [20:06] itself. So what this tells us is that [20:10] knowledge base and finetuning remains as [20:12] important as it was in detecting causal [20:14] links. Um and it also tells us that you [20:17] can use good prompting to improve this [20:19] performance quite a bit. Uh which means [20:21] that this is similar to a lot of other [20:24] geni limitations and applications. Um [20:26] that prompting is really really [20:28] important. [20:32] So let me touch on where this type of [20:36] reasoning could be important like so if [20:39] you wanted to think about um the model [20:41] outputs themselves and how the [20:44] sensitivity to different inputs is [20:46] useful. So one area is in tracing the [20:49] performance of genai. So let's say that [20:52] you the gen the geni algorithm gives you [20:55] some kind of association between two [20:57] words or phrases. So let's as the [20:58] example I have on the slide is Eiffel [21:00] Tower corresponding to Paris. Um what [21:03] can you do with this information or how [21:05] can you understand what part of the [21:07] model is leading it to give you this [21:09] output. So there are some research that [21:12] shows that um that for at least the GPT [21:14] class of models um there are localizable [21:17] parts of the network where certain [21:19] parameters are more relevant to certain [21:22] types of uh predictions than others. Um [21:25] and so the objective of that study was [21:27] to basically think about how can you [21:29] very efficiently tune the model by [21:32] focusing just on parameters that are [21:33] relevant to your specific use case. The [21:36] other place where you want to critically [21:38] think about um how and why a model is [21:41] making a decision that it is is to do [21:43] with math. So famously many LLMs still [21:47] struggle with pretty basic math problems [21:50] and larger models generally do better [21:52] but that's not that's not necessarily uh [21:55] perfectly extensible or perfectly [21:56] sustainable. Um and so you want to [22:00] understand like what it is about these [22:02] problems that is stumping the LLM. So [22:04] what what exactly in the architecture is [22:07] fluctuating or showing a lot of variance [22:09] when you kind of change the input [22:11] question. So instead of oneplus 1 if I [22:13] ask for oneplus 2 like what parts of the [22:16] model are really really sensitive to [22:17] that. [22:20] So this so the the general uh strategy [22:23] is you want to understand the [22:25] attribution of what parts of your model [22:29] are actually responsible for the [22:30] observed outcome. So this is a general [22:31] problem called causal attribution. So [22:34] conventionally you would have structured [22:36] data with structured features. And so [22:38] what you're looking at there is um if [22:40] you if you have certain features and you [22:42] can run experiments, you can try to [22:44] understand how much changing one [22:46] variable affects other variables. And so [22:48] the way to do this correctly is [22:50] everything else is held exactly the [22:51] same. You only change one thing and you [22:53] see how it affects your y variable. Um [22:55] and so with LLMs there like the ch there [22:58] are some challenges in trying to do [23:00] this. So like the first one is that [23:01] pre-trained knowledge is is a major [23:04] determinant of everything. So removing [23:06] this is going to make it extremely [23:07] difficult for the for you to figure [23:08] anything out and it's also limitation in [23:11] being able to judge the sensitivity to [23:13] additional context or information given [23:15] in a rag. So there is a tendency in all [23:19] these LLM examples that I've given you [23:21] so far that it will heavily focus on its [23:24] training and its prior trends and it's [23:25] going to misinterpret correlation for [23:27] causation. [23:28] So what do we do next? Um so how can [23:32] causal methods be applied to the problem [23:36] of LLMs and explaining LLMs more [23:38] effectively? So [23:42] it's uh so there are already [23:44] correlationbased approaches which kind [23:46] of give you a sense of importance or [23:48] feature importance. Um so SHAP for [23:50] example is is something that's used very [23:51] very frequently. But the kinds of [23:53] questions that you want to extend into [23:55] is how would output have been different [23:58] if you changed a particular feature? how [24:00] much would the LLM's output have changed [24:02] for a given change in prompt. And this [24:05] second one is particularly complicated [24:06] because LLMs are probabilistic in and of [24:08] itself. And then you want to understand [24:11] how much of that is random and how much [24:12] how much of that is actually determined [24:14] by the prompt or the structure of the [24:15] prompt that you've actually given it. Um [24:18] the third one I have there is on [24:20] architecture. So if you were to change [24:22] the number of layers, you change nodes, [24:24] you change the attention heads, uh how [24:26] much of an impact would that have on [24:28] your model? And this last one has an [24:30] hasn't has uh relevance for scaling as [24:33] well. Like after a point you may not [24:34] want super complex models especially if [24:36] you want it to be customized to your [24:38] application. So you may want to think [24:40] about how can you simplify the model and [24:42] by extension reduce the cost of running [24:43] it. And if you find that it's generally [24:46] very insensitive even with a much [24:48] smaller model that's what you would [24:49] prefer to use. But understanding whether [24:52] or not that is the case is a problem [24:54] where causal inference can help you. And [24:56] the last point at the broadest is when [24:59] an LLM gives an output, we want to be [25:01] able to say what it was in the prompt [25:03] that led it to say this. So for example, [25:05] it could provide you with some [25:07] information on um a specific part of its [25:10] training data that has led it to say [25:12] something or a specific part of its [25:13] architecture that has heavily influenced [25:15] the output. [25:19] So it's uh it's a difficult problem [25:22] because understanding LLM behavior in [25:25] theory is well and good but then you [25:27] have to think about what is uh an [25:28] objective way to evaluate this [25:30] performance even in the framework that [25:31] we've already discussed. So generally [25:34] the way people do this is with the [25:36] benchmark uh question and answers. So [25:38] you set up essentially prompts where [25:41] there are specific uh causal [25:43] associations embedded in there. You [25:45] wanted to see if the LLM can properly [25:48] reason and answer these questions and [25:51] then you want to push to start uh [25:53] tweaking these prompts and see how much [25:55] the performance changes or what parts of [25:57] the performance are degrading. [25:59] So there are two challenges to this. The [26:01] first one is memorization. So there is [26:04] there is problems if the LLM's training [26:07] data actually includes the specific [26:09] questions you were going to ask it or [26:10] the context of the uh benchmark [26:13] challenges that you wanted to present to [26:14] it. And so it's difficult to get around [26:18] this one. So uh people have suggested [26:20] that you can present uh part of the [26:23] challenge and ask it to complete the [26:24] rest to see whether it already has this [26:26] in context. And there is a lot of [26:28] variance in what type of prompts you've [26:30] given it and what type of challenge it [26:32] is and how well it's able to do. Um the [26:34] second challenge is uh to do with the [26:36] solution. It's like if you were like how [26:38] would you actually think about um [26:40] getting around this? So one popular way [26:42] is redaction. So you would essentially [26:45] give it a partial prompt and then assess [26:48] what that happens and then it it's [26:50] linked to also perturbing the input to [26:52] understand what's going wrong. Um, it's [26:54] still a limitation because it's [26:56] difficult to know which parts excante [26:59] like in advance it's difficult to know [27:00] which parts of the prompt were most [27:02] relevant and what you what was okay for [27:04] you to redact and what was actually um [27:07] preventing you from assessing the thing [27:09] that you wanted to assess. Um so [27:13] so it's um like it it's generally [27:17] advisable to think more in a more [27:19] structured way about how to approach a [27:21] problem rather than just uh changing [27:23] prompts and assessing what happens. Um [27:25] so there are methods which are not [27:28] directly focusing on causal problems but [27:31] they are informative for what is going [27:33] on in a network. So attention maps or [27:35] salency scores, feature attribution [27:37] gradients and so on. Um, and so these [27:39] give you a sense of what parts of your [27:41] model are activating or what parts are [27:43] changing when you change parts of the [27:45] input, but they are still limited in [27:48] that they're not answering the question [27:50] that you want, which is would the model [27:52] have said the same thing if I was to [27:54] change the input and how different would [27:56] the output have looked if I changed the [27:58] input. [27:59] So we can frame this in terms of a more [28:03] traditional causal inference problem. So [28:05] the prompt can be thought of as a [28:07] treatment T. Um response is an outcome [28:09] Y. And so the mechanics of what's [28:12] happening here is when the treatment is [28:13] given, it's being it's going through the [28:15] network. So it's going through a set of [28:16] possible channels which eventually lead [28:19] into an output Y. Um and you can think [28:22] of which parts of the model are [28:24] activating, which parts of the model are [28:26] actually driving the output and which [28:28] parts are less salient to to the end [28:30] result. Um and so once you are able to [28:33] do this you can think about perturbing. [28:34] So you can think about holding [28:36] particular embeddings fixed and then [28:38] trying to change things in the input to [28:40] assess how sensitive different parts of [28:42] your network are. [28:48] So and so like this is so that so what I [28:51] what I said before is is a good highle [28:54] framework for it. Um you can also think [28:55] about explicitly looking at components [28:58] of the transformer architecture as being [29:00] independent features. Um and so then you [29:03] can do uh counterfactual reasoning or do [29:05] calculus. So one way to think about this [29:07] is rather than mediating channels where [29:10] there's a fixed uh direction or fixed [29:12] flow where things are happening one [29:14] after the other you can allow each of [29:16] these things to vary. So you can model [29:18] the entire transformer as a set of nodes [29:21] in in a in a causal graph and you can [29:24] look at which components are leading to [29:26] other parts of the graph to activate. [29:29] And so once you model this and you can [29:31] do it pretty easily because you can [29:32] basically keep on feeding inputs to the [29:34] um LLM and and assessing what is [29:36] actually going on. But once you have the [29:38] fully specified graph, you can intervene [29:41] at any point. You can say that for this [29:42] node I'm going to fix the I'm going to [29:45] fix the I'm going to fix the parameter [29:47] value or I'm going to fix the output of [29:48] to the next part of the network. And I [29:50] can I can then assess what would happen [29:52] if I was to do something like zero out [29:54] the output of some other attention head [29:56] which is which is operating separately. [29:58] And so this goes back to the more [29:59] traditional problem of you want to [30:01] assess causal impacts by holding [30:03] everything else fixed and just changing [30:05] one thing at a time. And so it's useful [30:07] for causal discovery. it's useful to [30:09] identify influential components. Um, and [30:13] where I think there's a lot of potential [30:14] is in debugging hallucinations. So when [30:16] you know that the LM is hallucinated, [30:18] are there patterns in the activation? [30:20] Are there patterns in where the output [30:23] is being driven? That can be more that [30:26] can be useful in helping you directly [30:27] focus and try to fix that specific type [30:30] of problem. So the the risks and the [30:34] challenges are to do with complexity. So [30:36] LLMs are very sophisticated, very large [30:39] models. And if you think about trying to [30:41] frame out the entire causal graph or you [30:43] want to if you wanted to actually break [30:45] this out into manageable components, it [30:47] would take many many runs for you to get [30:49] a good a good sense of what the causal [30:51] graph looks like. So it can add a lot of [30:52] computational complexity if you wanted [30:54] to do this as part of a repeatable [30:56] workflow. uh especially [31:01] so so going going further into what we [31:04] were just discussing on transformers and [31:06] framing them as a graph. Um you can [31:08] think of mediation and so what mediation [31:11] is trying to tell you is when when an [31:13] input is given there are there are [31:15] different ways in which it affects the [31:17] output and you can think of effects [31:19] operating through particular [31:21] combinations of nodes. So like you start [31:22] at node one and then it can go to node 2 [31:25] 3 4 and then you have pairs. So you have [31:26] 1 2 1 3 1 4 and so on. So now this [31:29] effect is known to operate through many [31:32] sections of the model. And so you can [31:35] frame the problem a little bit [31:36] differently by essentially saying that [31:38] the input is is a treatment t output is [31:41] output is y as before and there is a set [31:44] of possible internal activations um [31:46] which you can parameterize by m and so [31:48] you can think of the effect of t on y [31:50] which is going through m the effect on t [31:52] and y which is not going through m and [31:54] then you can try to assess what happens [31:56] if you were to change m or hold m fix or [31:58] modify m or tweak it um or if you were [32:00] to remove that part of the graph [32:02] entirely. [32:03] Um, and so intervening by holding [32:05] specific activations fixed is is is a is [32:08] a good way to try to understand what's [32:09] going on. [32:12] So I I tried to cover a lot. So I I'll [32:14] I'll I'll let me try to quickly [32:16] summarize what the um what the main [32:18] highle points were here. So cause [32:20] inference is challenging. It's an [32:22] extremely difficult problem outside of [32:24] extremely narrow experimental settings. [32:27] um where there has been the most [32:28] research and where there's probably the [32:30] most potential is LLM's incorporating [32:32] text information into uh as as [32:35] statistical information that goes into [32:37] traditional causal inference models and [32:38] this can be helpful in solving a lot of [32:40] industry relevant problems. Um you can [32:43] think of uh um the the risks as being [32:47] very similar to rags or fine-tuning. [32:49] there is there is reasonably good [32:51] learning or causal discovery but it [32:53] requires a lot of uh careful context [32:55] setting for the LLM. Um and certain [32:58] aspects of causal graph estimation and [33:01] perturbation and mediation analysis can [33:03] be used to try to understand why LLMs [33:05] are hallucinating, why they're giving [33:07] the specific outputs that they are. Um, [33:09] and as we move towards a world where [33:12] these types of models are embedded more [33:14] and more in all types of work workflows [33:17] and and all types of customer engagement [33:19] points, um, being able to reduce [33:21] hallucinations and also explain and [33:23] increase reliability is increasingly [33:25] important. [33:28] Uh, let me stop there. Thank you. [33:33] [Applause] [33:35] >> Yes. Yes. Um so it goes to this last [33:38] point on computational complexity. So it [33:40] is a hugely complicated problem. So the [33:43] way you can reduce the the complexity of [33:46] the space of combinations you need to [33:48] look at is for let's say I'm interested [33:50] in a very specific thing. I want to make [33:52] sure that my model is not um biased in [33:55] some sense. I want to make sure it's [33:56] giving me u it's it's it's it's using [33:58] purely the context I'm giving it to. So [34:00] what you'd find is that when you like [34:02] there's a limited number of things that [34:04] you could do to change your prompt and [34:05] the parts of the network that are [34:07] actually activating is not everything. [34:08] So there are certain parts that are more [34:10] sensitive and you can narrow your focus [34:11] down there. Um but I but as a general [34:15] solution to any kind of prompt in any [34:17] kind of situation yes it's it's a very [34:19] problem. [34:21] >> Uh we are working with a problem um [34:23] given a terapform code we want to find [34:26] like a like a graph representation of [34:27] that. So the terraform will create a VM. [34:30] It will have a disk. So you want to have [34:32] like a cause relationship between the VM [34:34] and disk. We're not doing causally right [34:36] now. We just asking LLM and it [34:38] hallucinates a lot. Do you have any [34:40] recommendation how we can use the causal [34:42] framework for that? [34:43] >> I didn't follow the first part. What [34:45] what is the thing? What is it you're [34:46] trying to [34:46] >> terapform code? Um it's uh say creating [34:49] a VM. [34:50] >> Okay. [34:50] >> And it has a disk. [34:51] >> Uhhuh. [34:52] >> So we want to find this this link as a [34:54] graph, right? So VM using a disk. [34:56] >> Yep. And we we are just asking LLM hey [34:59] can you tell us whether there's a [35:01] relations or not and it hallucinates a [35:04] lot. [35:04] >> Yep. [35:05] >> But we I'm thinking that maybe causal [35:08] method would be helpful for doing that. [35:10] >> Yeah. Um so the problem that you're [35:13] going to run into is what is the context [35:16] that it has to be able to make the [35:18] determination. So a lot of the examples [35:20] I was giving where performance is good [35:22] like these these sort of 10,000 causal [35:24] scenarios right like they're based on [35:26] very standard settings where for example [35:29] like in biology or in ecology there's [35:31] like specific relationships that are [35:32] known to be true and you're kind of [35:33] inferring from that and so the [35:35] performance is really being measured by [35:36] saying that I will give it the context [35:38] of this background science and then from [35:40] that I will see can it reason in in a in [35:42] a in a in a sensible way now for the [35:44] question you asked I don't know anything [35:46] about it so it's very difficult for me [35:47] to actually say like how you would be [35:49] able to to measure that but the high [35:52] level suggestion I would have is what is [35:54] the problem that is generally seen is [35:56] you need to find a way to give it a [35:57] knowledge base that is extremely [35:59] specific to your application and you [36:01] need to be able to test to see how [36:03] sensitive is it to the original training [36:05] data so I don't know for example how [36:08] widespread this kind of discussion would [36:10] have been in training data and whether [36:11] that is going to be influencing the LLM [36:13] heavily um where you see this happening [36:15] a lot is there are applications to [36:17] financial markets where there is so much [36:18] noise in training that it's very [36:20] difficult to make any sensible [36:22] evaluations. Um but for something that's [36:25] super specific and super technical to a [36:26] particular domain like even with a [36:28] relatively small knowledge base you [36:29] should be able to greatly improve [36:30] performance but I can talk more about it [36:32] afterwards but I I have to understand a [36:34] little bit more about the specific [36:35] problem. [36:36] >> Thank you. [36:37] >> Thank you for the talk. So the question [36:39] that I have is related to the earlier [36:41] part of the question the presentation [36:43] which is uh more aligned towards uh [36:46] trying to fill in the gap in missing [36:49] knowledge using LLMs. [36:51] >> So you've got a treatment and you've got [36:54] uh let's say it's it's an episodic [36:56] thing. It's not a distribution. So you [36:57] won't know what happens in all cases. [37:00] >> But uh you um you know you know why [37:04] we're given T1 because you've [37:06] experienced it, right? A patient's given [37:08] a treatment, you know what happens, but [37:10] what you don't know is for this [37:12] particular [37:13] >> patient, what have what would have [37:15] happened if I didn't give the treatment, [37:16] right? That's the problem. [37:17] >> Exactly. [37:18] >> And what you're trying to solve is that [37:20] can I use generalized [37:23] can I use basically the internet in a [37:25] box to answer that question or to [37:27] provide enough reasoning to get to an [37:29] estimate that gives me enough knowledge [37:31] to solve this problem. Right. And I I [37:34] guess you're saying that um you want [37:38] your allied data or fine-tuning or [37:41] custom whatever rag to be able to solve [37:44] that problem. But how does it like [37:47] so you're essentially like giving a prob [37:49] probabilistic estimate of that variable? [37:51] Like that's the crux of the [37:54] >> That's right. So so like I'll I'll break [37:57] it into a few into a few things. So like [37:59] if you were just interested in saying in [38:01] a text description this patient's [38:03] continued to have fever, this patient's [38:05] fever went away, right? If you do it in [38:07] that sense, you could potentially just [38:10] use an LLM to extrapolate. So you could [38:11] say that um this is the description of [38:14] histories of all patients who have ever [38:15] been given drugs in our specific [38:17] setting. These are the descriptions of [38:19] patients who have not been given drugs [38:20] and what happened to them in day 1, day [38:22] 2, day three, like the episodic thing [38:23] that you're talking about. So, and like [38:25] an LLM with a good knowledge base could [38:27] probably give you a reasonable answer. [38:29] Where it's going to really struggle is [38:31] if you were to say that the temperature [38:33] of the patient on day one was 100 [38:35] Fahrenheit, next day it was 99, then it [38:37] went up to 101 again, then it was then [38:39] they were given the drug and it went [38:40] down to 97. So like when you start [38:42] making it numerical and when you want to [38:44] quantify the strength of an effect, [38:46] that's where it's not going to be be [38:48] able to do a good job. So what so rather [38:50] than doing that like where it seems like [38:53] research is more focusing on right now [38:54] is you use the text to learn the [38:57] relationship. So all you're doing here [38:58] is treatment like a drug was given [39:00] therefore I expect this dimension to [39:02] have changed and then you go into focus [39:05] the features on temperature was drug [39:08] given general other physiological [39:10] characteristics and then par pass it on [39:12] to a model that will actually do the [39:14] estimation because if you just ask it [39:16] like what is going to be the actual [39:18] effect like that's where it's going to [39:19] hallucinate a lot um and so yeah [39:24] >> yes yes [39:26] uh I don't know if people do that. Um I [39:29] have not seen any specific application [39:32] but yeah in theory like if you give it [39:34] like you can almost think of it as like [39:36] you have the auto reagressive framework [39:37] that's giving you a prior and then it's [39:38] a Beijian thing of yeah so like so the [39:41] prior is given based on some other model [39:42] the LLM is adding some additional [39:44] information then you calculate a post to [39:45] your distribution based on that that [39:47] might work but I have no I have no I [39:49] have no experience with that.