{"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/ruler-what-s-the-real-context-size-of-your","title":"RULER: What's the Real Context Size of Your Long-Context Language Models?","arxiv_id":"2404.06654","date":"2024-04-09","proceeding":null,"authors":["Cheng-Ping Hsieh","Simeng Sun","Samuel Kriman","Shantanu Acharya","Dima Rekesh","Fei Jia","Yang Zhang","Boris Ginsburg"],"abstract":"The needle-in-a-haystack (NIAH) test, which examines the ability to retrieve a piece of information (the \"needle\") from long distractor texts (the \"haystack\"), has been widely adopted to evaluate long-context language models (LMs). However, this simple retrieval-based test is indicative of only a superficial form of long-context understanding. To provide a more comprehensive evaluation of long-context LMs, we create a new synthetic benchmark RULER with flexible configurations for customized sequence length and task complexity. RULER expands upon the vanilla NIAH test to encompass variations with diverse types and quantities of needles. Moreover, RULER introduces new task categories multi-hop tracing and aggregation to test behaviors beyond searching from context. We evaluate 17 long-context LMs with 13 representative tasks in RULER. Despite achieving nearly perfect accuracy in the vanilla NIAH test, almost all models exhibit large performance drops as the context length increases. While these models all claim context sizes of 32K tokens or greater, only half of them can maintain satisfactory performance at the length of 32K. Our analysis of Yi-34B, which supports context length of 200K, reveals large room for improvement as we increase input length and task complexity. We open source RULER to spur comprehensive evaluation of long-context LMs.","url_abs":"https://arxiv.org/abs/2404.06654v3","url_pdf":"https://arxiv.org/pdf/2404.06654v3.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":"ruler-what-s-the-real-context-size-of-your","repo_url":"https://github.com/hsiehjackson/ruler","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"ruler-what-s-the-real-context-size-of-your","repo_url":"https://github.com/InternLM/opencompass","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"ruler-what-s-the-real-context-size-of-your","repo_url":"https://github.com/NVIDIA/Star-Attention","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"ruler-what-s-the-real-context-size-of-your","repo_url":"https://github.com/mungg/OneRuler","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":null},{"paper_slug":"ruler-what-s-the-real-context-size-of-your","repo_url":"https://github.com/nvidia/ruler","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"ruler-what-s-the-real-context-size-of-your","repo_url":"https://github.com/open-compass/opencompass","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":"long-context-understanding","task_name":"Long-Context Understanding"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2404.06654","atlas_url":"https://app.syntology.ai/?focus=2404.06654","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2404.06654"}},"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/nvidia/ruler","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/mungg/OneRuler","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/NVIDIA/Star-Attention","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/hsiehjackson/ruler","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/open-compass/opencompass","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/InternLM/opencompass","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"ran_draft_wrong":5},"by_repo_kind":{"listed":{"samples":5,"ran":5,"repositories":2}},"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":"d7f2c747adfac407","entry":"clean_text","repo":"mungg/OneRuler","repo_kind":"listed","path":"OneRuler/eval/evaluate.py","file_url":"https://github.com/mungg/OneRuler/blob/HEAD/OneRuler/eval/evaluate.py","link_basis":"first_harvest_node","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":"d7f2c747adfac407"}},{"code_sha256_prefix":"e471d920d2c12c30","entry":"escape_quotes","repo":"mungg/OneRuler","repo_kind":"listed","path":"OneRuler/eval/evaluate.py","file_url":"https://github.com/mungg/OneRuler/blob/HEAD/OneRuler/eval/evaluate.py","link_basis":"first_harvest_node","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":"e471d920d2c12c30"}},{"code_sha256_prefix":"fd1b2d1bb5310843","entry":"extract_model_name","repo":"mungg/OneRuler","repo_kind":"listed","path":"OneRuler/eval/evaluate.py","file_url":"https://github.com/mungg/OneRuler/blob/HEAD/OneRuler/eval/evaluate.py","link_basis":"first_harvest_node","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":"fd1b2d1bb5310843"}},{"code_sha256_prefix":"67a4392dc018930e","entry":"generate_random_number","repo":"nvidia/ruler","repo_kind":"listed","path":"scripts/data/synthetic/niah.py","file_url":"https://github.com/nvidia/ruler/blob/HEAD/scripts/data/synthetic/niah.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"67a4392dc018930e"}},{"code_sha256_prefix":"5f32085fb2b18264","entry":"postprocess_pred","repo":"nvidia/ruler","repo_kind":"listed","path":"scripts/eval/evaluate.py","file_url":"https://github.com/nvidia/ruler/blob/HEAD/scripts/eval/evaluate.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":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"5f32085fb2b18264"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}