{"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/the-internal-state-of-an-llm-knows-when-its","title":"The Internal State of an LLM Knows When It's Lying","arxiv_id":"2304.13734","date":"2023-04-26","proceeding":null,"authors":["Amos Azaria","Tom Mitchell"],"abstract":"While Large Language Models (LLMs) have shown exceptional performance in various tasks, one of their most prominent drawbacks is generating inaccurate or false information with a confident tone. In this paper, we provide evidence that the LLM's internal state can be used to reveal the truthfulness of statements. This includes both statements provided to the LLM, and statements that the LLM itself generates. Our approach is to train a classifier that outputs the probability that a statement is truthful, based on the hidden layer activations of the LLM as it reads or generates the statement. Experiments demonstrate that given a set of test sentences, of which half are true and half false, our trained classifier achieves an average of 71\\% to 83\\% accuracy labeling which sentences are true versus false, depending on the LLM base model. Furthermore, we explore the relationship between our classifier's performance and approaches based on the probability assigned to the sentence by the LLM. We show that while LLM-assigned sentence probability is related to sentence truthfulness, this probability is also dependent on sentence length and the frequencies of words in the sentence, resulting in our trained classifier providing a more reliable approach to detecting truthfulness, highlighting its potential to enhance the reliability of LLM-generated content and its practical applicability in real-world scenarios.","url_abs":"https://arxiv.org/abs/2304.13734v2","url_pdf":"https://arxiv.org/pdf/2304.13734v2.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":"the-internal-state-of-an-llm-knows-when-its","repo_url":"https://github.com/balevinstein/probes","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"sentence","task_name":"Sentence"}],"methods":[{"method_slug":"base","method_name":"BASE"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2304.13734","atlas_url":"https://app.syntology.ai/?focus=2304.13734","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2304.13734"}},"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/balevinstein/probes","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran_draft_wrong":3,"ran_fixture":2},"by_repo_kind":{"listed":{"samples":5,"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":"47a75377f206e2cb","entry":"load_config","repo":"balevinstein/probes","repo_kind":"listed","path":"TrainProbes.py","file_url":"https://github.com/balevinstein/probes/blob/HEAD/TrainProbes.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"47a75377f206e2cb"}},{"code_sha256_prefix":"f2ad4d1f97c24685","entry":"load_data","repo":"balevinstein/probes","repo_kind":"listed","path":"Generate_Embeddings.py","file_url":"https://github.com/balevinstein/probes/blob/HEAD/Generate_Embeddings.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"f2ad4d1f97c24685"}},{"code_sha256_prefix":"c32cb2b828044b4d","entry":"load_datasets","repo":"balevinstein/probes","repo_kind":"listed","path":"TrainProbes.py","file_url":"https://github.com/balevinstein/probes/blob/HEAD/TrainProbes.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"c32cb2b828044b4d"}},{"code_sha256_prefix":"5b5f6a3969b72cda","entry":"prepare_datasets","repo":"balevinstein/probes","repo_kind":"listed","path":"TrainProbes.py","file_url":"https://github.com/balevinstein/probes/blob/HEAD/TrainProbes.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"5b5f6a3969b72cda"}},{"code_sha256_prefix":"cc6f60b3b538e888","entry":"process_row","repo":"balevinstein/probes","repo_kind":"listed","path":"Generate_Embeddings.py","file_url":"https://github.com/balevinstein/probes/blob/HEAD/Generate_Embeddings.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"cc6f60b3b538e888"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}