Papers › Controllable Context Sensitivity and the Knob Behind It

Controllable Context Sensitivity and the Knob Behind It

11 Nov 2024arXiv:2411.07404archive 2025-07-28

Julian Minder, Kevin Du, Niklas Stoehr, Giovanni Monea, Chris Wendler, Robert West, Ryan Cotterell

When making predictions, a language model must trade off how much it relies on its context vs. 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 which controls this sensitivity, determining whether language models answer from the context or their prior knowledge. To guide this search, we design a task for controllable context sensitivity. In this task, we first feed the model a context (Paris is in England) and a question (Where is Paris?); we then instruct the model to either use its prior or contextual knowledge and evaluate whether it generates the correct answer for both intents (either France or England). When fine-tuned on this task, instruction-tuned 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-D 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. These results suggest a single subspace facilitates how the model chooses between context and prior knowledge, hinting at a simple fundamental mechanism that controls this behavior.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2411.07404")

Code

Syntology Ran 0 of 24 code samples harvested from 1 repository linked to this paper; 24 have no recorded run.

By repository: official repository: 24 samples from 1 repository, 0 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

kdu4108/context-vs-prior-finetuning officialmentioned in papermentioned on GitHubpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

24 samples harvested; 0 ran; 0 honoured the contract we drafted; 24 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

24unverified

Licence: 24 of the 24 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from kdu4108/context-vs-prior-finetuning. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

balance_df_by_label_column kdu4108/context-vs-prior-finetuning/preprocessing/dataset.py official repository unverified no licence file found · pointer only · 84f41650402b89f1 · report
convert_fakepedia_dict_to_df kdu4108/context-vs-prior-finetuning/preprocessing/utils.py official repository unverified no licence file found · pointer only · 6d8fd419008ca763 · report
create_dataset kdu4108/context-vs-prior-finetuning/analysis/circuit_utils/das.py official repository unverified no licence file found · pointer only · e736246f0de4c29b · report
create_position_ids_from_input_ids kdu4108/context-vs-prior-finetuning/model_utils/mi_utils.py official repository unverified no licence file found · pointer only · 640aef5d8b077b96 · report
estimate_prob_x_given_e kdu4108/context-vs-prior-finetuning/model_utils/mi_utils.py official repository unverified no licence file found · pointer only · 71e5222467d869d2 · report
format_query kdu4108/context-vs-prior-finetuning/preprocessing/utils.py official repository unverified no licence file found · pointer only · a5e0f7e4358d7948 · report
generalisation_script kdu4108/context-vs-prior-finetuning/generate_run_script.py official repository unverified no licence file found · pointer only · d1aff33e8be373a4 · report
generate_dataset kdu4108/context-vs-prior-finetuning/preprocessing/generate_arithmetic.py official repository unverified no licence file found · pointer only · 3a27b987330622fd · report
generate_few_shot_prompts kdu4108/context-vs-prior-finetuning/analysis/circuit_utils/few_shot.py official repository unverified no licence file found · pointer only · dd8d606eb5d3e410 · report
get_base_script kdu4108/context-vs-prior-finetuning/generate_run_script.py official repository unverified no licence file found · pointer only · bf63f70f32a86ab8 · report
get_ds kdu4108/context-vs-prior-finetuning/generate_run_script.py official repository unverified no licence file found · pointer only · a8a6bf09c1783a7c · report
get_prob kdu4108/context-vs-prior-finetuning/analysis/circuit_utils/decoding.py official repository unverified no licence file found · pointer only · d2c97c6a45243ce9 · report
get_prob_next_word kdu4108/context-vs-prior-finetuning/model_utils/mi_utils.py official repository unverified no licence file found · pointer only · 32418786f8c01765 · report
get_rank kdu4108/context-vs-prior-finetuning/analysis/circuit_utils/decoding.py official repository unverified no licence file found · pointer only · 234d3d97816d505a · report
get_ranks kdu4108/context-vs-prior-finetuning/analysis/circuit_utils/decoding.py official repository unverified no licence file found · pointer only · e23d3bc3d1d61814 · report
load_dataset_from_path kdu4108/context-vs-prior-finetuning/preprocessing/dataset.py official repository unverified no licence file found · pointer only · 49288d350b2a118e · report
load_model kdu4108/context-vs-prior-finetuning/analysis/circuit_utils/model.py official repository unverified no licence file found · pointer only · ffa9d912bb1dd857 · report
load_model_and_tokenizer kdu4108/context-vs-prior-finetuning/model_utils/utils.py official repository unverified no licence file found · pointer only · 63070f500d814722 · report
load_peft kdu4108/context-vs-prior-finetuning/analysis/circuit_utils/model.py official repository unverified no licence file found · pointer only · fd325ab84c0acc3f · report
merge_save_peft kdu4108/context-vs-prior-finetuning/analysis/circuit_utils/model.py official repository unverified no licence file found · pointer only · ff76c82cbc48d3e3 · report
prepare_peft_model kdu4108/context-vs-prior-finetuning/model_utils/utils.py official repository unverified no licence file found · pointer only · ba76be9f90cef907 · report
prepare_tokenizer kdu4108/context-vs-prior-finetuning/model_utils/utils.py official repository unverified no licence file found · pointer only · 124b1789a4bc9f68 · report
remove_instruction kdu4108/context-vs-prior-finetuning/analysis/circuit_utils/das.py official repository unverified no licence file found · pointer only · 93b2a3dbfe1f29af · report
tuple_df kdu4108/context-vs-prior-finetuning/preprocessing/utils.py official repository unverified no licence file found · pointer only · 53e66bdbae1183f6 · report

Tasks

Question AnsweringRetrieval-augmented GenerationSensitivity

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

BASE

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections