{# Per-pair causal effects for _experiment.html. Expects `v`, `c`, `sub`, `what`, `peer`, `peers`. #} {% if v.causal %} {% set cc = v.causal %}

Causal effects per minimal pair

{% if cc.rule_y %}{% endif %} {% for row in cc.rows + [cc.median] %} {% set is_median = loop.last %} {{ row.label }} {% for b in row.bars %} {{ b.label }} {% if b.w is not none %} {% endif %} {% if is_median %} {{ b.value | num(2) }} {% endif %} {% endfor %} {% endfor %} 0.5 = a typical matched {{ peer }} {% for tx, label in cc.ticks %} {{ label }} {% endfor %}
sufficiency (clean → corrupted) necessity (corrupted → clean) Percentile of the {{ what }}'s |effect| among the {{ c.null_neurons }} matched {{ peers }}; control pairs are skipped. {% if cc.rows %}Hover a bar for its effect and prompts.{% else %}This record predates per-pair effects, so only the medians are shown.{% endif %}
{% if cc.rows %}
Per-pair numbers
{% for p in c.pairs %}{% set pair = sub.counterfactuals[p.pair_index] if p.pair_index < sub.counterfactuals | length else none %} {% for patch in [p.sufficiency, p.necessity] %} {% endfor %} {% endfor %}
PairPromptsSufficiencyNecessity
{{ p.pair_index + 1 }} {% if pair %}{{ pair.base_prompt }}
→ {{ pair.counterfactual_prompt }}
{% endif %}
{{ patch.percentile | num(2) }}
effect {{ '%.3g' | format(patch.effect) }}
matched {{ '%.3g' | format(patch.null_median) }} / {{ '%.3g' | format(patch.null_max) }}

Each cell: percentile, then the {{ what }}'s signed effect and the matched {{ peers }}' median and largest |effect|, in {{ 'logits' if c.target == 'claimed_tokens' else 'nats of KL' }}.

{% endif %}
{% endif %}