{"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/focusllm-scaling-llm-s-context-by-parallel","title":"FocusLLM: Precise Understanding of Long Context by Dynamic Condensing","arxiv_id":"2408.11745","date":"2024-08-21","proceeding":null,"authors":["Zhenyu Li","Yike Zhang","Tengyu Pan","Yutao Sun","Zhichao Duan","Junjie Fang","Rong Han","Zixuan Wang","Jianyong Wang"],"abstract":"Empowering LLMs with the ability to precisely understand long contexts is crucial for many downstream applications. However, handling long contexts with conventional transformer architecture requires substantial training and inference resources. Existing context condensing methods cannot accurately understand the full context, as there is a considerable amount of information loss in the condensing process. To address these issues, we present FocusLLM, a framework designed to extend the fixed context length of any decoder-only LLM, allowing the model to focus on relevant information from very long sequences. FocusLLM first divides long text input into chunks based on the model's original context length. It then employs the dynamic condensing process to distill crucial information from each chunk. Ultimately, through the novel parallel decoding mechanism, FocusLLM can integrate the extracted information into its local context. FocusLLM stands out for great training efficiency and versatility: trained with an 8K input length and with much less training cost than previous methods, FocusLLM exhibits superior performance across downstream tasks and maintains strong language modeling ability when handling extensive long texts, even up to 400K tokens. Our code is available at https://github.com/leezythu/FocusLLM.","url_abs":"https://arxiv.org/abs/2408.11745v2","url_pdf":"https://arxiv.org/pdf/2408.11745v2.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":"focusllm-scaling-llm-s-context-by-parallel","repo_url":"https://github.com/leezythu/focusllm","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":null,"task_name":"8k"},{"task_slug":"decoder","task_name":"Decoder"},{"task_slug":"language-modeling","task_name":"Language Modeling"},{"task_slug":"language-modelling","task_name":"Language Modelling"}],"methods":[{"method_slug":"focus","method_name":"Focus"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2408.11745","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2408.11745"}},"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/leezythu/focusllm","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":10,"ran_draft_wrong":1,"ran_fixture":1,"unverified":1},"by_repo_kind":{"official":{"samples":13,"ran":12,"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":"62f06040219b1d48","entry":"chunk_generate","repo":"leezythu/focusllm","repo_kind":"official","path":"infbench_src/eval_yarn_mistral.py","file_url":"https://github.com/leezythu/focusllm/blob/HEAD/infbench_src/eval_yarn_mistral.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":"62f06040219b1d48"}},{"code_sha256_prefix":"ab36ebf61cfb78fb","entry":"create_system_msg","repo":"leezythu/focusllm","repo_kind":"official","path":"infbench_src/eval_utils.py","file_url":"https://github.com/leezythu/focusllm/blob/HEAD/infbench_src/eval_utils.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":"ab36ebf61cfb78fb"}},{"code_sha256_prefix":"43daed1a27177d83","entry":"f1_score","repo":"leezythu/focusllm","repo_kind":"official","path":"infbench_src/compute_scores.py","file_url":"https://github.com/leezythu/focusllm/blob/HEAD/infbench_src/compute_scores.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":"43daed1a27177d83"}},{"code_sha256_prefix":"57207a94cde43fcb","entry":"format_numel_str","repo":"leezythu/focusllm","repo_kind":"official","path":"src/colossal.py","file_url":"https://github.com/leezythu/focusllm/blob/HEAD/src/colossal.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":"57207a94cde43fcb"}},{"code_sha256_prefix":"1cea3f6235148922","entry":"generate_prompt_landmark","repo":"leezythu/focusllm","repo_kind":"official","path":"eval_passkey.py","file_url":"https://github.com/leezythu/focusllm/blob/HEAD/eval_passkey.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":"1cea3f6235148922"}},{"code_sha256_prefix":"ded262d73a687b82","entry":"load_data","repo":"leezythu/focusllm","repo_kind":"official","path":"infbench_src/eval_utils.py","file_url":"https://github.com/leezythu/focusllm/blob/HEAD/infbench_src/eval_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":"ded262d73a687b82"}},{"code_sha256_prefix":"41e438356614fa31","entry":"load_json","repo":"leezythu/focusllm","repo_kind":"official","path":"infbench_src/eval_utils.py","file_url":"https://github.com/leezythu/focusllm/blob/HEAD/infbench_src/eval_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":"41e438356614fa31"}},{"code_sha256_prefix":"9edde0325b62d764","entry":"load_json","repo":"leezythu/focusllm","repo_kind":"official","path":"src/colossal.py","file_url":"https://github.com/leezythu/focusllm/blob/HEAD/src/colossal.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":"9edde0325b62d764"}},{"code_sha256_prefix":"4b44a4d3fd80a48d","entry":"normalize_answer","repo":"leezythu/focusllm","repo_kind":"official","path":"infbench_src/compute_scores.py","file_url":"https://github.com/leezythu/focusllm/blob/HEAD/infbench_src/compute_scores.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":"4b44a4d3fd80a48d"}},{"code_sha256_prefix":"f62b4d2a31aa1081","entry":"normalize_zh_answer","repo":"leezythu/focusllm","repo_kind":"official","path":"infbench_src/compute_scores.py","file_url":"https://github.com/leezythu/focusllm/blob/HEAD/infbench_src/compute_scores.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":"f62b4d2a31aa1081"}},{"code_sha256_prefix":"90a4b8ca09aaaf67","entry":"truncate_by_tokens","repo":"leezythu/focusllm","repo_kind":"official","path":"infbench_src/eval_chatglm.py","file_url":"https://github.com/leezythu/focusllm/blob/HEAD/infbench_src/eval_chatglm.py","link_basis":"plan_row","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":"90a4b8ca09aaaf67"}},{"code_sha256_prefix":"a09f1fe8cdcea888","entry":"truncate_input","repo":"leezythu/focusllm","repo_kind":"official","path":"infbench_src/eval_chatglm.py","file_url":"https://github.com/leezythu/focusllm/blob/HEAD/infbench_src/eval_chatglm.py","link_basis":"plan_row","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"well_formed","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"a09f1fe8cdcea888"}},{"code_sha256_prefix":"0f44a5e49cd59e9f","entry":"passkey_retrieval_test","repo":"leezythu/focusllm","repo_kind":"official","path":"eval_passkey.py","file_url":"https://github.com/leezythu/focusllm/blob/HEAD/eval_passkey.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":"0f44a5e49cd59e9f"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}