{"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/quiet-star-language-models-can-teach","title":"Quiet-STaR: Language Models Can Teach Themselves to Think Before Speaking","arxiv_id":"2403.09629","date":"2024-03-14","proceeding":null,"authors":["Eric Zelikman","Georges Harik","Yijia Shao","Varuna Jayasiri","Nick Haber","Noah D. Goodman"],"abstract":"When writing and talking, people sometimes pause to think. Although reasoning-focused works have often framed reasoning as a method of answering questions or completing agentic tasks, reasoning is implicit in almost all written text. For example, this applies to the steps not stated between the lines of a proof or to the theory of mind underlying a conversation. In the Self-Taught Reasoner (STaR, Zelikman et al. 2022), useful thinking is learned by inferring rationales from few-shot examples in question-answering and learning from those that lead to a correct answer. This is a highly constrained setting -- ideally, a language model could instead learn to infer unstated rationales in arbitrary text. We present Quiet-STaR, a generalization of STaR in which LMs learn to generate rationales at each token to explain future text, improving their predictions. We address key challenges, including 1) the computational cost of generating continuations, 2) the fact that the LM does not initially know how to generate or use internal thoughts, and 3) the need to predict beyond individual next tokens. To resolve these, we propose a tokenwise parallel sampling algorithm, using learnable tokens indicating a thought's start and end, and an extended teacher-forcing technique. Encouragingly, generated rationales disproportionately help model difficult-to-predict tokens and improve the LM's ability to directly answer difficult questions. In particular, after continued pretraining of an LM on a corpus of internet text with Quiet-STaR, we find zero-shot improvements on GSM8K (5.9%$\\rightarrow$10.9%) and CommonsenseQA (36.3%$\\rightarrow$47.2%) and observe a perplexity improvement of difficult tokens in natural text. Crucially, these improvements require no fine-tuning on these tasks. Quiet-STaR marks a step towards LMs that can learn to reason in a more general and scalable way.","url_abs":"https://arxiv.org/abs/2403.09629v2","url_pdf":"https://arxiv.org/pdf/2403.09629v2.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":"quiet-star-language-models-can-teach","repo_url":"https://github.com/ezelikman/quiet-star","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"quiet-star-language-models-can-teach","repo_url":"https://github.com/expz/quiet-star","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"gsm8k","task_name":"GSM8K"},{"task_slug":"language-modelling","task_name":"Language Modelling"},{"task_slug":"question-answering","task_name":"Question Answering"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2403.09629","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2403.09629"}},"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/ezelikman/quiet-star","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/expz/quiet-star","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran_fixture":2,"ran":1,"ran_draft_wrong":1,"unverified":5},"by_repo_kind":{"official":{"samples":5,"ran":4,"repositories":1},"listed":{"samples":4,"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":"30d7eec482ebf6b1","entry":"repeat_kv","repo":"ezelikman/quiet-star","repo_kind":"official","path":"modeling_mistral.py","file_url":"https://github.com/ezelikman/quiet-star/blob/HEAD/modeling_mistral.py","link_basis":"plan_row","language":"python","status":"ran_fixture","verification_level":2,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"30d7eec482ebf6b1"}},{"code_sha256_prefix":"d61c483a3c2b3156","entry":"apply_rotary_pos_emb","repo":"ezelikman/quiet-star","repo_kind":"official","path":"modeling_mistral.py","file_url":"https://github.com/ezelikman/quiet-star/blob/HEAD/modeling_mistral.py","link_basis":"plan_row","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"d61c483a3c2b3156"}},{"code_sha256_prefix":"ff5a6d2bdcf9b4d6","entry":"extract_first_integer","repo":"ezelikman/quiet-star","repo_kind":"official","path":"zero-shotcot-eval.py","file_url":"https://github.com/ezelikman/quiet-star/blob/HEAD/zero-shotcot-eval.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"ff5a6d2bdcf9b4d6"}},{"code_sha256_prefix":"b99eea6376d1e212","entry":"rotate_half","repo":"ezelikman/quiet-star","repo_kind":"official","path":"modeling_mistral.py","file_url":"https://github.com/ezelikman/quiet-star/blob/HEAD/modeling_mistral.py","link_basis":"plan_row","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"b99eea6376d1e212"}},{"code_sha256_prefix":"2401f633aa000f98","entry":"flatten","repo":"expz/quiet-star","repo_kind":"listed","path":"quiet_star/config.py","file_url":"https://github.com/expz/quiet-star/blob/HEAD/quiet_star/config.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":"2401f633aa000f98"}},{"code_sha256_prefix":"4b0e31de008d36c4","entry":"model_init","repo":"ezelikman/quiet-star","repo_kind":"official","path":"quiet-star-train.py","file_url":"https://github.com/ezelikman/quiet-star/blob/HEAD/quiet-star-train.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"4b0e31de008d36c4"}},{"code_sha256_prefix":"a37f369e2dcf0c05","entry":"process_batch","repo":"expz/quiet-star","repo_kind":"listed","path":"quiet_star/dataset.py","file_url":"https://github.com/expz/quiet-star/blob/HEAD/quiet_star/dataset.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":"a37f369e2dcf0c05"}},{"code_sha256_prefix":"0b6eafac736854a5","entry":"random_split_on_whitespace","repo":"expz/quiet-star","repo_kind":"listed","path":"quiet_star/dataset.py","file_url":"https://github.com/expz/quiet-star/blob/HEAD/quiet_star/dataset.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":"0b6eafac736854a5"}},{"code_sha256_prefix":"b290e886abb0fe31","entry":"to_mlx","repo":"expz/quiet-star","repo_kind":"listed","path":"quiet_star/dataset.py","file_url":"https://github.com/expz/quiet-star/blob/HEAD/quiet_star/dataset.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":"b290e886abb0fe31"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}