검색 상세

AWS 분리 추론 인프라 기반 ReAct 파이프라인 시스템 구조 설계 및 성능 분석 : ReAct-Aware Prefetch 스케줄러 기반 검색 지연 은닉 메커니즘 설계 및 실증

Architectural Design and Performance Analysis of a ReAct Pipeline System on AWS Disaggregated Inference Infrastructure

초록(요약문)

대규모 언어 모델(LLM) 기반의 검색증강생성(RAG) 환경에서 속도, 품질, 자원 효율성은 시스템 설계의 핵심 축이다. 이를 최적화하기 위해 파이프라인 병렬화(PipeRAG), 동적 추론-검색 루프 에이전트(ReAct), 그리고 클라우드 기반 서버리스 분리 아키텍처가 각각 독립적으로 발전해 왔다. 그러나 기존 연구들은 이들을 개별적으로 다룰 뿐, 세 가지 기술의 상호 충돌을 극복하고 시스템 레벨의 최적화를 달성한 사례는 드물다. 특히 ReAct의 순차적 의존성과 PipeRAG의 정적 파이프라이닝은 본질적인 구조적 마찰을 일으킨다. ReAct 에이전트는 Thought 생성이 완전히 완료된 이후에야 다음 Action(검색)을 결정하기 때문에, 검색 시스템과 추론 엔진 사이에서 파이프라인 병렬화를 원천적으로 적용하기 어렵다. 동시에 클라우드 서버리스 분리 아키텍처는 정적 RAG를 전제로 설계되는 경우가 많아, 예측 불가능한 동적 에이전트 환경과의 통합은 미개척 영역으로 남아 있다. 본 논문은 이러한 한계를 극복하고자, 분리 추론 인프라 위에서 ReAct 에이전트의 동적 검색 결정을 효율적으로 파이프라이닝하는 'ReAct 파이프라인 통합 시스템'을 제안한다. 제안 시스템은 두 가지 핵심 기여를 중심으로 구성된다. 첫째, ReAct-Aware Prefetch 스케줄러는 LLM이 Thought 토큰을 스트리밍하는 과정에서 생성되는 문맥을 실시간으로 분석하여 다음 Action이 'Search'일 확률을 선제적으로 예측하고, 임계치 초과 시 비동기 방식으로 벡터 DB에 사전 검색 쿼리를 SQS를 통해 비동기 전송한다. 둘째, SQS 기반 비동기 파이프라인 구조는 Bedrock Agents 추론과 ECS Fargate 벡터 검색을 물리적으로 분리하여 병렬 실행하며, 검색 결과를 DynamoDB 캐시에 선적재(Prefetch)함으로써 에이전트의 실질적 검색 대기 시간을 최소화한다. AWS 서울 리전에서 수행한 총 120회(Proposed 모드, 1~4차 배치 누적) 실험을 통해 Prefetch 적중률 99.2%(Warm 상태 100%), DynamoDB 캐시 접근 속도 평균 3.49ms, Prefetch HIT 시 MISS 대비 2,910ms 응답시간 단축을 실증하였다. 또한 동일한 pgvector 검색 경로를 사용하는 Baseline 모드와의 비교 실험(각 30회)에서 Proposed 모드가 평균 669ms(10.7%) 낮은 End-to-End 응답시간을 기록하였으며, 이 차이는 Mann-Whitney U 검정 결과 통계적으로 유의하였다. 품질 측정에서는 LLM-as-Judge 기반 평가를 통해 Prefetch가 응답 품질을 저하시키지 않음을 확인하였다. 본 연구는 동적 에이전트 추론과 파이프라인 병렬화의 구조적 충돌을 인터셉터 기반 스케줄러로 실용적으로 해결한 아키텍처를 제시하며, 서버리스 분리 추론 환경에서 ReAct 기반 Agentic RAG 시스템 설계에 새로운 방향을 제시한다.

more

초록(요약문)

In large language model (LLM)-based retrieval-augmented generation (RAG) environments, latency, output quality, and resource efficiency form the three critical axes of system design. To optimize across these axes, pipeline parallelism (PipeRAG), dynamic reasoning-retrieval agent frameworks (ReAct), and cloud-native serverless disaggregated architectures have each advanced independently. However, existing research addresses these components in isolation; cases demonstrating integrated system-level optimization overcoming their mutual conflicts remain scarce. In particular, ReAct's sequential dependency and PipeRAG's static pipelining create fundamental structural friction. Because a ReAct agent determines the next Action (retrieval) only after Thought generation is fully complete, pipeline parallelism between the retrieval system and the inference engine is inherently constrained. Simultaneously, cloud serverless architectures are often designed with static RAG in mind, leaving integration with unpredictable dynamic agent environments as an unexplored domain. To address these limitations, this paper proposes a 'ReAct Pipeline Integrated System' that efficiently pipelines dynamic retrieval decisions by a ReAct agent on top of disaggregated inference infrastructure. The proposed system centers on two key contributions. First, the ReAct-Aware Prefetch Scheduler analyzes context generated during LLM Thought token streaming in real time to proactively predict the probability of the next Action being 'Search.' Upon exceeding a threshold, it asynchronously dispatches a prefetch query via Amazon SQS before Thought generation completes. Second, an SQS-based asynchronous pipeline physically separates Bedrock Agents inference from ECS Fargate vector retrieval, pre-loading search results into DynamoDB cache to minimize the agent's effective retrieval wait time. Experiments conducted over a cumulative total of 120 trials (Proposed mode) in the AWS Seoul region demonstrate a Prefetch hit rate of 99.2% (100% in warm state), DynamoDB cache access latency averaging 3.49 ms, and a 2,910 ms reduction in end-to-end response time when Prefetch HIT occurs versus MISS. Furthermore, in a comparative experiment against a Baseline mode using the identical pgvector retrieval path (30 trials each), the Proposed mode achieved 669 ms (10.7%) lower mean end-to-end latency, confirmed as statistically significant by the Mann-Whitney U test. Quality evaluation using an LLM-as-Judge framework confirmed that Prefetch does not degrade response quality. This study presents an interceptor-based scheduler architecture that practically resolves the structural conflict between dynamic agent reasoning and pipeline parallelism, offering a new design direction for ReAct-based Agentic RAG systems on serverless disaggregated inference infrastructure.

more

목차

1. 서 론 1
1.1 연구 배경 및 동기 2
1.2 연구 목표 및 기여 3
2. 배경 지식 4
2.1 검색 증강 생성 (RAG) 4
2.1.1 밀집 검색(Dense Retrieval)과 벡터 임베딩 5
2.1.2 근사 최근접 이웃(ANN) 탐색과 pgvector 6
2.1.3 RAG의 지연 병목 구조 7
2.2 동적 추론 에이전트와 ReAct 7
2.2.1 ReAct TAO 루프의 구체적 동작 8
2.2.2 Amazon Bedrock Agent의 ReAct 구현 9
2.2.3 ReAct의 한계와 최적화 필요성 10
2.3 분리 추론 인프라: AWS llm-d 10
2.3.1 Prefill/Decode 분리의 성능 이점 11
2.3.2 분리 추론과 RAG 파이프라인의 연계 12
2.3.3 서버리스 환경에서의 분리 추론 적용 13
3. 관련 연구 및 문제 정의 13
3.1 PipeRAG와 파이프라인 기반 선인출 13
3.2 llm-d 환경에서 ReAct 기반 RAG의 구조적 충돌 14
3.3 기존 연구의 한계 종합 및 본 연구의 위치 16
3.4 연구 가설 및 검증 계획 17
4. 시스템 설계 17
4.1 ReAct-Aware Prefetch 스케줄러 18
4.1.1 키워드 집합 K의 설계 19
4.1.2 임계치(Threshold τ) 및 폴링 설계 20
4.2 SQS 기반 비동기 파이프라인 구조 22
4.2.1 파이프라인 컴포넌트 설계 결정 22
4.2.2 전체 처리 흐름 (End-to-End) 24
4.3 3축 성능 평가 프레임워크 25
4.4 구현 방향 전환 및 핵심 기여 범위 26
4.5 시스템 동작 시나리오 및 예외 처리 27
4.5.1 정상 동작 시나리오 (Prefetch HIT) 27
4.5.2 Cold Start 시나리오 (Prefetch MISS) 28
4.5.3 오예측 시나리오 (False Positive) 29
4.5.4 시스템 가용성 및 내결함성 29
5. AWS 구현 환경 30
5.1 Lambda 인터셉터 구현 31
5.1.1 OrchestrationTrace 인터셉터 31
5.1.2 DynamoDB 폴링 메커니즘 32
5.2 ECS Fargate Retrieval Worker 구현 33
5.2.1 SQS 메시지 처리 흐름 34
5.2.2 pgvector ANN 검색 구현 35
5.2.3 컨테이너 배포 구성 36
5.3 컴포넌트 연동 및 데이터 흐름 36
5.3.1 API Gateway Lambda 구간 37
5.3.2 Lambda Bedrock Agents 구간 37
5.3.3 Lambda SQS ECS 구간 37
5.3.4 Lambda 최종 응답 구조 38
5.4 문서 색인 파이프라인 39
6. 실험 및 평가 41
6.1 실험 환경 41
6.1.1 클라우드 인프라 구성 41
6.1.2 실험 데이터셋 42
6.1.3 실험 프로토콜 43
6.2 Prefetch 적중률 분석 43
6.2.1 전체 실험 결과 44
6.2.2 질문 유형별 적중률 45
6.3 캐시 접근 비용 분석 46
6.3.1 DynamoDB 캐시 접근 속도 46
6.4 HIT 여부에 따른 응답시간 비교 47
6.4.1 전체 응답시간 분포 47
6.4.2 HIT vs. MISS 응답시간 차이 48
6.5 질의 유형별 응답시간 분석 49
6.6 실험 결과 종합 50
6.7 통계적 유의성 검증 53
6.7.1 기술 통계 및 신뢰구간 53
6.7.2 실험 배치 간 재현성 검증 54
6.7.3 질의 유형 간 응답시간 차이 검정 55
6.7.4 Cold Start MISS의 효과 크기 56
6.8 Proposed vs. Baseline 비교 실험 56
6.8.1 1차 비교 실험 결과 57
6.8.2 2차 비교실험 결과 (신규 질의 세트) 57
6.8.3 질의 유형별 비교 분석 58
6.9 품질(Quality) 및 비용(Cost) 측정 60
6.9.1 응답 품질 측정(LLM-as-Judge) 61
6.9.2 비용(Cost) 측정 62
6.9.3 3축 평가 종합 64
7. 결론 및 향후 연구 64
7.1 연구 결과 요약 66
7.2 연구의 한계 67
7.3 향후 연구 방향 68
참고문헌 70

more