{"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/on-the-causal-nature-of-sentiment-analysis","title":"Do LLMs Think Fast and Slow? A Causal Study on Sentiment Analysis","arxiv_id":"2404.11055","date":"2024-04-17","proceeding":null,"authors":["Zhiheng Lyu","Zhijing Jin","Fernando Gonzalez","Rada Mihalcea","Bernhard Schölkopf","Mrinmaya Sachan"],"abstract":"Sentiment analysis (SA) aims to identify the sentiment expressed in a text, such as a product review. Given a review and the sentiment associated with it, this work formulates SA as a combination of two tasks: (1) a causal discovery task that distinguishes whether a review \"primes\" the sentiment (Causal Hypothesis C1), or the sentiment \"primes\" the review (Causal Hypothesis C2); and (2) the traditional prediction task to model the sentiment using the review as input. Using the peak-end rule in psychology, we classify a sample as C1 if its overall sentiment score approximates an average of all the sentence-level sentiments in the review, and C2 if the overall sentiment score approximates an average of the peak and end sentiments. For the prediction task, we use the discovered causal mechanisms behind the samples to improve LLM performance by proposing causal prompts that give the models an inductive bias of the underlying causal graph, leading to substantial improvements by up to 32.13 F1 points on zero-shot five-class SA. Our code is at https://github.com/cogito233/causal-sa","url_abs":"https://arxiv.org/abs/2404.11055v2","url_pdf":"https://arxiv.org/pdf/2404.11055v2.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":"on-the-causal-nature-of-sentiment-analysis","repo_url":"https://github.com/cogito233/causal-sa","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"none","reach":{"status":"ok"}}],"tasks":[{"task_slug":"causal-discovery","task_name":"Causal Discovery"},{"task_slug":"inductive-bias","task_name":"Inductive Bias"},{"task_slug":"sentence","task_name":"Sentence"},{"task_slug":"sentiment-analysis","task_name":"Sentiment Analysis"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2404.11055","atlas_url":"https://app.syntology.ai/?focus=2404.11055","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2404.11055"}},"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/cogito233/causal-sa","reach":{"status":"ok"}}],"summary":{"ran":5,"unverified":1},"by_repo_kind":{"official":{"samples":6,"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":6,"samples":[{"code_sha256_prefix":"e2172b6f7a6f0e09","entry":"buildSpanningTree_fromMatrix","repo":"cogito233/causal-sa","repo_kind":"official","path":"src/discourse/cluster_graph.py","file_url":"https://github.com/cogito233/causal-sa/blob/HEAD/src/discourse/cluster_graph.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":"e2172b6f7a6f0e09"}},{"code_sha256_prefix":"bd63106a0416368c","entry":"find_sub_list","repo":"cogito233/causal-sa","repo_kind":"official","path":"src/LLM/causal_tracing/tracing.py","file_url":"https://github.com/cogito233/causal-sa/blob/HEAD/src/LLM/causal_tracing/tracing.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":"bd63106a0416368c"}},{"code_sha256_prefix":"86571f3cd37f6c40","entry":"is_stream","repo":"cogito233/causal-sa","repo_kind":"official","path":"src/discourse/cluster_graph.py","file_url":"https://github.com/cogito233/causal-sa/blob/HEAD/src/discourse/cluster_graph.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":"86571f3cd37f6c40"}},{"code_sha256_prefix":"b6b60ae704b2912f","entry":"load_from_npy","repo":"cogito233/causal-sa","repo_kind":"official","path":"src/data_reformated_pipeline/discourse_generate.py","file_url":"https://github.com/cogito233/causal-sa/blob/HEAD/src/data_reformated_pipeline/discourse_generate.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":"b6b60ae704b2912f"}},{"code_sha256_prefix":"c7842e8b17798395","entry":"load_from_npy","repo":"cogito233/causal-sa","repo_kind":"official","path":"src/discourse/cluster_graph.py","file_url":"https://github.com/cogito233/causal-sa/blob/HEAD/src/discourse/cluster_graph.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":"c7842e8b17798395"}},{"code_sha256_prefix":"c0cd3caa93175ecc","entry":"load_similarity_list","repo":"cogito233/causal-sa","repo_kind":"official","path":"src/data_reformated_pipeline/discourse_generate.py","file_url":"https://github.com/cogito233/causal-sa/blob/HEAD/src/data_reformated_pipeline/discourse_generate.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"c0cd3caa93175ecc"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}