{"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/from-reading-to-compressing-exploring-the","title":"From Reading to Compressing: Exploring the Multi-document Reader for Prompt Compression","arxiv_id":"2410.04139","date":"2024-10-05","proceeding":null,"authors":["Eunseong Choi","Sunkyung Lee","Minjin Choi","June Park","Jongwuk Lee"],"abstract":"Large language models (LLMs) have achieved significant performance gains using advanced prompting techniques over various tasks. However, the increasing length of prompts leads to high computational costs and often obscures crucial information. Prompt compression has been proposed to alleviate these issues, but it faces challenges in (i) capturing the global context and (ii) training the compressor effectively. To tackle these challenges, we introduce a novel prompt compression method, namely Reading To Compressing (R2C), utilizing the Fusion-in-Decoder (FiD) architecture to identify the important information in the prompt. Specifically, the cross-attention scores of the FiD are used to discern essential chunks and sentences from the prompt. R2C effectively captures the global context without compromising semantic consistency while detouring the necessity of pseudo-labels for training the compressor. Empirical results show that R2C retains key contexts, enhancing the LLM performance by 6% in out-of-domain evaluations while reducing the prompt length by 80%.","url_abs":"https://arxiv.org/abs/2410.04139v2","url_pdf":"https://arxiv.org/pdf/2410.04139v2.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":"from-reading-to-compressing-exploring-the","repo_url":"https://github.com/eunseongc/r2c","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"decoder","task_name":"Decoder"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2410.04139","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2410.04139"}},"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/eunseongc/r2c","reach":{"status":"ok"}}],"summary":{"ran":13,"unverified":2},"by_repo_kind":{"official":{"samples":15,"ran":13,"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":15,"samples":[{"code_sha256_prefix":"a8e9bf4b191097fc","entry":"best_subspan_em","repo":"eunseongc/r2c","repo_kind":"official","path":"LLM_inference.py","file_url":"https://github.com/eunseongc/r2c/blob/HEAD/LLM_inference.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":"a8e9bf4b191097fc"}},{"code_sha256_prefix":"011fa22b8040e461","entry":"calculate_entropy","repo":"eunseongc/r2c","repo_kind":"official","path":"compress.py","file_url":"https://github.com/eunseongc/r2c/blob/HEAD/compress.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"011fa22b8040e461"}},{"code_sha256_prefix":"6bad17909398049e","entry":"check_answer","repo":"eunseongc/r2c","repo_kind":"official","path":"src_fid/evaluation.py","file_url":"https://github.com/eunseongc/r2c/blob/HEAD/src_fid/evaluation.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":"6bad17909398049e"}},{"code_sha256_prefix":"9410e388b51e48de","entry":"encode_passages","repo":"eunseongc/r2c","repo_kind":"official","path":"src_fid/data.py","file_url":"https://github.com/eunseongc/r2c/blob/HEAD/src_fid/data.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":"9410e388b51e48de"}},{"code_sha256_prefix":"31f795a3e0c1be69","entry":"exact_match_score","repo":"eunseongc/r2c","repo_kind":"official","path":"LLM_inference.py","file_url":"https://github.com/eunseongc/r2c/blob/HEAD/LLM_inference.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"31f795a3e0c1be69"}},{"code_sha256_prefix":"40d69700a2d8447c","entry":"find_pattern_locations","repo":"eunseongc/r2c","repo_kind":"official","path":"src_comp/compress_utils.py","file_url":"https://github.com/eunseongc/r2c/blob/HEAD/src_comp/compress_utils.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":"40d69700a2d8447c"}},{"code_sha256_prefix":"edc9d2c346eeeec0","entry":"get_prompt","repo":"eunseongc/r2c","repo_kind":"official","path":"src_comp/compress_utils.py","file_url":"https://github.com/eunseongc/r2c/blob/HEAD/src_comp/compress_utils.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":"edc9d2c346eeeec0"}},{"code_sha256_prefix":"858eb20414dce303","entry":"gini","repo":"eunseongc/r2c","repo_kind":"official","path":"src_comp/compress_utils.py","file_url":"https://github.com/eunseongc/r2c/blob/HEAD/src_comp/compress_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"858eb20414dce303"}},{"code_sha256_prefix":"4b554fe4ab3551c4","entry":"has_answer","repo":"eunseongc/r2c","repo_kind":"official","path":"src_fid/evaluation.py","file_url":"https://github.com/eunseongc/r2c/blob/HEAD/src_fid/evaluation.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":"4b554fe4ab3551c4"}},{"code_sha256_prefix":"c9985d22a0447bb5","entry":"load_data","repo":"eunseongc/r2c","repo_kind":"official","path":"src_fid/data.py","file_url":"https://github.com/eunseongc/r2c/blob/HEAD/src_fid/data.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":"c9985d22a0447bb5"}},{"code_sha256_prefix":"97a6fd2cf08cd835","entry":"most_frequent","repo":"eunseongc/r2c","repo_kind":"official","path":"eval_fid.py","file_url":"https://github.com/eunseongc/r2c/blob/HEAD/eval_fid.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"97a6fd2cf08cd835"}},{"code_sha256_prefix":"2c014e1529169f70","entry":"normalize_answer","repo":"eunseongc/r2c","repo_kind":"official","path":"LLM_inference.py","file_url":"https://github.com/eunseongc/r2c/blob/HEAD/LLM_inference.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"2c014e1529169f70"}},{"code_sha256_prefix":"993b9e4952f05b0c","entry":"process_batch_input_ids","repo":"eunseongc/r2c","repo_kind":"official","path":"src_fid/data.py","file_url":"https://github.com/eunseongc/r2c/blob/HEAD/src_fid/data.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":"993b9e4952f05b0c"}},{"code_sha256_prefix":"95aa31d2bb3d8787","entry":"calculate_matches","repo":"eunseongc/r2c","repo_kind":"official","path":"src_fid/evaluation.py","file_url":"https://github.com/eunseongc/r2c/blob/HEAD/src_fid/evaluation.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":"95aa31d2bb3d8787"}},{"code_sha256_prefix":"966db28850700a6a","entry":"get_options","repo":"eunseongc/r2c","repo_kind":"official","path":"src_fid/options.py","file_url":"https://github.com/eunseongc/r2c/blob/HEAD/src_fid/options.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":"966db28850700a6a"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}