{"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/nlprolog-reasoning-with-weak-unification-for-1","title":"NLProlog: Reasoning with Weak Unification for Question Answering in Natural Language","arxiv_id":"1906.06187","date":"2019-06-14","proceeding":"ACL 2019 7","authors":["Leon Weber","Pasquale Minervini","Jannes Münchmeyer","Ulf Leser","Tim Rocktäschel"],"abstract":"Rule-based models are attractive for various tasks because they inherently lead to interpretable and explainable decisions and can easily incorporate prior knowledge. However, such systems are difficult to apply to problems involving natural language, due to its linguistic variability. In contrast, neural models can cope very well with ambiguity by learning distributed representations of words and their composition from data, but lead to models that are difficult to interpret. In this paper, we describe a model combining neural networks with logic programming in a novel manner for solving multi-hop reasoning tasks over natural language. Specifically, we propose to use a Prolog prover which we extend to utilize a similarity function over pretrained sentence encoders. We fine-tune the representations for the similarity function via backpropagation. This leads to a system that can apply rule-based reasoning to natural language, and induce domain-specific rules from training data. We evaluate the proposed system on two different question answering tasks, showing that it outperforms two baselines -- BIDAF (Seo et al., 2016a) and FAST QA (Weissenborn et al., 2017b) on a subset of the WikiHop corpus and achieves competitive results on the MedHop data set (Welbl et al., 2017).","url_abs":"https://arxiv.org/abs/1906.06187v1","url_pdf":"https://arxiv.org/pdf/1906.06187v1.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":"nlprolog-reasoning-with-weak-unification-for-1","repo_url":"https://github.com/leonweber/nlprolog","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"question-answering","task_name":"Question Answering"},{"task_slug":"sentence","task_name":"Sentence"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/1906.06187","atlas_url":"https://app.syntology.ai/?focus=1906.06187","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"1906.06187"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+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/leonweber/nlprolog","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"unverified":11},"by_repo_kind":{"official":{"samples":11,"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":"6c8c3d4b27fb45b3","entry":"batched_weighted_sum","repo":"leonweber/nlprolog","repo_kind":"official","path":"utils.py","file_url":"https://github.com/leonweber/nlprolog/blob/HEAD/utils.py","link_basis":"first_harvest_node","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":"6c8c3d4b27fb45b3"}},{"code_sha256_prefix":"66053e173ef275e6","entry":"build_tree","repo":"leonweber/nlprolog","repo_kind":"official","path":"visualize_proof_tree.py","file_url":"https://github.com/leonweber/nlprolog/blob/HEAD/visualize_proof_tree.py","link_basis":"first_harvest_node","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":"66053e173ef275e6"}},{"code_sha256_prefix":"5dc0130fdfd31748","entry":"clean_text","repo":"leonweber/nlprolog","repo_kind":"official","path":"preprocessing.py","file_url":"https://github.com/leonweber/nlprolog/blob/HEAD/preprocessing.py","link_basis":"first_harvest_node","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":"5dc0130fdfd31748"}},{"code_sha256_prefix":"e8c9a1f414af2fce","entry":"cosine_similarity","repo":"leonweber/nlprolog","repo_kind":"official","path":"model.py","file_url":"https://github.com/leonweber/nlprolog/blob/HEAD/model.py","link_basis":"first_harvest_node","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":"e8c9a1f414af2fce"}},{"code_sha256_prefix":"02f07f3773ca95ee","entry":"get_linear","repo":"leonweber/nlprolog","repo_kind":"official","path":"model.py","file_url":"https://github.com/leonweber/nlprolog/blob/HEAD/model.py","link_basis":"first_harvest_node","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":"02f07f3773ca95ee"}},{"code_sha256_prefix":"49c3bc68899deda4","entry":"luk","repo":"leonweber/nlprolog","repo_kind":"official","path":"prolog.py","file_url":"https://github.com/leonweber/nlprolog/blob/HEAD/prolog.py","link_basis":"first_harvest_node","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":"49c3bc68899deda4"}},{"code_sha256_prefix":"1f0f6e29595f9263","entry":"make_title","repo":"leonweber/nlprolog","repo_kind":"official","path":"preprocessing.py","file_url":"https://github.com/leonweber/nlprolog/blob/HEAD/preprocessing.py","link_basis":"first_harvest_node","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":"1f0f6e29595f9263"}},{"code_sha256_prefix":"b6a8a382d767df09","entry":"plot","repo":"leonweber/nlprolog","repo_kind":"official","path":"visualize_proof_tree.py","file_url":"https://github.com/leonweber/nlprolog/blob/HEAD/visualize_proof_tree.py","link_basis":"first_harvest_node","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":"b6a8a382d767df09"}},{"code_sha256_prefix":"f97356fe5f557abd","entry":"prod","repo":"leonweber/nlprolog","repo_kind":"official","path":"prolog.py","file_url":"https://github.com/leonweber/nlprolog/blob/HEAD/prolog.py","link_basis":"first_harvest_node","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":"f97356fe5f557abd"}},{"code_sha256_prefix":"a2e8d8ee2aa98330","entry":"sim","repo":"leonweber/nlprolog","repo_kind":"official","path":"model.py","file_url":"https://github.com/leonweber/nlprolog/blob/HEAD/model.py","link_basis":"first_harvest_node","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":"a2e8d8ee2aa98330"}},{"code_sha256_prefix":"0d57be32fa41e563","entry":"truncate","repo":"leonweber/nlprolog","repo_kind":"official","path":"preprocessing.py","file_url":"https://github.com/leonweber/nlprolog/blob/HEAD/preprocessing.py","link_basis":"first_harvest_node","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":"0d57be32fa41e563"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}