검색 상세

Context Engineering 기반 의학지식 AI Agent 설계

Design of a Context-Engineering-Based Medical Knowledge AI Agent

초록(요약문)

본 연구는 지역의료 위기 등으로 적시에 진료를 받기 어려운 환자들이 의학적으로 신뢰할 수 있는 의학 데이터를 사용하여 사용자의 의학 정보(증상, 질환, 수치 등)와 대화의 맥락을 반영하는 AI Agent 설계를 목표로 한다. ChatGPT, Gemini 등 기존의 LLM(Large Language Model, 대규모 언어모델)은 단일 턴 대화에서는 우수한 성능을 나타내지만, 대화가 지속되는 ‘멀티 턴’ 대화에서는 이전 턴들에서 제시된 환자의 정보를 충분히 기억하고 반영하지 못하는 한계가 있었다. 또한, 동일한 의학적 질의에 대해서도 매번 답변이 달라지는 현상이 발생하며 의학적 답변의 일관성이 떨어지는 한계 역시 드러냈다. 이러한 한계를 극복하기 위하여 본 연구에서는 Context Engineering이라는 전략적 접근 방식을 도입하였다. Context Engineering은 연속된 대화에서 사용자 개인의 맥락을 효과적으로 반영한 답변을 생성하기 위하여 매 턴마다 추출, 저장, 주입, 검증의 4단계 과정을 거친다. 그리고 이를 LangGraph 프레임워크와 Corrective RAG(CRAG)의 결합으로 의학적 신뢰성을 확보하는 동시에 실제 LLM과 유사하게 작동하는 시스템을 구축하였다. 실험은 Synthea 프레임워크로 생성한 80명의 가상 생성환자 데이터로 시행되었다. 80명의 생성환자 데이터는 나이, 성별, 질환, 증상, 복용 약 등 실제 환자 통계와 유사하게 설계된 것으로 각 환자마다 5턴의 대화를 시행하며 총 400턴의 대화를 테스트하였다. 실험 결과, 본 연구에서 설계한 AI Agent는 일반적인 LLM에 비하여 Answer Relevancy에서 0.014의 소폭 감소를 나타낸 것을 제외하면, faithfulness에서 0.455, Context Precision에서 0.636, Context Recall에서 0.438만큼의 향상된 성능을 보였다. 또한, 성능 향상이 확인된 지표의 통계적 검증 결과(p<0.001)에서도 유의미한 개선을 이루어낸 것이 확인되었다. 다만, CRAG의 성능을 정확히 분석하기 위하여 또 다른 대조군으로 설정한 RAG 대비해서는 유의미한 성능 개선을 만들어내지 못하였는데 이는 연구 설계단계시 구상한 데이터셋 유형별 세분화된 청킹, 임베딩 및 하이브리드 검색 전략이 RAG 단계에서도 효과적으로 작동했기 때문인 것으로 분석된다. 본 연구의 기여점은 다음과 같다. 첫째, 멀티 턴 대화 환경에서 사용자의 맥락 손실을 공학적으로 해결하는 Context Engineering 아키텍처를 제시하였다. 둘째, LangGraph 기반의 순환형 구조와 자체 평가 및 수정을 실시하는 Corrective RAG(CRAG)를 결합하여 의학적 신뢰성을 제고할 수 있는 견고한 검증 시스템을 구축하였다. 셋째, 대규모 학습 비용 없이도 검증된 데이터에 기반한 안전한 의학지식 AI Agent를 구현함으로써, 의료 소외지역 및 공공의료 분야에 적용 가능한 기술적인 대안을 제시하였다.

more

초록(요약문)

This study aims to design an AI agent that generates responses grounded in medically reliable data while reflecting user-specific medical information (e.g., symptoms, diagnoses, and numerical measurements) and conversational context. The work is motivated by the regional healthcare crisis, which can hinder timely access to care. Although large language models (LLMs) such as ChatGPT and Gemini perform well in single-turn interactions, they often fail to adequately retain and utilize patient information across multi-turn dialogues. They also exhibit reduced consistency, producing different answers to identical medical queries. To address these limitations, we introduce a strategic approach termed Context Engineering, which applies a four-stage procedure—Extraction, Storage, Injection, and Verification—at each conversational turn to incorporate the user’s personal context in continuous dialogue. We implemented this approach by integrating the LangGraph framework with Corrective Retrieval-Augmented Generation (CRAG), thereby improving medical reliability while maintaining interaction patterns comparable to conventional LLM-based systems. Experiments were conducted using 80 synthetic patient records generated with the Synthea framework. The dataset was constructed to resemble real-world patient distributions in age, sex, diagnoses, symptoms, and medications. We evaluated a total of 400 conversation turns (five turns per patient). Compared with a general LLM baseline, the proposed AI agent improved Faithfulness by 0.455, Context Precision by 0.636, and Context Recall by 0.438, while Answer Relevancy slightly decreased by 0.014. Improvements in the enhanced metrics were statistically significant (p < 0.001). However, compared with a RAG baseline introduced to isolate the impact of CRAG, the proposed method did not yield statistically significant gains, likely because the fine-grained chunking, embedding, and hybrid retrieval strategies were already effective in the base RAG configuration. This study makes three contributions: (1) it proposes a Context Engineering architecture that mitigates user-context loss in multi-turn medical dialogue through an engineering design; (2) it establishes a robust verification pipeline by combining a LangGraph-based cyclic workflow with CRAG-driven self-evaluation and correction; and (3) it provides a practical technical alternative for underserved regions and public healthcare settings by implementing a safe medical knowledge AI agent without costly large-scale training.

more

목차

제1장 서론 11
1.1 연구의 배경 및 필요성 11
1.2 연구의 목표 14
1.3 논문의 구성 15

제2장 관련 연구 및 배경지식 16
2.1 대규모 언어 모델(LLM) 16
2.2 검색증강생성(RAG) 17
2.3 Context Engineering 관련 연구 18
2.4 시사점 20

제3장 연구방법론 21
3.1 연구 목표 및 접근 방법 21
3.2 Context Engineering 파이프라인 22
3.3 LangGraph 기반 순환식 시스템 아키텍처 24
3.4 구현 세부사항 25

제4장 실험 설계 및 결과 28
4.1 실험 설계 28
4.2 데이터셋 33
4.3 평가지표 35
4.4 실험 결과 및 분석 40

제5장 결론 44
5.1 연구 요약 44
5.2 연구의 의의 45
5.3 한계점 및 향후 과제 46

참고문헌 47
붙임 LLM – AI Agent(CRAG) 모드 맥락 반영 평가 결과 49

more