Abstract
As Large Language Models (LLMs) expand their context windows to 200,000 tokens and beyond, evaluating their performance in specialized domains like medicine becomes critical. We present MedOdyssey, the first dedicated benchmark for long-context medical tasks. By addressing issues of knowledge leakage and tokenizer unfairness, MedOdyssey reveals a significant performance gap: while state-of-the-art models excel at simple retrieval, they struggle with the complex reasoning and specialized formatting required in lengthy medical documentation.
Introduction
General-purpose LLMs now boast context windows of 128K or even 200K tokens, yet evaluation has largely lagged behind in specialized fields. In medicine, context is paramount—analyzing a patient's entire Electronic Health Record (EHR), navigating massive knowledge graphs, or summarizing clinical guidelines requires more than just "finding a needle in a haystack."
Existing benchmarks often suffer from knowledge leakage, where models rely on training data memorization, and tokenizer unfairness, where different models process varying amounts of text for the same token count. MedOdyssey addresses these gaps by introducing a medical-specific evaluation suite that prioritizes fairness and prevents models from "cheating" via memorization.
The MedOdyssey Benchmark
To ensure a robust evaluation, MedOdyssey introduces three core principles:
- Maximum Identical Context (MIC): To ensure fairness, a fixed character-to-token ratio was calculated, ensuring models with different tokenizers are evaluated on the exact same textual content.
- Novel Facts Injection (NFI): To combat data contamination, "needles" containing facts the models could not have seen during training—such as very recent medical literature or fictional plot points—were inserted.
- Counter-intuitive Reasoning (CIR): Tasks like "Counting Penguins" require models to track sequences through disorganized lists and corrections, testing logic over simple pattern matching.
Datasets and Tasks
MedOdyssey comprises 10 datasets across two primary categories:
- Medical Needle In A Haystack (NIAH): Uses 30 volumes of the Compendium of Materia Medica and NCCN clinical guides as the background "haystack."
- Medical-Related Tasks: Includes Terminology Normalization (UMLS), Knowledge Graph QA (CMeKG2.0), and Table & Case QA (MSD, iiyi).
The benchmark evaluates models across seven context lengths: 4K, 8K, 16K, 32K, 64K, 128K, and 200K tokens.
Analysis of Model Performance
Evaluation across various proprietary and open-source models reveals that the "Hexagonal Warrior"—a model that excels at everything—remains a myth. While GPT-4o dominates in naive retrieval, its performance falters significantly when tasks require counting or following complex, non-linear logic in long contexts.
Key Findings
- The Formatting Wall: Many open-source models (e.g., InternLM2, ChatGLM3) successfully locate information but fail to output it in the requested JSON format as context length increases. Instruction-following ability degrades faster than retrieval ability.
- The Counting Challenge: The "Counting" task proved to be the ultimate stress test. While GPT-4o achieved a modest score on Chinese counting, most open-source models scored near zero, struggling with reasoning flaws and "question forgetting."
- Medical Context Density: Models were slightly more prone to errors when the "needle" was a general fact versus a medical fact. This suggests the specialized nature of medical text might help models anchor their attention, though it does not solve the underlying reasoning challenges.
Conclusion and Future Directions
MedOdyssey highlights that increasing context window size does not linearly translate to improved reasoning in specialized domains. Future work must address the limitations of current evaluation metrics, which rely heavily on string matching, and develop more nuanced, automated ways to evaluate open-ended medical QA. Furthermore, as LLMs are updated, the benchmark must remain a living document, constantly incorporating the latest medical literature to prevent future data contamination.
Summary updated