{"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/coupling-large-language-models-with-logic","title":"Coupling Large Language Models with Logic Programming for Robust and General Reasoning from Text","arxiv_id":"2307.07696","date":"2023-07-15","proceeding":null,"authors":["Zhun Yang","Adam Ishay","Joohyung Lee"],"abstract":"While large language models (LLMs), such as GPT-3, appear to be robust and general, their reasoning ability is not at a level to compete with the best models trained for specific natural language reasoning problems. In this study, we observe that a large language model can serve as a highly effective few-shot semantic parser. It can convert natural language sentences into a logical form that serves as input for answer set programs, a logic-based declarative knowledge representation formalism. The combination results in a robust and general system that can handle multiple question-answering tasks without requiring retraining for each new task. It only needs a few examples to guide the LLM's adaptation to a specific task, along with reusable ASP knowledge modules that can be applied to multiple tasks. We demonstrate that this method achieves state-of-the-art performance on several NLP benchmarks, including bAbI, StepGame, CLUTRR, and gSCAN. Additionally, it successfully tackles robot planning tasks that an LLM alone fails to solve.","url_abs":"https://arxiv.org/abs/2307.07696v1","url_pdf":"https://arxiv.org/pdf/2307.07696v1.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":"coupling-large-language-models-with-logic","repo_url":"https://github.com/azreasoners/llm-asp","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"none","reach":{"status":"ok"}}],"tasks":[{"task_slug":"language-modeling","task_name":"Language Modeling"},{"task_slug":"language-modelling","task_name":"Language Modelling"},{"task_slug":"large-language-model","task_name":"Large Language Model"},{"task_slug":"question-answering","task_name":"Question Answering"}],"methods":[{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"attention-dropout","method_name":"Attention Dropout"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"cosine-annealing","method_name":"Cosine Annealing"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"gpt-3","method_name":"GPT-3"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"linear-warmup-with-cosine-annealing","method_name":"Linear Warmup With Cosine Annealing"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"weight-decay","method_name":"Weight Decay"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2307.07696","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2307.07696"}},"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/azreasoners/llm-asp","reach":{"status":"ok"}}],"summary":{"ran":9},"by_repo_kind":{"official":{"samples":9,"ran":9,"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":9,"samples":[{"code_sha256_prefix":"877623e6fdf8da61","entry":"GPT_answer","repo":"azreasoners/llm-asp","repo_kind":"official","path":"bAbI_baseline/babi_utils.py","file_url":"https://github.com/azreasoners/llm-asp/blob/HEAD/bAbI_baseline/babi_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"877623e6fdf8da61"}},{"code_sha256_prefix":"306050cbca40f993","entry":"GPT_parse_all","repo":"azreasoners/llm-asp","repo_kind":"official","path":"bAbI/babi_utils.py","file_url":"https://github.com/azreasoners/llm-asp/blob/HEAD/bAbI/babi_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"306050cbca40f993"}},{"code_sha256_prefix":"6a80aaadb4e439e9","entry":"GPT_parse_iterative","repo":"azreasoners/llm-asp","repo_kind":"official","path":"bAbI/babi_utils.py","file_url":"https://github.com/azreasoners/llm-asp/blob/HEAD/bAbI/babi_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"6a80aaadb4e439e9"}},{"code_sha256_prefix":"087cdfe304604e4b","entry":"get_response","repo":"azreasoners/llm-asp","repo_kind":"official","path":"bAbI/babi_utils.py","file_url":"https://github.com/azreasoners/llm-asp/blob/HEAD/bAbI/babi_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"087cdfe304604e4b"}},{"code_sha256_prefix":"56597596608e8e47","entry":"lowercase_terms","repo":"azreasoners/llm-asp","repo_kind":"official","path":"bAbI_baseline/babi_utils.py","file_url":"https://github.com/azreasoners/llm-asp/blob/HEAD/bAbI_baseline/babi_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"56597596608e8e47"}},{"code_sha256_prefix":"6032d8f49fd30a34","entry":"order_plan","repo":"azreasoners/llm-asp","repo_kind":"official","path":"bAbI/task_config.py","file_url":"https://github.com/azreasoners/llm-asp/blob/HEAD/bAbI/task_config.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"6032d8f49fd30a34"}},{"code_sha256_prefix":"a17cb50a2de8670e","entry":"post_process16","repo":"azreasoners/llm-asp","repo_kind":"official","path":"bAbI/task_config.py","file_url":"https://github.com/azreasoners/llm-asp/blob/HEAD/bAbI/task_config.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"a17cb50a2de8670e"}},{"code_sha256_prefix":"16baa5cc09b74a03","entry":"post_process8","repo":"azreasoners/llm-asp","repo_kind":"official","path":"bAbI/task_config.py","file_url":"https://github.com/azreasoners/llm-asp/blob/HEAD/bAbI/task_config.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"16baa5cc09b74a03"}},{"code_sha256_prefix":"a6864e9ccd2971e4","entry":"post_process8","repo":"azreasoners/llm-asp","repo_kind":"official","path":"bAbI_baseline/task_config.py","file_url":"https://github.com/azreasoners/llm-asp/blob/HEAD/bAbI_baseline/task_config.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"a6864e9ccd2971e4"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}