SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2312.06681 · 2023

Steering Llama 2 via Contrastive Activation Addition

arXiv · PDF · Open in the Atlas

Code that ran

21 of 22 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 7 honoured the contract we drafted, 0 violated it and 5 have no contract verdict; 9 failures of our instrument; 1 no recorded run), measured 2026-11-24; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2312.06681.json · badge: /api/ran/2312.06681.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
wusche1/caa_hallucination canonical (classifier label)
classifier basis: census
8 ran · 1 no recorded run
nrimsky/caa canonical (classifier label)
classifier basis: census
4 ran · 0 no recorded run
nrimsky/sycophancysteering canonical (classifier label)
classifier basis: plan_row
1 ran · 0 no recorded run
steering-vectors/steering-vectors community (classifier label)
classifier basis not recorded on the link
8 ran · 0 no recorded run
FunctionStatusWhere it lives
adjust_read_indices_for_padding Ran
ran on a synthesized input
steering-vectors/steering-vectors/steering_vectors/token_utils.py
code served (permissive licence) · get_code("e7c337a7d8850d10")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 1, dtype family int, shape (2,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Create small tensors for testing
batch_size = 2
seq_length = 4

# read_indices: shape (batch_size,) containing indices to read from
# Can include negative indices (for indexing from the end)
read_indices = torch.tensor([-1, 2], dtype=torch.long)

# attention_mask: shape (batch_size, seq_length) with 1s for valid tokens and 0s for padding
# Example: first sequence has 3 valid tokens, second has 2 valid tokens
attention_mask = torch.tensor([
    [1, 1, 1, 0],
    [1, 1, 0, 0]
], dtype=torch.long)

ARGS = {
    "read_indices": read_indices,
    "attention_mask": attention_mask,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 1, dtype family int, shape (2,) — shape (2,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
average_random_lines Ran
ran; our contract draft was wrong, not the code
wusche1/caa_hallucination/paper/Hallucination/steered/gridsearch_script.py
pointer only (licence: NONE) · get_code("16b5463363d55f62")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wusche1/caa_hallucination when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

collect_matching_layers Ran
ran on a synthesized input
steering-vectors/steering-vectors/steering_vectors/layer_matching.py
code served (permissive licence) · get_code("ec984213a0e4f425")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from collections.abc import Callable

torch.manual_seed(0)

# Create a simple model with named modules that match a pattern
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.transformer = nn.Module()
        self.transformer.h = nn.ModuleList([
            nn.Module(),
            nn.Module(),
            nn.Module(),
        ])
        for i, layer in enumerate(self.transformer.h):
            layer.mlp = nn.Linear(4, 3)
            layer.attn = nn.Linear(4, 3)

model = SimpleModel()

# Test with string layer_matcher containing {num}
layer_matcher_str = "transformer.h.{num}.mlp"

# Also create a callable version for testing
def custom_matcher(model: nn.Module, layer_num: int) -> str:
    return f"transformer.h.{layer_num}.mlp"

# Use the string matcher version
ARGS = {
    "model": model,
    "layer_matcher": layer_matcher_str
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
create_paired_statements Ran
ran; our contract draft was wrong, not the code
wusche1/caa_hallucination/paper/Hallucination/data_generation/datagen_functions.py
pointer only (licence: NONE) · get_code("5c748f6879688dda")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wusche1/caa_hallucination when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

eval_model Ran
ran, honoured the contract we drafted
nrimsky/sycophancysteering/finetune_llama.py
code served (permissive licence) · get_code("88c6a4e2feade29f")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch as t
import torch.nn as nn

t.manual_seed(0)

# Build a minimal model that has a .eval() method and returns an object with .logits attribute
class MinimalModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        # Return an object with a .logits attribute
        logits = self.linear(x)
        class LogitsWrapper:
            def __init__(self, logits_tensor):
                self.logits = logits_tensor
        return LogitsWrapper(logits)

model = MinimalModel()

# Build a small dataloader
# Each item is (p_tokens, p_label, n_label)
# p_tokens: shape (batch_size, seq_len, token_dim) - but model expects (batch, features)
# Actually, looking at the code: model(p_tokens).logits[:, -1, :] suggests logits has shape (batch, seq_len, vocab_size)
# So p_tokens likely has shape (batch, seq_len) and model outputs (batch, seq_len, vocab_size)
# Let's make p_tokens shape (2, 5) for batch=2, seq_len=5
# Then linear layer should output vocab_size=3

class MinimalModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.embedding = nn.Embedding(100, 4)
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        # x shape: (batch, seq_len)
        embedded = self.embedding(x)  # (batch, seq_len, 4)
        logits = self.linear(embedded)  # (batch, seq_len, 3)
        class LogitsWrapper:
            def __init__(self, logits_tensor):
                self.logits = logits_tensor
        return LogitsWrapper(logits)

model = MinimalModel()

# Create dataloader as list of tuples
# p_tokens: (batch=2, seq_len=5), values in range [0, 100)
# p_label: (batch=2,), values in range [0, 3)
# n_label: (batch=2,), values in range [0, 3)
dataloader = [
    (
        t.randint(0, 100, (2, 5)),
        t.randint(0, 3, (2,)),
        t.randint(0, 3, (2,))
    ),
    (
        t.randint(0, 100, (2, 5)),
        t.randint(0, 3, (2,)),
        t.randint(0, 3, (2,))
    )
]

device = 'cpu'
maximize_positive = True

ARGS = {
    'model': model,
    'dataloader': dataloader,
    'maximize_positive': maximize_positive,
    'device': device
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
extract_data Ran
ran; our contract draft was wrong, not the code
wusche1/caa_hallucination/paper/lib/hallucination_lib.py
pointer only (licence: NONE) · get_code("c6ea479857c46dbd")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wusche1/caa_hallucination when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

find_attention_start_and_end_positions Ran
ran on a synthesized input
steering-vectors/steering-vectors/steering_vectors/token_utils.py
code served (permissive licence) · get_code("3abe74fe6527e900")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 2, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Create a small attention mask tensor
# Shape: (batch_size=2, sequence_length=4)
# Values are 1 for attended positions, 0 for masked positions
attention_mask = torch.tensor([
    [1, 1, 1, 0],
    [1, 0, 1, 1]
], dtype=torch.long)

ARGS = {
    "attention_mask": attention_mask
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 2, dtype family int — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
find_token_ids_for_letter Ran
ran, honoured the contract we drafted
wusche1/caa_hallucination/paper/lib/hallucination_lib.py
pointer only (licence: NONE) · get_code("bee6eb80fc9ce139")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wusche1/caa_hallucination when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

find_token_ids_for_letter Ran
ran, honoured the contract we drafted
wusche1/caa_hallucination/paper/Hallucination/MMLU/create_MMLU_script.py
pointer only (licence: NONE) · get_code("b22334a879b672d4")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wusche1/caa_hallucination when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_avg_key_prob Ran
ran, honoured the contract we drafted
nrimsky/caa/plot_results.py
code served (permissive licence) · get_code("71c7b7baeb271dad")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# Analyzing the function:
# - results: Dict[str, Any] - but it's iterated over with "for result in results"
#   This means results is actually a dictionary where we iterate over its values
#   OR it's a list of dictionaries. Looking at the code, we iterate and access result[key],
#   result['a_prob'], result['b_prob']. So results should be a list of dicts.
# - key: str - a string key to look up in each result dict
# - Each result dict needs: the key parameter, 'a_prob', 'b_prob'
# - The value at result[key] should contain either 'A' or 'B' (substring check)

results = [
    {
        'outcome': 'Option A',
        'a_prob': 0.7,
        'b_prob': 0.3,
    },
    {
        'outcome': 'Option B',
        'a_prob': 0.4,
        'b_prob': 0.6,
    },
    {
        'outcome': 'Choice A',
        'a_prob': 0.8,
        'b_prob': 0.2,
    },
]

key = 'outcome'

ARGS = {
    'results': results,
    'key': key,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_avg_score Ran
ran, honoured the contract we drafted
nrimsky/caa/plot_results.py
code served (permissive licence) · get_code("3aa6e9883f5ac3a5")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# Analyze the function:
# - get_avg_score takes a parameter 'results' of type Dict[str, Any]
# - But the function iterates over 'results' with 'for result in results'
# - This means it iterates over the keys of the dict, not key-value pairs
# - Wait, looking more carefully: it's iterating 'for result in results'
# - and accessing result['score'], so result must be dict-like
# - This suggests 'results' should be iterable and yield dicts

# Looking at the actual iteration pattern:
# for result in results:
#     try:
#         score_sum += float(result['score'])
# This means results is iterable, and each item has a 'score' key

# Create a list of result dicts with score values
results_list = [
    {'score': 0.85, 'id': 1},
    {'score': 0.92, 'id': 2},
    {'score': 0.78, 'id': 3},
    {'score': 'invalid'},  # This one will be caught by exception handler
    {'id': 4},  # This one missing 'score' will be caught by exception handler
]

ARGS = {
    'results': results_list
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_layer_name Ran
ran; our contract draft was wrong, not the code
steering-vectors/steering-vectors/steering_vectors/layer_matching.py
code served (permissive licence) · get_code("de4f85e859799286")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Build a small model with named modules that match a pattern
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.transformer = nn.Module()
        self.transformer.h = nn.ModuleList([
            nn.Module() for _ in range(3)
        ])
        for i in range(3):
            self.transformer.h[i].mlp = nn.Linear(4, 4)
    
    def forward(self, x):
        return x

model = SimpleModel()

# layer_matcher can be a string with {num} placeholder
layer_matcher_str = "transformer.h.{num}.mlp"

# layer_num can be positive or negative
layer_num_positive = 0
layer_num_negative = -1

ARGS = {
    "model": model,
    "layer_matcher": layer_matcher_str,
    "layer_num": layer_num_positive,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_mmlu_questions Ran
ran; our contract draft was wrong, not the code
wusche1/caa_hallucination/paper/Hallucination/MMLU/create_MMLU_script.py
pointer only (licence: NONE) · get_code("c7d81e3b714024ee")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wusche1/caa_hallucination when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_module Ran
ran; our contract draft was wrong, not the code
steering-vectors/steering-vectors/steering_vectors/torch_utils.py
code served (permissive licence) · get_code("f212fc11c8550e27")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Linear. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from torch import nn

torch.manual_seed(0)

# Create a simple model with named modules
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear1 = nn.Linear(4, 3)
        self.relu = nn.ReLU()
        self.linear2 = nn.Linear(3, 2)
    
    def forward(self, x):
        x = self.linear1(x)
        x = self.relu(x)
        x = self.linear2(x)
        return x

model = SimpleModel()

# The function iterates through model.named_modules() and checks if n == name
# We need to provide a valid module name that exists in the model
# named_modules() returns tuples like ('', model), ('linear1', linear_module), etc.
name = "linear1"

ARGS = {
    "model": model,
    "name": name
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Linear — a Linear output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Linear output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_num_matching_layers Ran
ran on a synthesized input
steering-vectors/steering-vectors/steering_vectors/layer_matching.py
code served (permissive licence) · get_code("26e328c0c4dcd10f")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from collections.abc import Callable

torch.manual_seed(0)

# Create a simple model with named modules
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.transformer = nn.ModuleDict({
            'h': nn.ModuleDict({
                '0': nn.ModuleDict({
                    'mlp': nn.Linear(4, 3)
                }),
                '1': nn.ModuleDict({
                    'mlp': nn.Linear(4, 3)
                }),
                '2': nn.ModuleDict({
                    'mlp': nn.Linear(4, 3)
                })
            })
        })
    
    def forward(self, x):
        return x

model = SimpleModel()

# Test with string layer_matcher containing {num}
layer_matcher_str = "transformer.h.{num}.mlp"

# Test with callable layer_matcher
def callable_layer_matcher(model: nn.Module, layer_num: int) -> str:
    return f"transformer.h.{layer_num}.mlp"

layer_matcher_callable = callable_layer_matcher

ARGS = {
    "model": model,
    "layer_matcher": layer_matcher_str
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_raw_data_path Ran
ran; our contract draft was wrong, not the code
nrimsky/caa/behaviors.py
code served (permissive licence) · get_code("322dd0b812140661")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

# Mock the __file__ variable and directory structure
import os
import tempfile

# Create a temporary directory structure to simulate the module
temp_dir = tempfile.mkdtemp()
base_dir = temp_dir

# Create the necessary subdirectories
datasets_dir = os.path.join(base_dir, 'datasets')
raw_dir = os.path.join(datasets_dir, 'raw')
os.makedirs(raw_dir, exist_ok=True)

# Define RAW_DATA_PATH as it would be in the actual module
RAW_DATA_PATH = os.path.join(base_dir, 'datasets', 'raw')

def get_raw_data_path(behavior: str) -> str:
    return os.path.join(RAW_DATA_PATH, behavior, 'dataset.json')

# Now define the ARGS dict with a valid behavior string
ARGS = {
    'behavior': 'walking'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_vector_dir Ran
ran; our contract draft was wrong, not the code
nrimsky/caa/behaviors.py
code served (permissive licence) · get_code("252f5af9f6d9f586")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import os
import tempfile

# Create a temporary directory to simulate BASE_DIR
BASE_DIR = tempfile.mkdtemp()

VECTORS_PATH = os.path.join(BASE_DIR, 'vectors')
NORMALIZED_VECTORS_PATH = os.path.join(BASE_DIR, 'normalized_vectors')

def get_vector_dir(behavior: str, normalized=False) -> str:
    return os.path.join(NORMALIZED_VECTORS_PATH if normalized else VECTORS_PATH, behavior)

# Create the directories so they exist
os.makedirs(VECTORS_PATH, exist_ok=True)
os.makedirs(NORMALIZED_VECTORS_PATH, exist_ok=True)

ARGS = {
    'behavior': 'walking',
    'normalized': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
logistic_aggregator Ran
ran on a synthesized input
steering-vectors/steering-vectors/steering_vectors/aggregators.py
code served (permissive licence) · get_code("f66d8b185c1e247d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned function. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from sklearn.linear_model import LogisticRegression

torch.manual_seed(0)

# Create minimal test tensors
pos_acts = torch.randn(2, 4, dtype=torch.float32)  # batch_size=2, dim=4
neg_acts = torch.randn(2, 4, dtype=torch.float32)  # batch_size=2, dim=4

# Define ARGS with sklearn_kwargs parameter
ARGS = {
    "sklearn_kwargs": {"max_iter": 1000, "random_state": 42}
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
sklearn, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
question_dataset_to_steering_dataset Ran
ran; our contract draft was wrong, not the code
wusche1/caa_hallucination/paper/Hallucination/steering_vectors/steering_vector_creation_script.py
pointer only (licence: NONE) · get_code("33007ecbcf4f097a")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wusche1/caa_hallucination when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

tokenize_batch_ab Ran
ran, honoured the contract we drafted
wusche1/caa_hallucination/paper/lib/hallucination_lib.py
pointer only (licence: NONE) · get_code("b732a1ed58c5caf2")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wusche1/caa_hallucination when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

untuple_tensor Ran
ran, honoured the contract we drafted
steering-vectors/steering-vectors/steering_vectors/torch_utils.py
pointer only (licence: MIT); the stored copy get_code serves, from ajyl/QK, is pointer only (licence: NONE) · get_code("0d1b4b7a64984981")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from ajyl/QK, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

build_HOCUS_dataset Not yet run
unverified (harvested, no recorded run)
wusche1/caa_hallucination/paper/Hallucination/data_generation/datagen_functions.py
pointer only (licence: NONE) · get_code("670eaf5a4aadba52")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wusche1/caa_hallucination when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

Also present in other papers' code

Of 22 samples lifted from this paper's linked repositories, 22 carry a function identity and 0 do not. Of the 21 distinct functions with an identity, 4 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 3 later) and 17 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
untuple_tensor 2 other papers
2 later
2505.11756 (2025-05)
Feature Hedging: Correlated Features Break Narrow Sparse Autoencoders
2602.04752 (2026-02)
Decomposing Query-Key Feature Interactions Using Contrastive Covariances
eval_model 1 other paper
1 later
2604.12479 (2026-04)
Meet Dynamic Individual Preferences: Resolving Conflicting Human Value with Paired Fine-Tuning
get_layer_name 1 other paper
1 dated earlier
2311.08968 (2023-11)
Identifying Linear Relational Concepts in Large Language Models
get_module 1 other paper
1 later
2602.04752 (2026-02)
Decomposing Query-Key Feature Interactions Using Contrastive Covariances

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-24.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

We introduce Contrastive Activation Addition (CAA), an innovative method for steering language models by modifying their activations during forward passes. CAA computes "steering vectors" by averaging the difference in residual stream activations between pairs of positive and negative examples of a particular behavior, such as factual versus hallucinatory responses. During inference, these steering vectors are added at all token positions after the user's prompt with either a positive or negative coefficient, allowing precise control over the degree of the targeted behavior. We evaluate CAA's effectiveness on Llama 2 Chat using multiple-choice behavioral question datasets and open-ended generation tasks. We demonstrate that CAA significantly alters model behavior, is effective over and on top of traditional methods like finetuning and system prompt design, and minimally reduces capabilities. Moreover, we gain deeper insights into CAA's mechanisms by employing various activation space interpretation methods. CAA accurately steers model outputs and sheds light on how high-level concepts are represented in Large Language Models (LLMs).

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2312.06681")
get_code_for_paper("2312.06681")
have("2312.06681")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2312.06681.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2312.06681.svg)](https://syntology.ai/paper/2312.06681)

Connect an agent — have() is free.