{"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/single-pass-document-scanning-for-question","title":"Single-Pass Document Scanning for Question Answering","arxiv_id":"2504.03101","date":"2025-04-04","proceeding":null,"authors":["Weili Cao","Jianyou Wang","Youze Zheng","Longtian Bao","Qirui Zheng","Taylor Berg-Kirkpatrick","Ramamohan Paturi","Leon Bergen"],"abstract":"Handling extremely large documents for question answering is challenging: chunk-based embedding methods often lose track of important global context, while full-context transformers can be prohibitively expensive for hundreds of thousands of tokens. We propose a single-pass document scanning approach that processes the entire text in linear time, preserving global coherence while deciding which sentences are most relevant to the query. On 41 QA benchmarks, our single-pass scanner consistently outperforms chunk-based embedding methods and competes with large language models at a fraction of the computational cost. By conditioning on the entire preceding context without chunk breaks, the method preserves global coherence, which is especially important for long documents. Overall, single-pass document scanning offers a simple solution for question answering over massive text. All code, datasets, and model checkpoints are available at https://github.com/MambaRetriever/MambaRetriever","url_abs":"https://arxiv.org/abs/2504.03101v1","url_pdf":"https://arxiv.org/pdf/2504.03101v1.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":"single-pass-document-scanning-for-question","repo_url":"https://github.com/mambaretriever/mambaretriever","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"question-answering","task_name":"Question Answering"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2504.03101","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2504.03101"}},"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/mambaretriever/mambaretriever","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":1,"ran_draft_wrong":1,"unverified":12},"by_repo_kind":{"official":{"samples":14,"ran":2,"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":"477258f8938c0fd2","entry":"f1_score","repo":"mambaretriever/mambaretriever","repo_kind":"official","path":"rag_pipeline/metrics.py","file_url":"https://github.com/mambaretriever/mambaretriever/blob/HEAD/rag_pipeline/metrics.py","link_basis":"harvester_set","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":"477258f8938c0fd2"}},{"code_sha256_prefix":"e7e75981cb464788","entry":"normalize_answer","repo":"mambaretriever/mambaretriever","repo_kind":"official","path":"rag_pipeline/metrics.py","file_url":"https://github.com/mambaretriever/mambaretriever/blob/HEAD/rag_pipeline/metrics.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"e7e75981cb464788"}},{"code_sha256_prefix":"79668c04070c8b13","entry":"call_until_timeout","repo":"mambaretriever/mambaretriever","repo_kind":"official","path":"generation/generation.py","file_url":"https://github.com/mambaretriever/mambaretriever/blob/HEAD/generation/generation.py","link_basis":"harvester_set","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":"79668c04070c8b13"}},{"code_sha256_prefix":"c3aafaada0c57fb8","entry":"divide_string","repo":"mambaretriever/mambaretriever","repo_kind":"official","path":"document_tokenization.py","file_url":"https://github.com/mambaretriever/mambaretriever/blob/HEAD/document_tokenization.py","link_basis":"harvester_set","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":"c3aafaada0c57fb8"}},{"code_sha256_prefix":"7a55f9ed505e3d0d","entry":"gpt_generation","repo":"mambaretriever/mambaretriever","repo_kind":"official","path":"generation/models/openai_related.py","file_url":"https://github.com/mambaretriever/mambaretriever/blob/HEAD/generation/models/openai_related.py","link_basis":"harvester_set","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":"7a55f9ed505e3d0d"}},{"code_sha256_prefix":"892644ebbe17208f","entry":"gpt_generation_multi_turn","repo":"mambaretriever/mambaretriever","repo_kind":"official","path":"generation/models/openai_related.py","file_url":"https://github.com/mambaretriever/mambaretriever/blob/HEAD/generation/models/openai_related.py","link_basis":"harvester_set","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":"892644ebbe17208f"}},{"code_sha256_prefix":"15a7ccd3a037d3af","entry":"gpt_generation_with_image","repo":"mambaretriever/mambaretriever","repo_kind":"official","path":"generation/models/openai_related.py","file_url":"https://github.com/mambaretriever/mambaretriever/blob/HEAD/generation/models/openai_related.py","link_basis":"harvester_set","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":"15a7ccd3a037d3af"}},{"code_sha256_prefix":"745d72d6be972c22","entry":"jpg_path2base64","repo":"mambaretriever/mambaretriever","repo_kind":"official","path":"generation/models/util.py","file_url":"https://github.com/mambaretriever/mambaretriever/blob/HEAD/generation/models/util.py","link_basis":"harvester_set","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":"745d72d6be972c22"}},{"code_sha256_prefix":"ce44625b30442068","entry":"load_prompt_dict","repo":"mambaretriever/mambaretriever","repo_kind":"official","path":"generation/generation.py","file_url":"https://github.com/mambaretriever/mambaretriever/blob/HEAD/generation/generation.py","link_basis":"harvester_set","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":"ce44625b30442068"}},{"code_sha256_prefix":"e6b06451d4ea9e89","entry":"percentage_of_english_letters","repo":"mambaretriever/mambaretriever","repo_kind":"official","path":"filter_language.py","file_url":"https://github.com/mambaretriever/mambaretriever/blob/HEAD/filter_language.py","link_basis":"harvester_set","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":"e6b06451d4ea9e89"}},{"code_sha256_prefix":"326a510284c7f861","entry":"qa_f1_score","repo":"mambaretriever/mambaretriever","repo_kind":"official","path":"rag_pipeline/metrics.py","file_url":"https://github.com/mambaretriever/mambaretriever/blob/HEAD/rag_pipeline/metrics.py","link_basis":"harvester_set","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":"326a510284c7f861"}},{"code_sha256_prefix":"f2d62b62735e61eb","entry":"sliding_window","repo":"mambaretriever/mambaretriever","repo_kind":"official","path":"evaluate.py","file_url":"https://github.com/mambaretriever/mambaretriever/blob/HEAD/evaluate.py","link_basis":"harvester_set","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":"f2d62b62735e61eb"}},{"code_sha256_prefix":"70b8e7a47e924325","entry":"split_with_delimiters","repo":"mambaretriever/mambaretriever","repo_kind":"official","path":"document_tokenization.py","file_url":"https://github.com/mambaretriever/mambaretriever/blob/HEAD/document_tokenization.py","link_basis":"harvester_set","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":"70b8e7a47e924325"}},{"code_sha256_prefix":"9eaabecc83c4afef","entry":"split_with_newlines","repo":"mambaretriever/mambaretriever","repo_kind":"official","path":"document_tokenization.py","file_url":"https://github.com/mambaretriever/mambaretriever/blob/HEAD/document_tokenization.py","link_basis":"harvester_set","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":"9eaabecc83c4afef"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}