SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2411.07404 · ICLR · 2025

Controllable Context Sensitivity and the Knob Behind It

Niklas Stoehr, Ryan Cotterell, Chris Wendler, Giovanni Monea, Robert West, Julian Minder, Kevin Du, D Eth, Zürich Epfl

arXiv · PDF · Open in the Atlas

Code that ran

16 of 24 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; 4 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 12 failures of our instrument; 8 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/2411.07404.json · badge: /api/ran/2411.07404.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
kdu4108/context-vs-prior-finetuning canonical (classifier label)
classifier basis: census
16 ran · 8 no recorded run
FunctionStatusWhere it lives
balance_df_by_label_column Ran
ran, honoured the contract we drafted
kdu4108/context-vs-prior-finetuning/preprocessing/dataset.py
pointer only (licence: NONE) · get_code("84f41650402b89f1")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, kdu4108/context-vs-prior-finetuning 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.

convert_fakepedia_dict_to_df Ran
ran; our contract draft was wrong, not the code
kdu4108/context-vs-prior-finetuning/preprocessing/utils.py
pointer only (licence: NONE) · get_code("6d8fd419008ca763")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, kdu4108/context-vs-prior-finetuning 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.

create_position_ids_from_input_ids Ran
ran; our contract draft was wrong, not the code
kdu4108/context-vs-prior-finetuning/model_utils/mi_utils.py
pointer only (licence: NONE) · get_code("640aef5d8b077b96")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, kdu4108/context-vs-prior-finetuning 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.

estimate_prob_x_given_e Ran
ran, honoured the contract we drafted
kdu4108/context-vs-prior-finetuning/model_utils/mi_utils.py
pointer only (licence: NONE) · get_code("71e5222467d869d2")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, kdu4108/context-vs-prior-finetuning 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.

format_query Ran
ran; our contract draft was wrong, not the code
kdu4108/context-vs-prior-finetuning/preprocessing/utils.py
pointer only (licence: NONE) · get_code("a5e0f7e4358d7948")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, kdu4108/context-vs-prior-finetuning 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.

generalisation_script Ran
ran; our contract draft was wrong, not the code
kdu4108/context-vs-prior-finetuning/generate_run_script.py
pointer only (licence: NONE) · get_code("d1aff33e8be373a4")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, kdu4108/context-vs-prior-finetuning 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.

generate_dataset Ran
ran; our contract draft was wrong, not the code
kdu4108/context-vs-prior-finetuning/preprocessing/generate_arithmetic.py
pointer only (licence: NONE) · get_code("3a27b987330622fd")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, kdu4108/context-vs-prior-finetuning 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_base_script Ran
ran; our contract draft was wrong, not the code
kdu4108/context-vs-prior-finetuning/generate_run_script.py
pointer only (licence: NONE) · get_code("bf63f70f32a86ab8")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, kdu4108/context-vs-prior-finetuning 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_ds Ran
ran; our contract draft was wrong, not the code
kdu4108/context-vs-prior-finetuning/generate_run_script.py
pointer only (licence: NONE) · get_code("a8a6bf09c1783a7c")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, kdu4108/context-vs-prior-finetuning 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_prob Ran
ran; our contract draft was wrong, not the code
kdu4108/context-vs-prior-finetuning/analysis/circuit_utils/decoding.py
pointer only (licence: NONE) · get_code("d2c97c6a45243ce9")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, kdu4108/context-vs-prior-finetuning 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_prob_next_word Ran
ran, honoured the contract we drafted
kdu4108/context-vs-prior-finetuning/model_utils/mi_utils.py
pointer only (licence: NONE) · get_code("32418786f8c01765")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, kdu4108/context-vs-prior-finetuning 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_rank Ran
ran; our contract draft was wrong, not the code
kdu4108/context-vs-prior-finetuning/analysis/circuit_utils/decoding.py
pointer only (licence: NONE) · get_code("234d3d97816d505a")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, kdu4108/context-vs-prior-finetuning 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.

load_dataset_from_path Ran
ran, honoured the contract we drafted
kdu4108/context-vs-prior-finetuning/preprocessing/dataset.py
pointer only (licence: NONE) · get_code("49288d350b2a118e")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, kdu4108/context-vs-prior-finetuning 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.

prepare_tokenizer Ran
ran; our contract draft was wrong, not the code
kdu4108/context-vs-prior-finetuning/model_utils/utils.py
pointer only (licence: NONE) · get_code("124b1789a4bc9f68")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, kdu4108/context-vs-prior-finetuning 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.

remove_instruction Ran
ran; our contract draft was wrong, not the code
kdu4108/context-vs-prior-finetuning/analysis/circuit_utils/das.py
pointer only (licence: NONE) · get_code("93b2a3dbfe1f29af")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, kdu4108/context-vs-prior-finetuning 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.

tuple_df Ran
ran; our contract draft was wrong, not the code
kdu4108/context-vs-prior-finetuning/preprocessing/utils.py
pointer only (licence: NONE) · get_code("53e66bdbae1183f6")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, kdu4108/context-vs-prior-finetuning 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.

create_dataset Not yet run
unverified (harvested, no recorded run)
kdu4108/context-vs-prior-finetuning/analysis/circuit_utils/das.py
pointer only (licence: NONE) · get_code("e736246f0de4c29b")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, kdu4108/context-vs-prior-finetuning 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.

generate_few_shot_prompts Not yet run
unverified (harvested, no recorded run)
kdu4108/context-vs-prior-finetuning/analysis/circuit_utils/few_shot.py
pointer only (licence: NONE) · get_code("dd8d606eb5d3e410")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, kdu4108/context-vs-prior-finetuning 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.

get_ranks Not yet run
unverified (harvested, no recorded run)
kdu4108/context-vs-prior-finetuning/analysis/circuit_utils/decoding.py
pointer only (licence: NONE) · get_code("e23d3bc3d1d61814")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, kdu4108/context-vs-prior-finetuning 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.

load_model Not yet run
unverified (harvested, no recorded run)
kdu4108/context-vs-prior-finetuning/analysis/circuit_utils/model.py
pointer only (licence: NONE) · get_code("ffa9d912bb1dd857")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, kdu4108/context-vs-prior-finetuning 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.

load_model_and_tokenizer Not yet run
unverified (harvested, no recorded run)
kdu4108/context-vs-prior-finetuning/model_utils/utils.py
pointer only (licence: NONE) · get_code("63070f500d814722")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, kdu4108/context-vs-prior-finetuning 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.

load_peft Not yet run
unverified (harvested, no recorded run)
kdu4108/context-vs-prior-finetuning/analysis/circuit_utils/model.py
pointer only (licence: NONE) · get_code("fd325ab84c0acc3f")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, kdu4108/context-vs-prior-finetuning 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.

merge_save_peft Not yet run
unverified (harvested, no recorded run)
kdu4108/context-vs-prior-finetuning/analysis/circuit_utils/model.py
pointer only (licence: NONE) · get_code("ff76c82cbc48d3e3")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, kdu4108/context-vs-prior-finetuning 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.

prepare_peft_model Not yet run
unverified (harvested, no recorded run)
kdu4108/context-vs-prior-finetuning/model_utils/utils.py
pointer only (licence: NONE) · get_code("ba76be9f90cef907")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, kdu4108/context-vs-prior-finetuning 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 24 samples lifted from this paper's linked repositories, 24 carry a function identity and 0 do not. Of the 24 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 24 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-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

When making predictions, a language model must trade off how much it relies on its context versus its prior knowledge. Choosing how sensitive the model is to its context is a fundamental functionality, as it enables the model to excel at tasks like retrieval-augmented generation and question-answering. In this paper, we search for a knob that controls this sensitivity, determining whether language models answer from the context or their prior knowledge. To guide this search, we first design a task for controllable context sensitivity. In this task, we feed the model a context, e.g., Paris is in England, and a question, e.g., Where is Paris?. Then, we instruct the model to either use its prior or contextual knowledge and evaluate whether it generates the correct answer for both intents, i.e., either France or England. When fine-tuned on this task, instruct versions of Llama-3.1, Mistral-v0.3, and Gemma-2 can solve it with high accuracy (85-95%). Analyzing these high-performing models, we narrow down which layers may be important to context sensitivity using a novel linear time algorithm. Then, in each model, we identify a 1-dimensional subspace in a single layer that encodes whether the model follows context or prior knowledge. Interestingly, while we identify this subspace in a fine-tuned model, we find that the exact same subspace serves as an effective knob in not only that model but also non-fine-tuned instruct and base models of that model family. Finally, we show a strong correlation between a model's performance and how distinctly it separates context-agreeing from context-ignoring answers in this subspace. Our results suggest that a single fundamental subspace facilitates how the model chooses between context and prior knowledge.

For agents

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

get_harvested_code_for_paper("2411.07404")
get_code_for_paper("2411.07404")
have("2411.07404")

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

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

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

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

Connect an agent — have() is free.