Papers › The representation landscape of few-shot learning and fine-tuning in large language models

The representation landscape of few-shot learning and fine-tuning in large language models

5 Sep 2024arXiv:2409.03662archive 2025-07-28

Diego Doimo, Alessandro Serra, Alessio Ansuini, Alberto Cazzaniga

In-context learning (ICL) and supervised fine-tuning (SFT) are two common strategies for improving the performance of modern large language models (LLMs) on specific tasks. Despite their different natures, these strategies often lead to comparable performance gains. However, little is known about whether they induce similar representations inside LLMs. We approach this problem by analyzing the probability landscape of their hidden representations in the two cases. More specifically, we compare how LLMs solve the same question-answering task, finding that ICL and SFT create very different internal structures, in both cases undergoing a sharp transition in the middle of the network. In the first half of the network, ICL shapes interpretable representations hierarchically organized according to their semantic content. In contrast, the probability landscape obtained with SFT is fuzzier and semantically mixed. In the second half of the model, the fine-tuned representations develop probability modes that better encode the identity of answers, while the landscape of ICL representations is characterized by less defined peaks. Our approach reveals the diverse computational strategies developed inside LLMs to solve the same task across different conditions, allowing us to make a step towards designing optimal methods to extract information from language models.

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="2409.03662")

Code

Syntology Ran 11 of 13 code samples harvested from 1 repository linked to this paper; 2 have no recorded run. Of those that ran: 11 ran with no contract checked.

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

diegodoimo/geometry_icl_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

13 samples harvested; 11 ran; 0 honoured the contract we drafted; 2 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.

11ran
2unverified

Licence: 13 of the 13 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 diegodoimo/geometry_icl_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.

compute_accuracy diegodoimo/geometry_icl_finetuning/finetune.py official repository ran no licence file found · pointer only · b16d252479c798a0 · report
compute_distances diegodoimo/geometry_icl_finetuning/extraction/pairwise_distances.py official repository ran no licence file found · pointer only · d371140435e592be · report
find_grad_accumulation_steps diegodoimo/geometry_icl_finetuning/utils/helpers_finetune.py official repository ran no licence file found · pointer only · 95c7235973fc3b16 · report
get_cpt_steps diegodoimo/geometry_icl_finetuning/finetune.py official repository ran no licence file found · pointer only · b345237559add76d · report
get_dataloader diegodoimo/geometry_icl_finetuning/utils/dataloader_utils.py official repository ran no licence file found · pointer only · 07ca7bcd15827c80 · report
get_embdims diegodoimo/geometry_icl_finetuning/extraction/helpers.py official repository ran no licence file found · pointer only · 7c5a7b161c7346f7 · report
get_max_memory_allocated diegodoimo/geometry_icl_finetuning/utils/helpers_finetune.py official repository ran no licence file found · pointer only · 1262b68c811b4637 · report
get_max_memory_reserved diegodoimo/geometry_icl_finetuning/utils/helpers_finetune.py official repository ran fingerprinted no licence file found · pointer only · 364acf45a359d615 · report
get_model diegodoimo/geometry_icl_finetuning/utils/model_utils.py official repository ran no licence file found · pointer only · 7909a9fdbd3ff24a · report
measure_performance diegodoimo/geometry_icl_finetuning/extraction/helpers.py official repository ran no licence file found · pointer only · 1821e57029eddbc2 · report
return_label_overlap diegodoimo/geometry_icl_finetuning/analysis/utils.py official repository ran no licence file found · pointer only · 9a349d02a69bd59f · report
evaluate diegodoimo/geometry_icl_finetuning/finetune.py official repository unverified no licence file found · pointer only · 4e34b8e1dddc6b87 · report
lambda_fn diegodoimo/geometry_icl_finetuning/extract_repr.py official repository unverified no licence file found · pointer only · e9bf2efd0ef0239a · report

Tasks

Few-Shot LearningIn-Context LearningQuestion Answering

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

SFT

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