SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2406.10868 · 2024

Identifying Query-Relevant Neurons in Large Language Models for Long-Form Texts

arXiv · PDF · Open in the Atlas

Code that ran

3 of 3 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; 0 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 3 failures of our instrument; 0 no recorded run), measured 2026-11-23; 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/2406.10868.json · badge: /api/ran/2406.10868.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
tigerchen52/qrneuron canonical (classifier label)
classifier basis: census
3 ran · 0 no recorded run
FunctionStatusWhere it lives
get_attributes Ran
ran; our contract draft was wrong, not the code
tigerchen52/qrneuron/keyneuron/neuron_attribution/_patch.py
pointer only (licence: MIT); the stored copy get_code serves, from JP-25/KnowBias, is pointer only (licence: NONE) · get_code("44b3ed63235aa487")
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 JP-25/KnowBias, 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.

get_ff_layer Ran
ran; our contract draft was wrong, not the code
tigerchen52/qrneuron/keyneuron/neuron_attribution/_patch.py
code served (permissive licence) · get_code("98b536c6d2cf8aa6")
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 FeedForwardBlock. 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 minimal model structure that matches what get_ff_layer expects
# It needs:
# - bert.encoder.layer as a ModuleList (indexable)
# - Each layer should have an 'intermediate' attribute (or whatever ff_attrs specifies)

class FeedForwardBlock(nn.Module):
    def __init__(self):
        super().__init__()
        self.dense = nn.Linear(4, 8)
    
    def forward(self, x):
        return self.dense(x)

class TransformerLayer(nn.Module):
    def __init__(self):
        super().__init__()
        self.intermediate = FeedForwardBlock()
        self.output = nn.Linear(8, 4)
    
    def forward(self, x):
        x = self.intermediate(x)
        x = self.output(x)
        return x

class BertEncoder(nn.Module):
    def __init__(self, num_layers=3):
        super().__init__()
        self.layer = nn.ModuleList([TransformerLayer() for _ in range(num_layers)])
    
    def forward(self, x):
        for layer in self.layer:
            x = layer(x)
        return x

class BertModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.encoder = BertEncoder(num_layers=3)
    
    def forward(self, x):
        return self.encoder(x)

class FullModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.bert = BertModel()
    
    def forward(self, x):
        return self.bert(x)

# Construct the arguments
model = FullModel()
layer_idx = 1
transformer_layers_attr = 'bert.encoder.layer'
ff_attrs = 'intermediate'

ARGS = {
    'model': model,
    'layer_idx': layer_idx,
    'transformer_layers_attr': transformer_layers_attr,
    'ff_attrs': ff_attrs
}
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 FeedForwardBlock — a FeedForwardBlock output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a FeedForwardBlock 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
register_hook Ran
ran; our contract draft was wrong, not the code
tigerchen52/qrneuron/keyneuron/neuron_attribution/_patch.py
code served (permissive licence) · get_code("ef128f49c3f32971")
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 RemovableHandle. 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
from typing import Callable

torch.manual_seed(0)

# Build a minimal transformer-like model structure
class FeedForwardLayer(nn.Module):
    def __init__(self):
        super().__init__()
        self.dense = nn.Linear(4, 8)
    
    def forward(self, x):
        return self.dense(x)

class TransformerLayer(nn.Module):
    def __init__(self):
        super().__init__()
        self.intermediate = FeedForwardLayer()
    
    def forward(self, x):
        return self.intermediate(x)

class BertEncoder(nn.Module):
    def __init__(self, num_layers=3):
        super().__init__()
        self.layer = nn.ModuleList([TransformerLayer() for _ in range(num_layers)])
    
    def forward(self, x):
        for layer in self.layer:
            x = layer(x)
        return x

class SimpleTransformerModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.bert = nn.Module()
        self.bert.encoder = BertEncoder(num_layers=3)
    
    def forward(self, x):
        return self.bert.encoder(x)

# Create model
model = SimpleTransformerModel()

# Create a simple hook function that does something with the output
def hook_function(output):
    pass

# Define arguments for register_hook
ARGS = {
    'model': model,
    'layer_idx': 1,
    'f': hook_function,
    'transformer_layers_attr': 'bert.encoder.layer',
    'ff_attrs': 'intermediate'
}
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 RemovableHandle — a RemovableHandle output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a RemovableHandle 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 3 samples lifted from this paper's linked repositories, 3 carry a function identity and 0 do not. Of the 3 distinct functions with an identity, 3 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 0 the same month, 1 later) and 0 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_attributes 6 other papers
4 dated earlier, 1 later, 1 same year, order not determinable · 1 only as an assembly brick
2202.05262 (2022-02)
Locating and Editing Factual Associations in GPT
2311.09053 (2023-11)
Assessing Knowledge Editing in Language Models via Relation Perspective
2311.09060 (2023-11)
Do Localization Methods Actually Localize Memorized Data in LLMs? A Tale of Two Benchmarks
and 3 more not named here
get_ff_layer 2 other papers
2 dated earlier
2311.09053 (2023-11)
Assessing Knowledge Editing in Language Models via Relation Perspective
2405.02421 (2024-05)
What does the Knowledge Neuron Thesis Have to do with Knowledge?
register_hook 2 other papers
2 dated earlier
2311.09053 (2023-11)
Assessing Knowledge Editing in Language Models via Relation Perspective
2405.02421 (2024-05)
What does the Knowledge Neuron Thesis Have to do with Knowledge?

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

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) possess vast amounts of knowledge within their parameters, prompting research into methods for locating and editing this knowledge. Previous work has largely focused on locating entity-related (often single-token) facts in smaller models. However, several key questions remain unanswered: (1) How can we effectively locate query-relevant neurons in decoder-only LLMs, such as Llama and Mistral? (2) How can we address the challenge of long-form (or free-form) text generation? (3) Are there localized knowledge regions in LLMs? In this study, we introduce Query-Relevant Neuron Cluster Attribution (QRNCA), a novel architecture-agnostic framework capable of identifying query-relevant neurons in LLMs. QRNCA allows for the examination of long-form answers beyond triplet facts by employing the proxy task of multi-choice question answering. To evaluate the effectiveness of our detected neurons, we build two multi-choice QA datasets spanning diverse domains and languages. Empirical evaluations demonstrate that our method outperforms baseline methods significantly. Further, analysis of neuron distributions reveals the presence of visible localized regions, particularly within different domains. Finally, we show potential applications of our detected neurons in knowledge editing and neuron-based prediction.

For agents

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

get_harvested_code_for_paper("2406.10868")
get_code_for_paper("2406.10868")
have("2406.10868")

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

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

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

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

Connect an agent — have() is free.