{"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/causal-language-modeling-can-elicit-search","title":"Causal Language Modeling Can Elicit Search and Reasoning Capabilities on Logic Puzzles","arxiv_id":"2409.10502","date":"2024-09-16","proceeding":null,"authors":["Kulin Shah","Nishanth Dikkala","Xin Wang","Rina Panigrahy"],"abstract":"Causal language modeling using the Transformer architecture has yielded remarkable capabilities in Large Language Models (LLMs) over the last few years. However, the extent to which fundamental search and reasoning capabilities emerged within LLMs remains a topic of ongoing debate. In this work, we study if causal language modeling can learn a complex task such as solving Sudoku puzzles. To solve a Sudoku, the model is first required to search over all empty cells of the puzzle to decide on a cell to fill and then apply an appropriate strategy to fill the decided cell. Sometimes, the application of a strategy only results in thinning down the possible values in a cell rather than concluding the exact value of the cell. In such cases, multiple strategies are applied one after the other to fill a single cell. We observe that Transformer models trained on this synthetic task can indeed learn to solve Sudokus (our model solves $94.21\\%$ of the puzzles fully correctly) when trained on a logical sequence of steps taken by a solver. We find that training Transformers with the logical sequence of steps is necessary and without such training, they fail to learn Sudoku. We also extend our analysis to Zebra puzzles (known as Einstein puzzles) and show that the model solves $92.04 \\%$ of the puzzles fully correctly. In addition, we study the internal representations of the trained Transformer and find that through linear probing, we can decode information about the set of possible values in any given cell from them, pointing to the presence of a strong reasoning engine implicit in the Transformer weights.","url_abs":"https://arxiv.org/abs/2409.10502v1","url_pdf":"https://arxiv.org/pdf/2409.10502v1.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":"causal-language-modeling-can-elicit-search","repo_url":"https://github.com/kulinshah98/llm-reasoning-logic-puzzles","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"jax","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":null,"task_name":"Causal Language Modeling"},{"task_slug":"language-modeling","task_name":"Language Modeling"},{"task_slug":"language-modelling","task_name":"Language Modelling"},{"task_slug":"logical-sequence","task_name":"Logical Sequence"}],"methods":[{"method_slug":"absolute-position-encodings","method_name":"Absolute Position Encodings"},{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"label-smoothing","method_name":"Label Smoothing"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"position-wise-feed-forward-layer","method_name":"Position-Wise Feed-Forward Layer"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"set","method_name":"SET"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"transformer","method_name":"Transformer"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2409.10502","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2409.10502"}},"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/kulinshah98/llm-reasoning-logic-puzzles","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"ran":5,"unverified":6},"by_repo_kind":{"official":{"samples":11,"ran":5,"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":"5bf07d2ee6a39c55","entry":"create_dataset","repo":"kulinshah98/llm-reasoning-logic-puzzles","repo_kind":"official","path":"zebra-code/train/data.py","file_url":"https://github.com/kulinshah98/llm-reasoning-logic-puzzles/blob/HEAD/zebra-code/train/data.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"5bf07d2ee6a39c55"}},{"code_sha256_prefix":"983da1fb4db946b2","entry":"get_pred_logits","repo":"kulinshah98/llm-reasoning-logic-puzzles","repo_kind":"official","path":"zebra-code/train/evaluater.py","file_url":"https://github.com/kulinshah98/llm-reasoning-logic-puzzles/blob/HEAD/zebra-code/train/evaluater.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"983da1fb4db946b2"}},{"code_sha256_prefix":"c22983473f7ce496","entry":"log_hyperparams_tb","repo":"kulinshah98/llm-reasoning-logic-puzzles","repo_kind":"official","path":"sudoku-code/train/train_and_evaluate.py","file_url":"https://github.com/kulinshah98/llm-reasoning-logic-puzzles/blob/HEAD/sudoku-code/train/train_and_evaluate.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"c22983473f7ce496"}},{"code_sha256_prefix":"594c91edb211f85b","entry":"train_one_step","repo":"kulinshah98/llm-reasoning-logic-puzzles","repo_kind":"official","path":"zebra-code/train/trainer.py","file_url":"https://github.com/kulinshah98/llm-reasoning-logic-puzzles/blob/HEAD/zebra-code/train/trainer.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"594c91edb211f85b"}},{"code_sha256_prefix":"4b832a8d608fda5a","entry":"valid_solution","repo":"kulinshah98/llm-reasoning-logic-puzzles","repo_kind":"official","path":"sudoku-code/train/evaluater.py","file_url":"https://github.com/kulinshah98/llm-reasoning-logic-puzzles/blob/HEAD/sudoku-code/train/evaluater.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":"4b832a8d608fda5a"}},{"code_sha256_prefix":"e87fe7038ae1f4de","entry":"create_dataset","repo":"kulinshah98/llm-reasoning-logic-puzzles","repo_kind":"official","path":"sudoku-code/train/data.py","file_url":"https://github.com/kulinshah98/llm-reasoning-logic-puzzles/blob/HEAD/sudoku-code/train/data.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":"e87fe7038ae1f4de"}},{"code_sha256_prefix":"2eec2cf59b50fbda","entry":"create_iter","repo":"kulinshah98/llm-reasoning-logic-puzzles","repo_kind":"official","path":"sudoku-code/train/data.py","file_url":"https://github.com/kulinshah98/llm-reasoning-logic-puzzles/blob/HEAD/sudoku-code/train/data.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":"2eec2cf59b50fbda"}},{"code_sha256_prefix":"fb8dcfc1a0e1a5ea","entry":"create_iter","repo":"kulinshah98/llm-reasoning-logic-puzzles","repo_kind":"official","path":"zebra-code/train/data.py","file_url":"https://github.com/kulinshah98/llm-reasoning-logic-puzzles/blob/HEAD/zebra-code/train/data.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":"fb8dcfc1a0e1a5ea"}},{"code_sha256_prefix":"a2f2069bde94109f","entry":"get_beam_search_candidates","repo":"kulinshah98/llm-reasoning-logic-puzzles","repo_kind":"official","path":"zebra-code/train/evaluater.py","file_url":"https://github.com/kulinshah98/llm-reasoning-logic-puzzles/blob/HEAD/zebra-code/train/evaluater.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":"a2f2069bde94109f"}},{"code_sha256_prefix":"0e85806b890a5909","entry":"get_eval_metrics","repo":"kulinshah98/llm-reasoning-logic-puzzles","repo_kind":"official","path":"sudoku-code/train/evaluater.py","file_url":"https://github.com/kulinshah98/llm-reasoning-logic-puzzles/blob/HEAD/sudoku-code/train/evaluater.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":"0e85806b890a5909"}},{"code_sha256_prefix":"9fd07dc9fd853492","entry":"prepare_tf_data","repo":"kulinshah98/llm-reasoning-logic-puzzles","repo_kind":"official","path":"sudoku-code/train/data.py","file_url":"https://github.com/kulinshah98/llm-reasoning-logic-puzzles/blob/HEAD/sudoku-code/train/data.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":"9fd07dc9fd853492"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}