{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/eliciting-latent-predictions-from","title":"Eliciting Latent Predictions from Transformers with the Tuned Lens","arxiv_id":"2303.08112","date":"2023-03-14","proceeding":null,"authors":["Nora Belrose","Zach Furman","Logan Smith","Danny Halawi","Igor Ostrovsky","Lev McKinney","Stella Biderman","Jacob Steinhardt"],"abstract":"We analyze transformers from the perspective of iterative inference, seeking to understand how model predictions are refined layer by layer. To do so, we train an affine probe for each block in a frozen pretrained model, making it possible to decode every hidden state into a distribution over the vocabulary. Our method, the \\emph{tuned lens}, is a refinement of the earlier ``logit lens'' technique, which yielded useful insights but is often brittle. We test our method on various autoregressive language models with up to 20B parameters, showing it to be more predictive, reliable and unbiased than the logit lens. With causal experiments, we show the tuned lens uses similar features to the model itself. We also find the trajectory of latent predictions can be used to detect malicious inputs with high accuracy. All code needed to reproduce our results can be found at https://github.com/AlignmentResearch/tuned-lens.","url_abs":"https://arxiv.org/abs/2303.08112v4","url_pdf":"https://arxiv.org/pdf/2303.08112v4.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"eliciting-latent-predictions-from","repo_url":"https://github.com/alignmentresearch/tuned-lens","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"eliciting-latent-predictions-from","repo_url":"https://github.com/neelnanda-io/transformerlens","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"jax","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"language-modelling","task_name":"Language Modelling"}],"methods":[{"method_slug":"test","method_name":"Test"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2303.08112","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2303.08112"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/alignmentresearch/tuned-lens","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/neelnanda-io/transformerlens","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"unverified":15},"by_repo_kind":{"official":{"samples":15,"ran":0,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"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"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"05340b7010647c2e","entry":"ablate_layer","repo":"alignmentresearch/tuned-lens","repo_kind":"official","path":"tuned_lens/causal/ablation.py","file_url":"https://github.com/alignmentresearch/tuned-lens/blob/HEAD/tuned_lens/causal/ablation.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"05340b7010647c2e"}},{"code_sha256_prefix":"5873fbd5d509497a","entry":"ablate_subspace","repo":"alignmentresearch/tuned-lens","repo_kind":"official","path":"tuned_lens/causal/subspaces.py","file_url":"https://github.com/alignmentresearch/tuned-lens/blob/HEAD/tuned_lens/causal/subspaces.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"5873fbd5d509497a"}},{"code_sha256_prefix":"03a35f0556b1fb36","entry":"assert_type","repo":"alignmentresearch/tuned-lens","repo_kind":"official","path":"tuned_lens/utils.py","file_url":"https://github.com/alignmentresearch/tuned-lens/blob/HEAD/tuned_lens/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"03a35f0556b1fb36"}},{"code_sha256_prefix":"53ed6e74b623ee2b","entry":"available_lens_artifacts","repo":"alignmentresearch/tuned-lens","repo_kind":"official","path":"tuned_lens/load_artifacts.py","file_url":"https://github.com/alignmentresearch/tuned-lens/blob/HEAD/tuned_lens/load_artifacts.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"53ed6e74b623ee2b"}},{"code_sha256_prefix":"a7da4d3f0adefb46","entry":"chunk_and_tokenize","repo":"alignmentresearch/tuned-lens","repo_kind":"official","path":"tuned_lens/data.py","file_url":"https://github.com/alignmentresearch/tuned-lens/blob/HEAD/tuned_lens/data.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"a7da4d3f0adefb46"}},{"code_sha256_prefix":"148a538543a231c3","entry":"derange","repo":"alignmentresearch/tuned-lens","repo_kind":"official","path":"tuned_lens/causal/utils.py","file_url":"https://github.com/alignmentresearch/tuned-lens/blob/HEAD/tuned_lens/causal/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"148a538543a231c3"}},{"code_sha256_prefix":"b44a86959a6f33aa","entry":"get_columns_all_equal","repo":"alignmentresearch/tuned-lens","repo_kind":"official","path":"tuned_lens/data.py","file_url":"https://github.com/alignmentresearch/tuned-lens/blob/HEAD/tuned_lens/data.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"b44a86959a6f33aa"}},{"code_sha256_prefix":"e3a98b026c8ac489","entry":"get_key_path","repo":"alignmentresearch/tuned-lens","repo_kind":"official","path":"tuned_lens/model_surgery.py","file_url":"https://github.com/alignmentresearch/tuned-lens/blob/HEAD/tuned_lens/model_surgery.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"e3a98b026c8ac489"}},{"code_sha256_prefix":"545cc2aefbd57975","entry":"get_unembedding_matrix","repo":"alignmentresearch/tuned-lens","repo_kind":"official","path":"tuned_lens/model_surgery.py","file_url":"https://github.com/alignmentresearch/tuned-lens/blob/HEAD/tuned_lens/model_surgery.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"545cc2aefbd57975"}},{"code_sha256_prefix":"553b8a92b63240ca","entry":"get_value_for_key","repo":"alignmentresearch/tuned-lens","repo_kind":"official","path":"tuned_lens/model_surgery.py","file_url":"https://github.com/alignmentresearch/tuned-lens/blob/HEAD/tuned_lens/model_surgery.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"553b8a92b63240ca"}},{"code_sha256_prefix":"001dd74061137709","entry":"load_lens_artifacts","repo":"alignmentresearch/tuned-lens","repo_kind":"official","path":"tuned_lens/load_artifacts.py","file_url":"https://github.com/alignmentresearch/tuned-lens/blob/HEAD/tuned_lens/load_artifacts.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"001dd74061137709"}},{"code_sha256_prefix":"649fe343c07b8712","entry":"maybe_all_cat","repo":"alignmentresearch/tuned-lens","repo_kind":"official","path":"tuned_lens/utils.py","file_url":"https://github.com/alignmentresearch/tuned-lens/blob/HEAD/tuned_lens/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"649fe343c07b8712"}},{"code_sha256_prefix":"b060d589bc7c497e","entry":"maybe_all_gather_lists","repo":"alignmentresearch/tuned-lens","repo_kind":"official","path":"tuned_lens/utils.py","file_url":"https://github.com/alignmentresearch/tuned-lens/blob/HEAD/tuned_lens/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"b060d589bc7c497e"}},{"code_sha256_prefix":"8142229159bd502a","entry":"remove_subspace","repo":"alignmentresearch/tuned-lens","repo_kind":"official","path":"tuned_lens/causal/subspaces.py","file_url":"https://github.com/alignmentresearch/tuned-lens/blob/HEAD/tuned_lens/causal/subspaces.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"8142229159bd502a"}},{"code_sha256_prefix":"313c6e8555ede0bd","entry":"sample_derangement","repo":"alignmentresearch/tuned-lens","repo_kind":"official","path":"tuned_lens/causal/utils.py","file_url":"https://github.com/alignmentresearch/tuned-lens/blob/HEAD/tuned_lens/causal/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"313c6e8555ede0bd"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}