Teaching Transformers Causal Reasoning through Axiomatic Training

Aniket Vashishtha, Abhinav Kumar, Atharva Pandey, Abbavaram Gowtham Reddy, Kabir Ahuja, Vineeth N. Balasubramanian, Amit Sharma

Introduction

Current Large Language Models (LLMs) are often described as "causal parrots"—they excel at identifying statistical correlations but struggle with the underlying logic of cause and effect. While causal rules can be hard-coded as inductive biases or inferred from massive interventional datasets, both approaches have significant drawbacks. Hard-coding is rigid, and interventional data (the gold standard for causality) is prohibitively expensive to collect.

This raises a fundamental question: Can a transformer learn the principles of causal reasoning directly from symbolic examples? Specifically, if a model is shown how the "transitivity axiom" (e.g., if A causes B and B causes C, then A causes C) works on tiny graphs, can it generalize that logic to solve complex causal puzzles it has never seen before? Researchers have developed Axiomatic Training, a method that teaches transformers causal reasoning by training them on symbolic demonstrations of causal rules rather than raw data. Surprisingly, a tiny 67-million parameter model trained this way can generalize from simple 3-node chains to complex, branched graphs, often outperforming billion-scale models like GPT-4 on formal causal benchmarks.

The Axiomatic Training Approach

Axiomatic Training treats causal rules as a supervised learning task. The authors represent axioms as symbolic tuples: <premise, hypothesis, conclusion>.

Axiomatic Training Pipeline
  1. Data Generation: Thousands of synthetic examples are programmatically generated. For instance, a premise might list edges in a graph ("X causes Y. Y causes Z."), a hypothesis asks a question ("Does X cause Z?"), and the conclusion is a simple "Yes" or "No."
  2. Model Architectures: The researchers tested a 67M parameter GPT-2-style transformer trained from scratch (to test pure generalization without pre-training contamination) and fine-tuned Llama-3-8B-Instruct (to see if this method improves existing state-of-the-art models).
  3. Structural Perturbations: To ensure the model learns the underlying logic rather than just memorizing patterns, "Random Flipping" (reversing some edges to create forks and colliders) and "Shuffling" (changing the order of statements in the premise) were introduced during training.
  4. Positional Encoding: Various encodings (RoPE, SPE, NoPE) were tested to see which best handles "length generalization"—applying rules learned on 3-6 nodes to graphs with 15+ nodes.

Datasets and Benchmarks

The models were evaluated on newly created synthetic datasets for Transitivity and d-separation (a rule connecting graph structure to statistical independence), which included variations like longer chains, branched networks, and reversed sequences. They were also tested on external benchmarks:

  • CLEAR: Tests understanding of causal graphs through binary and multi-choice questions.
  • Corr2Cause: A challenging benchmark requiring models to infer causal relationships from correlational statements expressed in natural language.

Key Insights and Results

The results demonstrate that targeted axiomatic training is highly efficient for formal reasoning. A model trained only on simple 3-6 node chains successfully reasoned about graphs with 15 nodes and complex branching. This suggests the transformer learned the logic of the axiom rather than just the geometry of the training graphs.

Performance Comparison on Causal Reasoning
  • Small Models, Big Logic: The 67M parameter model, despite being orders of magnitude smaller, performed on par with or outperformed GPT-4, Gemini Pro, and Phi-3 on d-separation tasks.
  • Llama-3 Boost: Fine-tuning Llama-3-8B on axiomatic data led to a 20 percentage point improvement in F1 score on the Corr2Cause benchmark, surpassing GPT-4’s performance. On the CLEAR benchmark's d-separation task, accuracy jumped from 30% to 70% for Yes/No questions.
  • Overcoming the "Reversal Curse": Models trained only on forward chains (A→B→C) fail when the order is reversed. However, adding just a small amount of "Random Flipping" (A→B←C) during training allows the model to generalize across all graph topologies.
  • RoPE Wins for Length: Rotary Positional Encoding (RoPE) proved most effective for length generalization, allowing models to maintain reasoning accuracy even as the number of variables scaled far beyond the training set.

Limitations and Future Work

While promising, the current study assumes all relevant variables are observed (no hidden confounders), which is a simplified version of real-world causal challenges. Additionally, the models trained from scratch used a limited vocabulary of alphanumeric node names, tying their "pure" reasoning capabilities to symbolic inputs.

Looking ahead, this framework could be extended beyond causality to other formal systems, such as deductive logic or mathematical proofs, potentially creating specialized "verifiers" that can check the logical consistency of larger LLMs.

Summary updated

BibTeX
@inproceedings{vashishtha2025teaching,
  author = {Aniket Vashishtha and Abhinav Kumar and Atharva Pandey and Abbavaram Gowtham Reddy and Kabir Ahuja and Vineeth N. Balasubramanian and Amit Sharma},
  title = {{Teaching Transformers Causal Reasoning through Axiomatic Training}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=AhebPqDOMI},
}
Figure