candle-mi 0.1.6

Mechanistic interpretability for language models in Rust, built on candle
Documentation
{
  "model_id": "google/gemma-2-2b",
  "clt_repo": "mntss/clt-gemma-2-2b-426k",
  "prompt": "Roses are red, violets are blue",
  "token_ids": [
    2,
    154240,
    708,
    3118,
    235269,
    185737,
    708,
    3868
  ],
  "encode_layer": 12,
  "correlational": {
    "positions": [
      {
        "pos": 0,
        "token_id": 2,
        "token": "<bos>",
        "n_active": 1596,
        "top_features": [
          [
            4427,
            227.08253479003906
          ],
          [
            3277,
            146.36114501953125
          ],
          [
            13911,
            97.44219970703125
          ],
          [
            3584,
            85.7834243774414
          ],
          [
            458,
            84.37980651855469
          ],
          [
            10777,
            73.3424072265625
          ],
          [
            14529,
            59.88201141357422
          ],
          [
            5467,
            56.77351760864258
          ],
          [
            3808,
            54.82881164550781
          ],
          [
            12270,
            54.402584075927734
          ]
        ]
      },
      {
        "pos": 1,
        "token_id": 154240,
        "token": "Roses",
        "n_active": 3,
        "top_features": [
          [
            6159,
            5.5005717277526855
          ],
          [
            10178,
            1.360344648361206
          ],
          [
            277,
            0.9575556516647339
          ]
        ]
      },
      {
        "pos": 2,
        "token_id": 708,
        "token": " are",
        "n_active": 2,
        "top_features": [
          [
            4427,
            0.8048819303512573
          ],
          [
            6213,
            0.03567454218864441
          ]
        ]
      },
      {
        "pos": 3,
        "token_id": 3118,
        "token": " red",
        "n_active": 11,
        "top_features": [
          [
            2891,
            1.6440837383270264
          ],
          [
            14075,
            1.1436810493469238
          ],
          [
            11653,
            1.140636920928955
          ],
          [
            7722,
            0.8643432855606079
          ],
          [
            1614,
            0.7184153199195862
          ],
          [
            16329,
            0.5887951850891113
          ],
          [
            8022,
            0.31416749954223633
          ],
          [
            6110,
            0.24610447883605957
          ],
          [
            10435,
            0.2293018102645874
          ],
          [
            1157,
            0.1980527639389038
          ]
        ]
      },
      {
        "pos": 4,
        "token_id": 235269,
        "token": ",",
        "n_active": 8,
        "top_features": [
          [
            7722,
            1.0180317163467407
          ],
          [
            10570,
            0.9028617143630981
          ],
          [
            5432,
            0.7026634812355042
          ],
          [
            8339,
            0.6655491590499878
          ],
          [
            6717,
            0.27451300621032715
          ],
          [
            13201,
            0.18850994110107422
          ],
          [
            4733,
            0.16913235187530518
          ],
          [
            7840,
            0.09852313995361328
          ]
        ]
      },
      {
        "pos": 5,
        "token_id": 185737,
        "token": " violets",
        "n_active": 15,
        "top_features": [
          [
            15388,
            1.6478804349899292
          ],
          [
            3332,
            1.1019458770751953
          ],
          [
            15354,
            0.7571389675140381
          ],
          [
            1775,
            0.6500691175460815
          ],
          [
            1896,
            0.4870847463607788
          ],
          [
            2382,
            0.39121103286743164
          ],
          [
            6701,
            0.35008060932159424
          ],
          [
            6170,
            0.30601876974105835
          ],
          [
            192,
            0.24631652235984802
          ],
          [
            11602,
            0.22886520624160767
          ]
        ]
      },
      {
        "pos": 6,
        "token_id": 708,
        "token": " are",
        "n_active": 14,
        "top_features": [
          [
            4427,
            4.367294788360596
          ],
          [
            4809,
            1.7120097875595093
          ],
          [
            7156,
            1.4614895582199097
          ],
          [
            3541,
            1.4328949451446533
          ],
          [
            14707,
            0.8902199268341064
          ],
          [
            1775,
            0.6666387319564819
          ],
          [
            2393,
            0.4912928342819214
          ],
          [
            8339,
            0.41047823429107666
          ],
          [
            5128,
            0.3900442123413086
          ],
          [
            3332,
            0.2998616695404053
          ]
        ]
      },
      {
        "pos": 7,
        "token_id": 3868,
        "token": " blue",
        "n_active": 27,
        "top_features": [
          [
            6717,
            8.688545227050781
          ],
          [
            4824,
            2.8242852687835693
          ],
          [
            5432,
            2.1555395126342773
          ],
          [
            8339,
            1.7902717590332031
          ],
          [
            3171,
            1.705140471458435
          ],
          [
            15228,
            1.1767507791519165
          ],
          [
            14652,
            1.1282298564910889
          ],
          [
            4809,
            1.0153815746307373
          ],
          [
            13182,
            1.011756420135498
          ],
          [
            14937,
            0.9885544776916504
          ]
        ]
      }
    ],
    "unique_top1_count": 6,
    "jaccard_first_last": 0.0
  },
  "causal": {
    "chosen_feature": 6717,
    "chosen_activation": 8.688545227050781,
    "injection_strength": 5.0,
    "l2_distances": [
      {
        "pos": 0,
        "token": "<bos>",
        "l2": 26.26017951965332
      },
      {
        "pos": 1,
        "token": "Roses",
        "l2": 26.408607482910156
      },
      {
        "pos": 2,
        "token": " are",
        "l2": 51.751502990722656
      },
      {
        "pos": 3,
        "token": " red",
        "l2": 43.93161392211914
      },
      {
        "pos": 4,
        "token": ",",
        "l2": 42.59387969970703
      },
      {
        "pos": 5,
        "token": " violets",
        "l2": 38.593292236328125
      },
      {
        "pos": 6,
        "token": " are",
        "l2": 27.374149322509766
      },
      {
        "pos": 7,
        "token": " blue",
        "l2": 53.914772033691406
      }
    ],
    "max_l2": 53.914772033691406,
    "max_pos": 7,
    "last_l2": 53.914772033691406,
    "last_rank": 1,
    "concentration_ratio": 1.2657868316715521
  }
}