SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2505.16188 · EMNLP · 2025

SAE-SSV: Supervised Steering in Sparse Representation Spaces for Reliable Control of Language Models

Mengnan Du, Bo Shen, Yongfeng Zhang, Mingyu Jin, Ali Payani, Zirui He

arXiv · PDF · Open in the Atlas

Code that ran

5 of 5 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (2 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 2 failures of our instrument; 0 no recorded run), measured 2026-11-24; 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/2505.16188.json · badge: /api/ran/2505.16188.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
Ineedanamehere/SAE-SSV community
Papers with Code archive
5 ran · 0 no recorded run
FunctionStatusWhere it lives
SSVTrainer Ran
ran on a synthesized input · constructed an object; no result was computed
Ineedanamehere/SAE-SSV/SAE-SSV_v2/SAESTEER/trainer.py
code served (permissive licence) · get_code("8e0593ad972bd301")
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 an instance of its own class, SSVTrainer: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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
import copy

torch.manual_seed(0)

class MockSAE(nn.Module):
    """Minimal SAE module with encode and decode methods."""
    def __init__(self, d_in=4, d_latent=8):
        super().__init__()
        self.d_in = d_in
        self.d_latent = d_latent
        self.encoder = nn.Linear(d_in, d_latent)
        self.decoder = nn.Linear(d_latent, d_in)
    
    def encode(self, x):
        """Returns latent representation."""
        return torch.relu(self.encoder(x))
    
    def decode(self, latent):
        """Returns reconstruction from latent."""
        return self.decoder(latent)

class MockModel(nn.Module):
    """Minimal language model with to_tokens and run_with_hooks."""
    def __init__(self, d_model=4, vocab_size=256, seq_len=10):
        super().__init__()
        self.d_model = d_model
        self.vocab_size = vocab_size
        self.seq_len = seq_len
        self.embedding = nn.Embedding(vocab_size, d_model)
        self.transformer = nn.Sequential(
            nn.Linear(d_model, d_model),
            nn.ReLU(),
            nn.Linear(d_model, d_model),
        )
    
    def to_tokens(self, text):
        """Convert text to token ids."""
        if isinstance(text, str):
            token_ids = [ord(c) % self.vocab_size for c in text[:self.seq_len]]
            token_ids += [0] * (self.seq_len - len(token_ids))
        else:
            token_ids = [0] * self.seq_len
        return torch.tensor([token_ids], dtype=torch.long)
    
    def run_with_hooks(self, tokens, fwd_hooks=None):
        """Run forward pass with hooks."""
        x = self.embedding(tokens)
        
        if fwd_hooks:
            for hook_name, hook_fn in fwd_hooks:
                x = hook_fn(x, None)
        
        batch_size, seq_len, d_model = x.shape
        x_flat = x.reshape(-1, d_model)
        x_flat = self.transformer(x_flat)
        x = x_flat.reshape(batch_size, seq_len, d_model)
        
        return x

model = MockModel(d_model=4, vocab_size=256, seq_len=10)
model.eval()

sae = MockSAE(d_in=4, d_latent=8)
sae.eval()

ARGS = {
    'model': model,
    'sae': sae,
    'layer': 20,
    'device': 'cpu'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch, tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type SSVTrainer — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a SSVTrainer 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
_CompiledWithFallback Ran
ran on a synthesized input · constructed an object; no result was computed
Ineedanamehere/SAE-SSV/SAE-SSV_v2/SAESTEER/trainer.py
code served (permissive licence) · get_code("25f3b80038d8caa1")
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 an instance of its own class, _CompiledWithFallback: the run constructed the object and did not call it, so no result was computed. 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)

# Create a simple original function
def original_func(x):
    return x * 2

# Create a simple compiled function
def compiled_func(x):
    return x * 2

# Create a simple module as original
class SimpleModule(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

# Create a compiled version (can be the same for testing)
class CompiledModule(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

# Instantiate modules
original_module = SimpleModule()
compiled_module = CompiledModule()

ARGS = {
    'original': original_module,
    'compiled': compiled_module,
    'name': 'test_compiled_fallback'
}
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 _CompiledWithFallback — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a _CompiledWithFallback 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
compile_enabled Ran
ran on a synthesized input
Ineedanamehere/SAE-SSV/SAE-SSV_v2/SAESTEER/trainer.py
code served (permissive licence) · get_code("db3a9894f19d4433")
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 bool, ndim 0, 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 os
import torch

# The function compile_enabled() takes no parameters
# It only reads from the environment variable 'SAE_SSV_COMPILE'
# So ARGS should be an empty dict

ARGS = {}
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 bool, ndim 0, dtype family float — no output shape is stated: observe_signature.py could not observe it (no_inputs)
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
maybe_compile Ran
ran; our contract draft was wrong, not the code
Ineedanamehere/SAE-SSV/SAE-SSV_v2/SAESTEER/trainer.py
code served (permissive licence) · get_code("2d0609c151404f6d")
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 _CompiledWithFallback. 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
import os

torch.manual_seed(0)

# Create a simple module that can be compiled
class SimpleModule(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

# Create a simple callable function
def simple_function(x):
    return x * 2 + 1

# Test with module
module = SimpleModule()

# Test with function
fn = simple_function

ARGS = {
    'module_or_fn': module,
    'name': 'test_module'
}
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 _CompiledWithFallback — a _CompiledWithFallback output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a _CompiledWithFallback 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
resolve_precision_dtype Ran
ran; our contract draft was wrong, not the code
Ineedanamehere/SAE-SSV/SAE-SSV_v2/SAESTEER/trainer.py
code served (permissive licence) · get_code("be837b4ee909d273")
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 dtype. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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 os

torch.manual_seed(0)

# The function takes precision (optional) and device (keyword-only, default 'cuda')
# It doesn't actually use device in a way that requires it to be real,
# it just checks if it's a cuda device string for bf16 support checks

ARGS = {
    'precision': 'fp16',
    'device': 'cpu'
}
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 dtype — a dtype output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dtype 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

Also present in other papers' code

Of 5 samples lifted from this paper's linked repositories, 5 carry a function identity and 0 do not. Of the 5 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 5 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.

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

Large language models (LLMs) have demonstrated impressive capabilities in natural language understanding and generation, but controlling their behavior reliably remains challenging, especially in open-ended generation settings. This paper introduces a novel supervised steering approach that operates in sparse, interpretable representation spaces. We employ sparse autoencoders (SAEs) to obtain sparse latent representations that aim to disentangle semantic attributes from model activations. Then we train linear classifiers to identify a small subspace of task-relevant dimensions in latent representations. Finally, we learn supervised steering vectors constrained to this subspace, optimized to align with target behaviors. Experiments across sentiment, truthfulness, and politics polarity steering tasks with multiple LLMs demonstrate that our supervised steering vectors achieve higher success rates with minimal degradation in generation quality compared to existing methods. Further analysis reveals that a notably small subspace is sufficient for effective steering, enabling more targeted and interpretable interventions. Our implementation is publicly available at https: //github.com/Ineedanamehere/SAE-SSV.

For agents

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

get_harvested_code_for_paper("2505.16188")
get_code_for_paper("2505.16188")
have("2505.16188")

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

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

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

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

Connect an agent — have() is free.