
Show HN: Axiom, a general-purpose model for causal discovery
A general-purpose model for causal discovery. Give it a table of data, and it drafts a causal graph of what is likely to cause what.
以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。
Max Pagels
Axiom
A general-purpose model for causal discovery. Give it a table of data, and it drafts a causal graph of what is likely to cause what.
3.8M parameters · fp32 safetensors · 15 MB
Drafting a causal graph, a representation of what is thought to cause what, is often the first step in causal inference. This process is known as causal discovery.
Discovery is usually done manually, through a blend of stakeholder interviews and domain expertise. Ideally, the result is a correct directed graph of the causal process of interest. In practice it will never be perfect, but even an imperfect graph is valuable. A partially correct graph still encodes a great deal of knowledge: which variables are plausibly related, which are almost certainly not, and the direction of influence for at least some relationships.
Automated causal discovery aims to speed up this traditionally manual process by inferring such partial graphs directly from data. Axiom is an open general-purpose model built for this task.
A causal graph is a set of variables connected by arrows. An arrow from one variable to another means the first is a direct cause of the second: change it, and the second changes too, all else being equal. The absence of an arrow is just as informative, since it claims there is no direct influence.
TemperatureIrrigationEvaporationSoil moistureCrop yield
Fig. 1 — A small causal graph. Arrows point from cause to effect.
In the example above, every variable is a continuous measurement: temperature in degrees, irrigation in litres, evaporation and soil moisture in millimetres, crop yield in kilograms per hectare. Higher temperatures lead farmers to irrigate more and also increase evaporation. Irrigation adds water to the soil while evaporation removes it, and soil moisture in turn drives crop yield. Note what the graph does not say: irrigation has no direct effect on yield. Its influence flows entirely through soil moisture.
Irrigation and evaporation will also be correlated in data, even though neither causes the other. Both share a common cause, temperature. Telling apart relationships like these is precisely what causal discovery tries to do.
Inferring causal direction from observational data alone can be impossible in principle. The same data can arise from entirely different causal structures. Take two variables, A and B. A world where A causes B and a world where B causes A can produce exactly the same joint distribution. With linear relationships and Gaussian noise, for instance, the two are indistinguishable no matter how many rows you collect.
The basic idea behind Axiom is that, despite this, one can do much better than random guessing. Axiom is a general-purpose model with attention across both rows and columns, letting it reason jointly about individual samples and the relationships between variables. It is trained on synthetic data drawn from a wide range of causal mechanisms. Real-world processes are rarely the perfectly symmetric worst case, and they leave subtle asymmetries in their data.
The graph Axiom returns is not meant to be perfect. Think of it as a first draft: a starting point that is refined with domain knowledge. Go through it with the people who know the process best. Remove edges that are physically or logically impossible, add relationships you know exist, flip arrows that point the wrong way, and flag the ones nobody is sure about.
Once the graph is good enough, there are several things you can do with it:
The graph tells you which variables to adjust for, and which to leave alone, when estimating the effect of one variable on another. That way you avoid both confounding and bias from conditioning on the wrong variables (hint: I made Formative for this purpose).
Every graph implies conditional independencies that can be checked against data. If the data contradicts one, part of the graph is likely wrong.
Edges that are uncertain or that matter a lot for a decision are natural candidates for targeted interventions. Their results can then be fed back into Axiom as intervention data.
Fit a structural model on top of the graph to predict what happens when you change a variable, rather than merely observe it.
Install the package straight from the Hugging Face repository:
pip install "git+https://huggingface.co/maxpagels/axiom-base"
Then load the model and pass it a table. Axiom reads the whole dataset in a single forward pass. Missing values can be left as NaN.
from axiom import Axiom, discover
model = Axiom.from_pretrained("maxpagels/axiom-base") g = discover(model, df) # pandas DataFrame or (n, d) array; NaN = missing
g.edges # [(cause, effect, probability), ...] g.edge_probs() # (d, d) matrix of P(i -> j) g.confounded # (d, d) 0/1 matrix: likely hidden common cause, no edge
discover standardises each column the same way as during training, so pass your data as-is. Only use axiom.preprocess if you want to call the model directly.
For every pair of variables, Axiom predicts probabilities over five classes, which are then decoded into an acyclic graph:
If some rows come from experiments, where a variable was deliberately set rather than observed, tell Axiom which ones. Interventions break symmetry and can sharply improve direction accuracy.
One entry per row: None = observational, otherwise the
column(s) that row's experiment targeted. An (n, d) bool mask also works.
targets = [None, "PKC", ["PKA", "PIP3"], None, ...]
g = discover(model, df, interventions=targets)
Label every experimental row. Rows that came from an experiment but are left unlabelled look like the work of a hidden cause, and can produce wrong or reversed edges.
Benchmark results are available on the Hugging Face model page.
正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。