병리 보고서 구조화 데이터 추출을 위한 Large Language Model 종합 평가
Comprehensive testing of large language models for extraction of structured data in pathology
TL;DR Highlight
오픈소스 LLM이 병리 보고서 구조화 추출에서 GPT-4와 동급 성능을 보인다.
Who Should Read
의료 데이터 파이프라인을 구축하는 백엔드/ML 엔지니어, 또는 비정형 텍스트를 구조화된 포맷으로 변환하는 ETL 작업을 설계하는 개발자.
Core Mechanics
- Llama3 70B, Qwen2.5 7B 같은 오픈소스 모델이 GPT-4 수준의 병리 보고서 파라미터 추출 정확도를 달성
- 579개 독일어·영어 병리 보고서에서 11개 핵심 파라미터(진단명, 병기 등)를 자동 추출하는 벤치마크 데이터셋 공개
- 프롬프트 엔지니어링 전략(zero-shot vs few-shot vs chain-of-thought)에 따라 모델 간 정밀도가 크게 달라짐
- 양자화(quantization — 모델 크기를 줄여 일반 GPU에서 돌리는 기법) 수준별로 성능 변화를 실측해 실제 배포 시나리오 커버
- 클라우드 API 없이 온프레미스 배포 가능 → 환자 데이터 외부 전송 없이 GDPR·개인정보 규제 대응 가능
- Llama2 13B처럼 작은 모델은 특정 파라미터에서 성능이 크게 떨어져 모델 선택이 중요함을 확인
Evidence
- 오픈소스 최상위 모델(Llama3 70B)이 GPT-4와 동등한 추출 정밀도를 579개 보고서 기준으로 달성
- 6개 모델 × 다양한 프롬프트 전략 × 양자화 조합으로 수백 개 구성 실험, 구성별 정밀도 편차가 통계적으로 유의미하게 존재
- 독일어·영어 이중언어 데이터셋에서 모두 고정밀 추출 확인 — 단일 언어 편향 없음
How to Apply
- 비정형 텍스트(진료 기록, 법률 문서, 고객 리포트)에서 정형 필드를 뽑아야 한다면, GPT-4 API 대신 Llama3 70B나 Qwen2.5 7B를 로컬에 띄워 비용과 개인정보 문제를 동시에 해결할 수 있음
- 양자화는 4-bit Q4_K_M 정도에서 성능 손실이 크지 않으므로, 24GB VRAM 소비자용 GPU(RTX 4090 등)에서 70B 모델 추론이 가능한지 먼저 검증해볼 것
- few-shot 프롬프트에 실제 보고서 예시 2~3개를 넣으면 zero-shot 대비 정밀도가 올라가는 경향 — 추출 필드별로 예시 선별 후 A/B 테스트로 최적 전략 확정
Code Example
# Ollama + Llama3 70B로 병리 보고서에서 구조화 데이터 추출 예시
import ollama
import json
report = """
Diagnosis: Invasive ductal carcinoma, grade 2.
Tumor size: 1.8 cm. Lymph nodes: 0/5 positive.
ER: positive, PR: positive, HER2: negative.
"""
prompt = f"""Extract the following fields from the pathology report as JSON:
- diagnosis
- tumor_size_cm
- lymph_nodes_positive
- er_status
- pr_status
- her2_status
Return only valid JSON, no explanation.
Report:
{report}
Few-shot example output:
{{"diagnosis": "Invasive ductal carcinoma", "grade": 2, "tumor_size_cm": 1.8,
"lymph_nodes_positive": "0/5", "er_status": "positive",
"pr_status": "positive", "her2_status": "negative"}}
Now extract from the report above:"""
response = ollama.chat(
model="llama3:70b",
messages=[{"role": "user", "content": prompt}]
)
try:
structured = json.loads(response["message"]["content"])
print(structured)
except json.JSONDecodeError:
print("Parsing failed — add retry or output fixing logic")Terminology
관련 논문
Mindwalk – 코딩 에이전트 세션을 코드베이스 3D 맵 위에서 재생하는 시각화 도구
Claude Code나 Codex 같은 AI 코딩 에이전트가 세션 중 코드베이스의 어떤 파일을 탐색하고 수정했는지를 3D 지도 형태로 시각화해서 재생해주는 로컬 도구다. 에이전트가 작업을 어떻게 이해했는지 한눈에 파악할 수 있다.
Ghost Font: 사람은 읽을 수 있지만 AI는 읽기 어려운 안티-AI 폰트 실험
움직임(모션)을 이용해 글자를 표현해서 AI 모델이 정적 이미지 분석으로는 메시지를 해독하지 못하게 막는 실험적 프로젝트인데, 커뮤니티에서는 이미 GPT-5.6, Claude Opus 등으로 해독에 성공한 사례가 속출해 실효성 논쟁이 뜨겁다.
GPT-5.6, Grok 4.5, Claude, Muse Spark 등 12개 모델이 동일한 앱 4개를 빌드한 결과 비교
12개 LLM 모델에게 레이캐스터 미로, 루빅스 큐브, 계산기, Game of Life 앱을 각각 5번씩 만들게 해서 성공률·비용·속도를 비교한 실전 벤치마크다. GPT-5.6 Sol이 전반적으로 가장 일관된 결과를 냈고, Grok 4.5는 가성비 면에서 눈에 띄었다.
Databricks가 수백만 라인 실제 코드베이스로 Coding Agent를 벤치마킹한 결과
Databricks가 자사 실제 코드베이스를 기반으로 여러 AI 코딩 에이전트의 성능과 비용을 직접 측정했고, 모델 토큰 가격과 실제 태스크 비용이 전혀 다르다는 점, 그리고 오픈소스 모델이 이제 최상위 수준에 도달했다는 점을 확인했다.
Reasoning에서 Uncertainty 추정하기: LLM의 다국어 및 교차언어 MCQA 성능 대규모 연구
LLM이 저자원 언어 질문을 받을 때 영어로 추론하게 하면 불확실성 추정 성능이 고자원 언어 수준으로 올라온다.
LLM-as-a-Verifier: 범용 Verification 프레임워크
LLM의 토큰 확률 분포를 활용해 discrete 점수 대신 continuous 점수를 뽑아내면, 추가 학습 없이 코딩·로봇·의료 에이전트 평가 정확도를 SOTA로 끌어올릴 수 있다.
Original Abstract (Expand)
Pathology departments generate large volumes of unstructured data as free-text diagnostic reports. Converting these reports into structured formats for analytics or artificial intelligence projects requires substantial manual effort by specialized personnel. While recent studies show promise in using advanced language models for structuring pathology data, they primarily rely on proprietary models, raising cost and privacy concerns. Additionally, important aspects such as prompt engineering and model quantization for deployment on consumer-grade hardware remain unaddressed. We created a dataset of 579 annotated pathology reports in German and English versions. Six language models (proprietary: GPT-4; open-source: Llama2 13B, Llama2 70B, Llama3 8B, Llama3 70B, and Qwen2.5 7B) were evaluated for their ability to extract eleven key parameters from these reports. Additionally, we investigated model performance across different prompt engineering strategies and model quantization techniques to assess practical deployment scenarios. Here we show that open-source language models extract structured data from pathology reports with high precision, matching the accuracy of proprietary GPT-4 model. The precision varies significantly across different models and configurations. These variations depend on specific prompt engineering strategies and quantization methods used during model deployment. Open-source language models demonstrate comparable performance to proprietary solutions in structuring pathology report data. This finding has significant implications for healthcare institutions seeking cost-effective, privacy-preserving data structuring solutions. The variations in model performance across different configurations provide valuable insights for practical deployment in pathology departments. Our publicly available bilingual dataset serves as both a benchmark and a resource for future research. Pathology departments produce many diagnostic reports as free text, which is hard to analyze or use in research and computer projects. Converting this free text into more standard organized information like test results or diagnoses, makes it easier to use. This task often requires human experts and takes time. Large language models (LLMs), which are advanced computer systems designed to understand and generate human-like text, might simplify this process. Here, we tested six LLMs, including freely available models and the commercial GPT-4 model, using 579 pathology reports in English and German. Our results show that freely available models can perform as well as commercial, providing a cheaper solution while avoiding privacy concerns. The shared dataset will support future research in pathology data processing. Grothey et al. examine the performance of large language models in structuring pathology reports. Findings demonstrate similar accuracy between commercial and open-source models providing a cost-effective, privacy-conscious solution to extract structured data with high precision from bilingual datasets.