rifqifarhansyah commited on
Commit
c9d0740
·
verified ·
1 Parent(s): 076a2e3

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +1 -131
README.md CHANGED
@@ -438,134 +438,4 @@ configs:
438
  path: Llama-3.2-3B-Instruct/sst2/race/reverse_fixed15/stage_1_race_all_heads.csv
439
  - split: stage_2
440
  path: Llama-3.2-3B-Instruct/sst2/race/reverse_fixed15/stage_2_race_all_heads.csv
441
- ---
442
-
443
- # Persona Bias Path-Patching Circuit Results
444
-
445
- Per-attention-head path-patching scores for the **wrong/biased-persona
446
- circuit search** (reverse direction, see Stage 2B/3B of the Persona Bias
447
- Circuit Discovery pipeline). Each config corresponds to one
448
- `model x task x persona-axis x counterfactual-sampling-variant` run and
449
- exposes up to four splits:
450
-
451
- | split | file | content |
452
- |-------------------|--------------------------------------|--------------------------------------------------------------------------|
453
- | `selected_heads` | `selected_heads_<axis>.csv` | union of heads selected across all stages that were actually run |
454
- | `stage_1` | `stage_1_<axis>_all_heads.csv` | direct corrupt-activation patch at every head, at the `answer` position |
455
- | `stage_2` | `stage_2_<axis>_all_heads.csv` | backward sender->receiver patch into the stage-1 selected heads |
456
- | `stage_3` | `stage_3_<axis>_all_heads.csv` | backward sender->receiver patch into the stage-2 selected heads |
457
-
458
- **`stage_2` and `stage_3` are not available for every config.** The search
459
- (`run_axis_circuit_discovery` in `persona_patching/patching.py`) walks
460
- backward through the network one stage at a time and stops as soon as:
461
-
462
- * a stage selects no heads above the `top_head_fraction` threshold, or
463
- * the lowest selected-head layer from the previous stage is already layer 0
464
- (there is nothing further upstream to search).
465
-
466
- So a config with only a `stage_1` split means the search stopped after
467
- stage 1; a config with `stage_1` + `stage_2` stopped after stage 2; only
468
- configs that reached layer 0 by stage 3 have all four splits. Check which
469
- splits exist for a given config (via `data_files` in the YAML header above,
470
- or simply by listing the variant directory) before assuming a stage is
471
- present.
472
-
473
- ## Directory layout
474
-
475
- ```text
476
- <model>/<task>/<axis>/<variant>/
477
- ├── selected_heads_<axis>.csv
478
- ├── stage_1_<axis>_all_heads.csv
479
- ├── stage_2_<axis>_all_heads.csv (present only if the search advanced past stage 1)
480
- └── stage_3_<axis>_all_heads.csv (present only if the search advanced past stage 2)
481
- ```
482
-
483
- `manifest.json` and `*_effects.npy` siblings on disk are intentionally
484
- **not** part of this dataset; they hold full run metadata (counterfactual
485
- file path, per-direction sample counts, the raw effect matrices) and live
486
- in the source repository instead.
487
-
488
- ## Config naming
489
-
490
- ```text
491
- {model}__{task}__{axis}__{variant}
492
- ```
493
-
494
- * **model** -- e.g. `Llama-3.2-3B-Instruct`.
495
- * **task** -- one of `gsm8k`, `arc_easy`, `arc_challenge`, `safety`, `ethics`, `sst2`.
496
- * **axis** -- persona axis: `emotion`, `gender`, `religion`, `race`.
497
- * **variant** -- counterfactual sampling strategy used to build the reverse
498
- (wrong-persona-clean / correct-persona-corrupt) pairs:
499
- * `reverse_axis100_dir20_balanced` -- persona-direction-balanced pairs, capped at 20 per direction.
500
- * `reverse_fixed15` -- fixed total budget of 15 pairs per configured persona direction, with deficits redistributed across directions.
501
-
502
- ## Row schema
503
-
504
- `selected_heads_<axis>.csv`:
505
-
506
- | column | meaning |
507
- |----------------|--------------------------------------------------------------------------|
508
- | `axis` | persona axis name |
509
- | `stage` | stage number (1, 2, or 3) this head was selected at |
510
- | `stage_label` | human-readable stage description |
511
- | `layer` | transformer layer index |
512
- | `head` | attention head index within the layer |
513
- | `head_label` | `L<layer>H<head>` shorthand |
514
- | `score` | path-patching effect for this head at this stage (`clean - patched`) |
515
- | `n_examples` | number of counterfactual pairs averaged over |
516
- | `clean_metric` | clean-run metric for the run (constant across all rows of one file) |
517
-
518
- `stage_1` / `stage_2` / `stage_3` `_all_heads.csv`:
519
-
520
- | column | meaning |
521
- |---------------|----------------------------------------------------------------------------|
522
- | `stage` | stage number |
523
- | `stage_label` | human-readable stage description |
524
- | `layer` | transformer layer index |
525
- | `head` | attention head index within the layer |
526
- | `head_label` | `L<layer>H<head>` shorthand |
527
- | `score` | path-patching effect for this head at this stage |
528
- | `selected` | whether this head passed the `top_head_fraction` threshold at this stage |
529
-
530
- All heads in the model are listed in the `stage_*_all_heads.csv` files
531
- (`selected` distinguishes the winners); `selected_heads_<axis>.csv` lists
532
- only the winners, across every stage that ran.
533
-
534
- ## Effect sign convention (reverse / biased-circuit search)
535
-
536
- These results all use the **reverse** patching direction:
537
-
538
- ```text
539
- clean run = wrong-persona behavior
540
- source run = correct-persona behavior
541
- intervention = correct activation -> wrong run
542
- effect = clean_metric - patched_metric
543
- selection = most negative effect
544
- ```
545
-
546
- A large negative `score` means inserting the correct-persona activation at
547
- that head repairs the wrong-persona prediction, i.e. the original
548
- wrong-persona activation at that head/path was supporting the biased
549
- behavior. This dataset does not include the original/correct-direction
550
- (Stage 2A, unbiased-circuit) search results.
551
-
552
- ## Loading
553
-
554
- ```python
555
- from datasets import load_dataset
556
-
557
- ds = load_dataset(
558
- "<org>/<repo>",
559
- "Llama-3.2-3B-Instruct__sst2__religion__reverse_fixed15",
560
- )
561
- selected_heads = ds["selected_heads"]
562
- stage_1 = ds["stage_1"]
563
- # stage_2 / stage_3 may not exist for every config -- check ds.keys() first
564
- ```
565
-
566
- ## Source pipeline
567
-
568
- Produced by `run_path_patching.py` (reverse mode) in the Persona Bias
569
- Circuit Discovery pipeline; see that repository's `README.md`, Stage 2B
570
- and Stage 3B, for the full counterfactual derivation and patching
571
- methodology.
 
438
  path: Llama-3.2-3B-Instruct/sst2/race/reverse_fixed15/stage_1_race_all_heads.csv
439
  - split: stage_2
440
  path: Llama-3.2-3B-Instruct/sst2/race/reverse_fixed15/stage_2_race_all_heads.csv
441
+ ---