{"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/seakr-self-aware-knowledge-retrieval-for","title":"SeaKR: Self-aware Knowledge Retrieval for Adaptive Retrieval Augmented Generation","arxiv_id":"2406.19215","date":"2024-06-27","proceeding":null,"authors":["Zijun Yao","Weijian Qi","Liangming Pan","Shulin Cao","Linmei Hu","Weichuan Liu","Lei Hou","Juanzi Li"],"abstract":"This paper introduces Self-aware Knowledge Retrieval (SeaKR), a novel adaptive RAG model that extracts self-aware uncertainty of LLMs from their internal states. SeaKR activates retrieval when the LLMs present high self-aware uncertainty for generation. To effectively integrate retrieved knowledge snippets, SeaKR re-ranks them based on LLM's self-aware uncertainty to preserve the snippet that reduces their uncertainty to the utmost. To facilitate solving complex tasks that require multiple retrievals, SeaKR utilizes their self-aware uncertainty to choose among different reasoning strategies. Our experiments on both complex and simple Question Answering datasets show that SeaKR outperforms existing adaptive RAG methods. We release our code at https://github.com/THU-KEG/SeaKR.","url_abs":"https://arxiv.org/abs/2406.19215v1","url_pdf":"https://arxiv.org/pdf/2406.19215v1.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":"seakr-self-aware-knowledge-retrieval-for","repo_url":"https://github.com/thu-keg/seakr","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"GPL-3.0"}}],"tasks":[{"task_slug":"question-answering","task_name":"Question Answering"},{"task_slug":"rag","task_name":"RAG"},{"task_slug":"retrieval","task_name":"Retrieval"},{"task_slug":"retrieval-augmented-generation","task_name":"Retrieval-augmented Generation"}],"methods":[{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"attention-dropout","method_name":"Attention Dropout"},{"method_slug":"bart","method_name":"BART"},{"method_slug":"bert","method_name":"BERT"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"linear-warmup-with-linear-decay","method_name":"Linear Warmup With Linear Decay"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"rag","method_name":"RAG"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"weight-decay","method_name":"Weight Decay"},{"method_slug":"wordpiece","method_name":"WordPiece"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2406.19215","atlas_url":"https://app.syntology.ai/?focus=2406.19215","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2406.19215"}},"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/thu-keg/seakr","reach":{"status":"ok","spdx":"GPL-3.0"}}],"summary":{"ran":7,"ran_draft_wrong":1,"unverified":4},"by_repo_kind":{"official":{"samples":12,"ran":8,"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":12,"samples":[{"code_sha256_prefix":"5109c385e92b727e","entry":"async_request_deepspeed_mii","repo":"thu-keg/seakr","repo_kind":"official","path":"vllm_uncertainty/benchmarks/backend_request_func.py","file_url":"https://github.com/thu-keg/seakr/blob/HEAD/vllm_uncertainty/benchmarks/backend_request_func.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"GPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"5109c385e92b727e"}},{"code_sha256_prefix":"a58940aabfd794f9","entry":"async_request_tgi","repo":"thu-keg/seakr","repo_kind":"official","path":"vllm_uncertainty/benchmarks/backend_request_func.py","file_url":"https://github.com/thu-keg/seakr/blob/HEAD/vllm_uncertainty/benchmarks/backend_request_func.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"GPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"a58940aabfd794f9"}},{"code_sha256_prefix":"fa581ebc13cb414d","entry":"async_request_trt_llm","repo":"thu-keg/seakr","repo_kind":"official","path":"vllm_uncertainty/benchmarks/backend_request_func.py","file_url":"https://github.com/thu-keg/seakr/blob/HEAD/vllm_uncertainty/benchmarks/backend_request_func.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"GPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"fa581ebc13cb414d"}},{"code_sha256_prefix":"1a724cf510e5bb93","entry":"bm25search_search","repo":"thu-keg/seakr","repo_kind":"official","path":"SEAKR/retriever.py","file_url":"https://github.com/thu-keg/seakr/blob/HEAD/SEAKR/retriever.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"GPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"1a724cf510e5bb93"}},{"code_sha256_prefix":"e8d1a899df6f301a","entry":"check_wheel_size","repo":"thu-keg/seakr","repo_kind":"official","path":"vllm_uncertainty/.buildkite/check-wheel-size.py","file_url":"https://github.com/thu-keg/seakr/blob/HEAD/vllm_uncertainty/.buildkite/check-wheel-size.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"GPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"e8d1a899df6f301a"}},{"code_sha256_prefix":"0410394e1f61026a","entry":"elasticsearch_lexical_multisearch","repo":"thu-keg/seakr","repo_kind":"official","path":"SEAKR/retriever.py","file_url":"https://github.com/thu-keg/seakr/blob/HEAD/SEAKR/retriever.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"GPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"0410394e1f61026a"}},{"code_sha256_prefix":"64fc92f1ad0464da","entry":"get_answer","repo":"thu-keg/seakr","repo_kind":"official","path":"main_simpleqa.py","file_url":"https://github.com/thu-keg/seakr/blob/HEAD/main_simpleqa.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"GPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"64fc92f1ad0464da"}},{"code_sha256_prefix":"5ae630bfc3821b6e","entry":"run_and_read_all","repo":"thu-keg/seakr","repo_kind":"official","path":"vllm_uncertainty/collect_env.py","file_url":"https://github.com/thu-keg/seakr/blob/HEAD/vllm_uncertainty/collect_env.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"GPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"5ae630bfc3821b6e"}},{"code_sha256_prefix":"189363ca95998f9a","entry":"elasticsearch_hit_template","repo":"thu-keg/seakr","repo_kind":"official","path":"SEAKR/retriever.py","file_url":"https://github.com/thu-keg/seakr/blob/HEAD/SEAKR/retriever.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"GPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"189363ca95998f9a"}},{"code_sha256_prefix":"c39d142cd9d5522d","entry":"get_dataset","repo":"thu-keg/seakr","repo_kind":"official","path":"SEAKR/dataset.py","file_url":"https://github.com/thu-keg/seakr/blob/HEAD/SEAKR/dataset.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"GPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"c39d142cd9d5522d"}},{"code_sha256_prefix":"6b73fe0480a96ad9","entry":"run","repo":"thu-keg/seakr","repo_kind":"official","path":"vllm_uncertainty/collect_env.py","file_url":"https://github.com/thu-keg/seakr/blob/HEAD/vllm_uncertainty/collect_env.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"GPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"6b73fe0480a96ad9"}},{"code_sha256_prefix":"ce7a62e37fe78c0d","entry":"run_and_parse_first_match","repo":"thu-keg/seakr","repo_kind":"official","path":"vllm_uncertainty/collect_env.py","file_url":"https://github.com/thu-keg/seakr/blob/HEAD/vllm_uncertainty/collect_env.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"GPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"ce7a62e37fe78c0d"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}