TL;DR
This paper investigates the "last mile" problem of coding agents—autonomous LLMs equipped with tools—when tasked with digitizing complex, 100+ page clinical trial protocols. The authors introduce TRIALPD-BENCH, a new expert-annotated benchmark, and demonstrate that while agents are excellent at finding relevant information, they frequently stumble when transcribing and structuring it. To bridge this gap, they developed TRIALSCRIBE, a domain-specific harness that enables local open-weight models to match or even outperform proprietary giants like GPT-5.6-Sol.
What Problem Does This Paper Address?
Clinical trial protocols are the "source of truth" for medical studies, yet they are almost exclusively trapped in unstructured, lengthy PDF documents (often exceeding 100 pages). Manually digitizing these into machine-readable formats is slow, expensive, and prone to errors that can compromise trial safety or regulatory compliance.
While modern coding agents (like Claude Code or OpenAI’s Codex) have shown promise in software engineering, their reliability in high-stakes "long-document" tasks remains unproven. These tasks require more than just text retrieval; they demand the ability to navigate complex layouts, resolve merged table cells, and link information scattered across dozens of pages. The authors identify a critical bottleneck: agents often locate the correct evidence but fail in the "last mile" of faithful transcription and relational structuring.
Methods
The researchers evaluated nine different models (both proprietary and open-weight) using five different agent harnesses. To improve performance, they introduced TRIALSCRIBE, a specialized harness designed to support agents in two ways:
- Task Skills: A set of domain-specific guidelines (provided as a
SKILL.mdfile) that teaches the agent how protocols are typically organized, which conventions to follow (like USDM v4.0 standards), and how to handle common PDF pitfalls. - Verification Loop: After an agent generates a draft, a separate "auditor" agent session reviews the output against the source document. It identifies errors, cites specific page numbers, and suggests corrections. The original agent then applies these fixes in a multi-turn refinement process.
This approach was compared against standard RAG (Retrieval-Augmented Generation) pipelines and specialist OCR/document-understanding models.
Datasets
The authors introduced TRIALPD-BENCH, a benchmark consisting of 150 unique clinical trial protocols (median length: 122 pages). The benchmark covers four key task categories:
- Disease Indication: Identifying the specific condition under study.
- Eligibility Criteria: Extracting inclusion and exclusion rules.
- Objectives & Endpoints: Linking study goals to their measurable outcomes.
- Schedule of Activities (SoA): Reconstructing complex visit-by-activity tables.
Unlike previous datasets that often use simplified registry text, TRIALPD-BENCH uses full, messy, real-world PDFs, including those with garbled text layers that require visual recovery (OCR).
Key Insights and Ideas
- The "Last Mile" Failure: The most striking finding is that agents usually find the right pages (high evidence recall) but fail to transcribe the data accurately. For example, an agent might correctly locate the eligibility section but change a "≥" to a ">", a small character shift with massive clinical implications.
- Relational Complexity is the Killer: Agents perform well on contiguous text (Indication F1 ~85%) but struggle significantly with relational tasks like linking endpoints to objectives or building structured timelines.
- Coding Agents > RAG: Coding agents significantly outperform traditional RAG pipelines. The flexibility of an agent to adjust its document-processing strategy on the fly is far more effective than a fixed retrieval-and-generation pipeline.
- Cost is Not a Proxy for Quality: The study found that some frontier agents are several times more expensive than others while providing similar accuracy. Furthermore, with the right harness (TRIALSCRIBE), a much cheaper, locally-served model can outperform expensive proprietary ones.
Key Results
- TrialScribe Boost: TRIALSCRIBE improved the performance of the open-weight Qwen3.8-27B model by 6.2 to 59.4 points across various metrics.
- Matching the Giants: With the TRIALSCRIBE harness, the local Qwen model matched or surpassed GPT-5.6-Sol on endpoint extraction and timeline activity recall.
- OCR Superiority: General-purpose coding agents were found to be more accurate at transcribing complex Schedule of Activities (SoA) tables than specialist document-understanding models like Mistral OCR or PaddleOCR.
- Task Difficulty: The "Schedule of Activities" task proved the most difficult, with even the best agents reaching only ~86% F1, highlighting that fully autonomous protocol digitization is not yet a solved problem.
Limitations and Future Work
The authors acknowledge several limitations:
- Small Timeline Sample: The structured timeline extraction task was evaluated on only three protocols due to the extreme complexity of the reference annotations.
- Task Scope: The study focused on four specific digitization tasks; protocols contain many other table types (e.g., dosing, safety assessments) that were not covered.
- Relational Gaps: Despite improvements, a significant gap remains in reconstructing complex relational structures, suggesting that future work should focus on better reasoning over document-wide relationships rather than just better retrieval.
The researchers suggest that extending TRIALPD-BENCH to more table types and further refining the verification loops are the most promising paths forward for reaching full automation in clinical trial digitization.
Summary updated