SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2311.08968 · 2023

Identifying Linear Relational Concepts in Large Language Models

arXiv · PDF · Open in the Atlas

Code that ran

7 of 8 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; 1 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 3 failures of our instrument; 1 no recorded run), measured 2026-11-22; 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/2311.08968.json · badge: /api/ran/2311.08968.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
chanind/linear-relational-concepts canonical (classifier label)
classifier basis: census
3 ran · 1 no recorded run
chanind/linear-relational community (classifier label)
classifier basis not recorded on the link
4 ran · 0 no recorded run
FunctionStatusWhere it lives
cache_key Ran
ran on a synthesized input
chanind/linear-relational/linear_relational/PromptValidator.py
code served (permissive licence) · get_code("866dc1684b92eaf5")
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 hashlib

# The function takes two string parameters and returns a cache key
# by computing MD5 hash of their concatenation and taking first 15 chars

prompt_text = "What is the meaning of life?"
answer = "The answer is forty-two."

ARGS = {
    "prompt_text": prompt_text,
    "answer": answer,
}
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
chain_modifiers Ran
ran; our contract draft was wrong, not the code
chanind/linear-relational-concepts/linear_relational_concepts/PromptGenerator.py
code served (permissive licence) · get_code("bb5cfab078201dc0")
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

def uppercase_modifier(s: str) -> str:
    return s.upper()

def exclamation_modifier(s: str) -> str:
    return s + "!"

def reverse_modifier(s: str) -> str:
    return s[::-1]

ARGS = {
    "modifiers": [uppercase_modifier, exclamation_modifier, reverse_modifier]
}
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 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
collect_matching_layers Ran
ran on a synthesized input
chanind/linear-relational/linear_relational/lib/layer_matching.py
code served (permissive licence) · get_code("b43c1516c16b8870")
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 typing import Callable, Union

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.ModuleDict({
            'h': nn.ModuleDict({
                '0': nn.Sequential(
                    nn.Linear(4, 8),
                    nn.ModuleDict({'mlp': nn.Linear(8, 4)})
                ),
                '1': nn.Sequential(
                    nn.Linear(4, 8),
                    nn.ModuleDict({'mlp': nn.Linear(8, 4)})
                ),
                '2': nn.Sequential(
                    nn.Linear(4, 8),
                    nn.ModuleDict({'mlp': nn.Linear(8, 4)})
                ),
            })
        })

# Create a model with predictable layer names
class LayeredModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.layer_0 = nn.Linear(4, 8)
        self.layer_1 = nn.Linear(8, 6)
        self.layer_2 = nn.Linear(6, 4)
    
    def forward(self, x):
        x = self.layer_0(x)
        x = self.layer_1(x)
        x = self.layer_2(x)
        return x

# Create the model
model = LayeredModel()

# Test with string layer_matcher
layer_matcher_str = "layer_{num}"

# Test with callable layer_matcher
def custom_matcher(model: nn.Module, layer_num: int) -> str:
    """Callable that returns layer names based on layer number"""
    return f"layer_{layer_num}"

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
first_token_estimator Ran
ran, honoured the contract we drafted
chanind/linear-relational-concepts/linear_relational_concepts/MultitokenEstimator.py
code served (permissive licence) · get_code("0cc534ba632ea333")
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 2, dtype family float, shape (2, 4) 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)

# The function expects:
# object_activations: Sequence[tuple[torch.Tensor, ...]]
# It iterates through each element in object_activations (token_activations)
# and accesses token_activations[0] for each one
# Then stacks and takes mean

# Create a sequence of tuples, where each tuple contains tensors
# Each inner tuple represents activations for one token
# We'll create 2 objects, each with a tuple of tensors

# Tensor shapes: batch_size=2, feature_dim=4
tensor1 = torch.randn(2, 4)
tensor2 = torch.randn(2, 4)
tensor3 = torch.randn(2, 4)

# Create sequence of tuples - each tuple contains one or more tensors
# The function accesses [0] of each tuple, so we need at least one tensor per tuple
object_activations = [
    (tensor1, torch.randn(2, 3)),  # First object's token activations
    (tensor2, torch.randn(2, 3)),  # Second object's token activations
    (tensor3, torch.randn(2, 3)),  # Third object's token activations
]

ARGS = {
    "object_activations": object_activations
}
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 2, dtype family float, shape (2, 4) — shape (2, 4) 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
fix_neg_layer_num Ran
ran on a synthesized input
chanind/linear-relational/linear_relational/lib/layer_matching.py
code served (permissive licence) · get_code("4430146df8492ce2")
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
from torch import nn

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.ModuleDict({
            'h': nn.ModuleDict({
                '0': nn.Sequential(
                    nn.Linear(4, 3),
                    nn.ModuleDict({'mlp': nn.Linear(3, 2)})
                ),
                '1': nn.Sequential(
                    nn.Linear(4, 3),
                    nn.ModuleDict({'mlp': nn.Linear(3, 2)})
                ),
                '2': nn.Sequential(
                    nn.Linear(4, 3),
                    nn.ModuleDict({'mlp': nn.Linear(3, 2)})
                ),
            })
        })
    
    def forward(self, x):
        return x

# Build model with a structure that supports the layer_matcher patterns
model = nn.Sequential(
    nn.Linear(4, 3),
    nn.Linear(3, 2),
    nn.Linear(2, 4),
)

# Add named modules to match the template pattern
model_with_named = nn.Module()
model_with_named.layer_0 = nn.Linear(4, 3)
model_with_named.layer_1 = nn.Linear(3, 2)
model_with_named.layer_2 = nn.Linear(2, 4)
model_with_named.layer_3 = nn.Linear(4, 1)

# Test with string template layer_matcher
layer_matcher_string = "layer_{num}"

# Test with negative layer_num that needs fixing
layer_num_negative = -2

ARGS = {
    "model": model_with_named,
    "layer_matcher": layer_matcher_string,
    "layer_num": layer_num_negative,
}
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_layer_name Ran
ran; our contract draft was wrong, not the code
chanind/linear-relational/linear_relational/lib/layer_matching.py
code served (permissive licence) · get_code("88c0a12555c2f232")
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 transformer-like structure
class SimpleTransformer(nn.Module):
    def __init__(self):
        super().__init__()
        self.transformer = nn.ModuleDict({
            'h': nn.ModuleDict({
                '0': nn.Sequential(
                    nn.Linear(4, 4),
                    nn.Linear(4, 4)
                ),
                '1': nn.Sequential(
                    nn.Linear(4, 4),
                    nn.Linear(4, 4)
                ),
                '2': nn.Sequential(
                    nn.Linear(4, 4),
                    nn.Linear(4, 4)
                ),
            })
        })

model = SimpleTransformer()

# Define layer_matcher as a string template with {num}
layer_matcher_str = "transformer.h.{num}"

# Test with positive layer_num
layer_num_positive = 1

# Create ARGS dict
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
weighted_mean_estimator Ran
ran; our contract draft was wrong, not the code
chanind/linear-relational-concepts/linear_relational_concepts/MultitokenEstimator.py
code served (permissive licence) · get_code("481fa6a8c4bfa067")
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 float, shape (4,) 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)

# The function expects a Sequence of tuples, where each tuple contains torch.Tensor objects
# It stacks and means the tensors within each tuple, then stacks and means across tuples
# So we need a list of tuples of tensors

# Create sample data: 3 objects, each with 2 token activations of dimension 4
object_activations = [
    (torch.randn(4), torch.randn(4)),  # object 1: 2 token activations
    (torch.randn(4), torch.randn(4)),  # object 2: 2 token activations
    (torch.randn(4), torch.randn(4)),  # object 3: 2 token activations
]

ARGS = {
    "object_activations": object_activations,
}
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 float, shape (4,) — shape (4,) 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
mean_estimator Not yet run
unverified (harvested, no recorded run)
chanind/linear-relational-concepts/linear_relational_concepts/MultitokenEstimator.py
code served (permissive licence) · get_code("848b29453a3340a4")
How it ran

no invocation recorded.

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 1 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 1 later) and 7 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
get_layer_name 1 other paper
1 later
2312.06681 (2023-12)
Steering Llama 2 via Contrastive Activation Addition

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-22.

Repositories linked to this paper

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

Abstract

Transformer language models (LMs) have been shown to represent concepts as directions in the latent space of hidden activations. However, for any human-interpretable concept, how can we find its direction in the latent space? We present a technique called linear relational concepts (LRC) for finding concept directions corresponding to human-interpretable concepts by first modeling the relation between subject and object as a linear relational embedding (LRE). We find that inverting the LRE and using earlier object layers results in a powerful technique for finding concept directions that outperforms standard black-box probing classifiers. We evaluate LRCs on their performance as concept classifiers as well as their ability to causally change model output.

For agents

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

get_harvested_code_for_paper("2311.08968")
get_code_for_paper("2311.08968")
have("2311.08968")

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

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

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

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

Connect an agent — have() is free.