{"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-agent-based-on-large-language-model","title":"Causal Agent based on Large Language Model","arxiv_id":"2408.06849","date":"2024-08-13","proceeding":null,"authors":["Kairong Han","Kun Kuang","Ziyu Zhao","Junjian Ye","Fei Wu"],"abstract":"Large language models (LLMs) have achieved significant success across various domains. However, the inherent complexity of causal problems and causal theory poses challenges in accurately describing them in natural language, making it difficult for LLMs to comprehend and use them effectively. Causal methods are not easily conveyed through natural language, which hinders LLMs' ability to apply them accurately. Additionally, causal datasets are typically tabular, while LLMs excel in handling natural language data, creating a structural mismatch that impedes effective reasoning with tabular data. This lack of causal reasoning capability limits the development of LLMs. To address these challenges, we have equipped the LLM with causal tools within an agent framework, named the Causal Agent, enabling it to tackle causal problems. The causal agent comprises tools, memory, and reasoning modules. In the tools module, the causal agent applies causal methods to align tabular data with natural language. In the reasoning module, the causal agent employs the ReAct framework to perform reasoning through multiple iterations with the tools. In the memory module, the causal agent maintains a dictionary instance where the keys are unique names and the values are causal graphs. To verify the causal ability of the causal agent, we established a benchmark consisting of four levels of causal problems: variable level, edge level, causal graph level, and causal effect level. We generated a test dataset of 1.3K using ChatGPT-3.5 for these four levels of issues and tested the causal agent on the datasets. Our methodology demonstrates remarkable efficacy on the four-level causal problems, with accuracy rates all above 80%. For further insights and implementation details, our code is accessible via the GitHub repository https://github.com/Kairong-Han/Causal_Agent.","url_abs":"https://arxiv.org/abs/2408.06849v1","url_pdf":"https://arxiv.org/pdf/2408.06849v1.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-agent-based-on-large-language-model","repo_url":"https://github.com/kairong-han/causal_agent","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"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":"model","task_name":"model"}],"methods":[{"method_slug":"align","method_name":"ALIGN"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2408.06849","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2408.06849"}},"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/kairong-han/causal_agent","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":10,"ran_fixture":1,"unverified":3},"by_repo_kind":{"official":{"samples":14,"ran":11,"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":"a8a7a259db8a81b3","entry":"Stein_hess","repo":"kairong-han/causal_agent","repo_kind":"official","path":"SCORE-main/stein.py","file_url":"https://github.com/kairong-han/causal_agent/blob/HEAD/SCORE-main/stein.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"a8a7a259db8a81b3"}},{"code_sha256_prefix":"bb340e38e6e61436","entry":"add_noise","repo":"kairong-han/causal_agent","repo_kind":"official","path":"main_QR.py","file_url":"https://github.com/kairong-han/causal_agent/blob/HEAD/main_QR.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"bb340e38e6e61436"}},{"code_sha256_prefix":"00230c910f8f28f5","entry":"compute_top_order","repo":"kairong-han/causal_agent","repo_kind":"official","path":"SCORE-main/stein.py","file_url":"https://github.com/kairong-han/causal_agent/blob/HEAD/SCORE-main/stein.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"00230c910f8f28f5"}},{"code_sha256_prefix":"9a227dfd5452fed4","entry":"edge_dir","repo":"kairong-han/causal_agent","repo_kind":"official","path":"util.py","file_url":"https://github.com/kairong-han/causal_agent/blob/HEAD/util.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"9a227dfd5452fed4"}},{"code_sha256_prefix":"63790fd8bd85e92f","entry":"edge_num","repo":"kairong-han/causal_agent","repo_kind":"official","path":"SCORE-main/demo_SCORE.py","file_url":"https://github.com/kairong-han/causal_agent/blob/HEAD/SCORE-main/demo_SCORE.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"63790fd8bd85e92f"}},{"code_sha256_prefix":"541d7f28dbdb0e00","entry":"find_all_paths","repo":"kairong-han/causal_agent","repo_kind":"official","path":"util.py","file_url":"https://github.com/kairong-han/causal_agent/blob/HEAD/util.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"541d7f28dbdb0e00"}},{"code_sha256_prefix":"a86ab79ff7c3ca42","entry":"full_DAG","repo":"kairong-han/causal_agent","repo_kind":"official","path":"SCORE-main/utils.py","file_url":"https://github.com/kairong-han/causal_agent/blob/HEAD/SCORE-main/utils.py","link_basis":"plan_row","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"a86ab79ff7c3ca42"}},{"code_sha256_prefix":"5f47c429ede66b1c","entry":"get_name","repo":"kairong-han/causal_agent","repo_kind":"official","path":"dataset_gt.py","file_url":"https://github.com/kairong-han/causal_agent/blob/HEAD/dataset_gt.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"5f47c429ede66b1c"}},{"code_sha256_prefix":"7f33c8711d7b2d37","entry":"np_to_csv","repo":"kairong-han/causal_agent","repo_kind":"official","path":"SCORE-main/utils.py","file_url":"https://github.com/kairong-han/causal_agent/blob/HEAD/SCORE-main/utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"7f33c8711d7b2d37"}},{"code_sha256_prefix":"003d81116b4a4fb5","entry":"simulate_dag","repo":"kairong-han/causal_agent","repo_kind":"official","path":"SCORE-main/utils.py","file_url":"https://github.com/kairong-han/causal_agent/blob/HEAD/SCORE-main/utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"003d81116b4a4fb5"}},{"code_sha256_prefix":"b036a30566ea1159","entry":"triangle_to_adj","repo":"kairong-han/causal_agent","repo_kind":"official","path":"util.py","file_url":"https://github.com/kairong-han/causal_agent/blob/HEAD/util.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"b036a30566ea1159"}},{"code_sha256_prefix":"5da3b16530d01830","entry":"Stein_pruning","repo":"kairong-han/causal_agent","repo_kind":"official","path":"SCORE-main/stein.py","file_url":"https://github.com/kairong-han/causal_agent/blob/HEAD/SCORE-main/stein.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":"5da3b16530d01830"}},{"code_sha256_prefix":"1c31ede173ef4356","entry":"generate","repo":"kairong-han/causal_agent","repo_kind":"official","path":"SCORE-main/demo_SCORE.py","file_url":"https://github.com/kairong-han/causal_agent/blob/HEAD/SCORE-main/demo_SCORE.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":"1c31ede173ef4356"}},{"code_sha256_prefix":"55e01338dc26c5f7","entry":"get_code_result","repo":"kairong-han/causal_agent","repo_kind":"official","path":"baseline-codellm.py","file_url":"https://github.com/kairong-han/causal_agent/blob/HEAD/baseline-codellm.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":"55e01338dc26c5f7"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}