SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2603.01281 · 2026

Spectral Attention Steering for Prompt Highlighting

Shay Cohen, Yongxin Yang, Keshuang Li, Tiejun Ma, Yuchen Niu, Weixian Li

arXiv · PDF · Open in the Atlas

Code that ran

7 of 7 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; 2 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 5 failures of our instrument; 0 no recorded run), measured 2026-11-22; 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/2603.01281.json · badge: /api/ran/2603.01281.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
waylonli/SEKA canonical (classifier label)
classifier basis: census
7 ran · 0 no recorded run
FunctionStatusWhere it lives
compute_em Ran
ran, honoured the contract we drafted
waylonli/SEKA/pastalib/profiler/synthetic_profiler.py
code served (permissive licence) · get_code("d871af3ba7e68d36")
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 re
import string

def normalize_answer(s: str) -> str:
    """
    Lower text, remove punctuation, articles and extra whitespace.
    """

    def remove_articles(text):
        return re.sub('\\b(a|an|the)\\b', ' ', text)

    def remove_punc(text):
        return text.translate(str.maketrans('', '', string.punctuation))

    def white_space_fix(text):
        return ' '.join(text.split())
    return white_space_fix(remove_articles(remove_punc(s.lower())))

def compute_em(pred: str, gold: str) -> int:
    return int(normalize_answer(pred) == normalize_answer(gold))

# Setup code to construct valid arguments
ARGS = {
    "pred": "The quick brown fox",
    "gold": "the quick brown fox"
}
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 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
encode_with_markers Ran
ran, honoured the contract we drafted
waylonli/SEKA/src/utils.py
code served (permissive licence) · get_code("8bfc2ad29826ef75")
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 3, 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
import re
from typing import List, Union

torch.manual_seed(0)

class StandInTokenizer:
    """Minimal tokenizer mock that supports the interface used by encode_with_markers"""
    def __call__(self, text, return_offsets_mapping=False, padding=False, 
                 truncation=False, add_special_tokens=False, return_tensors=None):
        # Handle both single string and list of strings
        if isinstance(text, str):
            text = [text]
        
        batch_size = len(text)
        seq_len = 8
        
        # Create token ids (batch_size x seq_len)
        input_ids = torch.randint(0, 100, (batch_size, seq_len), dtype=torch.long)
        
        # Create attention mask (batch_size x seq_len)
        attention_mask = torch.ones((batch_size, seq_len), dtype=torch.long)
        
        # Create offset_mapping (batch_size x seq_len x 2)
        # Each token maps to character positions
        offset_mapping = []
        for b, sample_text in enumerate(text):
            sample_offsets = []
            char_pos = 0
            for token_idx in range(seq_len):
                # Distribute characters across tokens
                token_len = max(1, len(sample_text) // seq_len)
                start = char_pos
                end = min(char_pos + token_len, len(sample_text))
                sample_offsets.append((start, end))
                char_pos = end
            offset_mapping.append(sample_offsets)
        
        offset_mapping = torch.tensor(offset_mapping, dtype=torch.long)
        
        result = {
            'input_ids': input_ids,
            'attention_mask': attention_mask,
            'offset_mapping': offset_mapping,
        }
        
        return result

# Setup test data
text_input = "This is **important** text with **markers**"
tokenizer = StandInTokenizer()

ARGS = {
    'text': text_input,
    'tokenizer': tokenizer,
    'm_start': '**',
    'm_end': '**',
}
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 3, 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
get_triplets Ran
ran; our contract draft was wrong, not the code
waylonli/SEKA/pastalib/profiler/synthetic_profiler.py
code served (permissive licence) · get_code("ef9a080e47ea8f31")
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 2, 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

torch.manual_seed(0)

ex = {
    'context_1': 'The quick brown fox jumps over the lazy dog',
    'context_2': 'A fast brown fox leaps across a sleeping dog',
    'question_1': 'What does the fox do?',
    'answer_1': 'jumps',
    'question_2': 'How does the fox move?',
    'answer_2': 'leaps'
}

ARGS = {
    'ex': ex
}
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 2, 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
normalize_answer Ran
ran; our contract draft was wrong, not the code
waylonli/SEKA/pastalib/profiler/synthetic_profiler.py
code served (permissive licence) · get_code("76b695cd06f395b4")
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 re
import string

def normalize_answer(s: str) -> str:
    """
    Lower text, remove punctuation, articles and extra whitespace.
    """

    def remove_articles(text):
        return re.sub('\\b(a|an|the)\\b', ' ', text)

    def remove_punc(text):
        return text.translate(str.maketrans('', '', string.punctuation))

    def white_space_fix(text):
        return ' '.join(text.split())
    return white_space_fix(remove_articles(remove_punc(s.lower())))

ARGS = {
    "s": "The Quick Brown Fox! A lazy dog, and the rest."
}
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
phi Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
waylonli/SEKA/src/utils.py
code served (permissive licence) · get_code("b409389f20aac5ac")
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)

# Create a small tensor for input x
x = torch.randn(2, 4)

# Test with None name
ARGS = {
    'x': x,
    'name': None
}

# Alternative test cases could be:
# ARGS = {'x': x, 'name': 'squared-exponential'}
# ARGS = {'x': x, 'name': 'tanh'}
# ARGS = {'x': x, 'name': 'elu'}
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
phi_inv Ran
ran; our contract draft was wrong, not the code
waylonli/SEKA/src/utils.py
code served (permissive licence) · get_code("3876af8c7b30d8a7")
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)

# Create a small tensor for testing
x = torch.tensor([[0.5, 0.3, 0.7, 0.2],
                   [0.1, 0.9, 0.4, 0.6]], dtype=torch.float32)

# Test with different name values
# The function handles: None, 'squared-exponential', 'tanh', 'elu', and default case
name = 'tanh'

ARGS = {
    'x': x,
    '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 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
read_head_config Ran
ran; our contract draft was wrong, not the code
waylonli/SEKA/pastalib/pasta.py
code served (permissive licence) · get_code("86ef6c9f0cf8b345")
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 dict. 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 json
import tempfile
import os

# Create a temporary JSON file with valid head config
temp_dir = tempfile.mkdtemp()
config_file = os.path.join(temp_dir, "head_config.json")
config_data = {
    "num_heads": 8,
    "hidden_dim": 512,
    "output_dim": 10,
    "dropout": 0.1
}
with open(config_file, 'w') as f:
    json.dump(config_data, f)

# Test case 1: JSON file path
pasta_head_config_file = config_file

# Test case 2: JSON string (alternative format)
pasta_head_config_string = json.dumps(config_data)

ARGS = {
    "pasta_head_config": pasta_head_config_file
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 0 later) and 6 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
read_head_config 1 other paper
1 dated earlier
2311.02262 (2023-11)
Tell Your Model Where to Attend: Post-hoc Attention Steering for LLMs

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

Attention steering is an important technique for controlling model focus, enabling capabilities such as prompt highlighting, where the model prioritises userspecified text. However, existing attention steering methods require explicit storage of the full attention matrix, making them incompatible with memory-efficient implementations like FlashAttention. We introduce Spectral Editing Key Amplification (SEKA), a training-free steering method that tackles this by directly editing key embeddings before attention computation. SEKA uses spectral decomposition to steer key embeddings towards latent directions that amplify attention scores for certain tokens. We extend this to Adaptive SEKA (AdaSEKA), a query-adaptive variant that uses a training-free routing mechanism to dynamically combine multiple expert subspaces based on the prompt's semantic intent. Our experiments show both methods significantly outperform strong baselines on standard steering benchmarks while adding much lower latency and memory overhead, in compatibility with optimised attention.

For agents

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

get_harvested_code_for_paper("2603.01281")
get_code_for_paper("2603.01281")
have("2603.01281")

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

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

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

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

Connect an agent — have() is free.