Skip to content

feat: #468 vLLM Multi-LoRA 서빙 통합 및 draft_civil_response 어댑터 연결#511

Merged
umyunsang merged 3 commits into
mainfrom
feat/468-vllm-multi-lora-integration
Apr 6, 2026
Merged

feat: #468 vLLM Multi-LoRA 서빙 통합 및 draft_civil_response 어댑터 연결#511
umyunsang merged 3 commits into
mainfrom
feat/468-vllm-multi-lora-integration

Conversation

@umyunsang
Copy link
Copy Markdown
Member

@umyunsang umyunsang commented Apr 6, 2026

관련 이슈

Closes #468

작업 배경

EXAONE 4.0-32B-AWQ 단일 vLLM 인스턴스에서 Multi-LoRA 서빙을 구성하고, 도구별로 LoRA adapter를 per-request attach하는 기능이 필요합니다. civil-adapter 학습이 완료되어 umyunsang/govon-civil-adapter에 배포되었으므로, 이를 draft_civil_response capability에 연결합니다.

주요 변경 사항

  • ADAPTER_PATHS 환경변수 파싱 → ModelConfig.adapter_paths: Dict[str, str] 확장
  • vLLM AsyncEngineArgsenable_lora/max_loras/max_lora_rank 조건부 설정 (adapter 없으면 비활성화)
  • _run_engine()generate_civil_response() 체인에 lora_request 파라미터 관통
  • draft_civil_response closure에서 civil LoRA per-request attach (LoRARequest("civil", 1, path))
  • append_evidence closure에 LLM 호출 경로 추가 (legal LoRA 또는 base model fallback, 실패 시 기존 _build_evidence_section() fallback)
  • append_evidence timeout 15→30초 상향 (LLM 호출 추가)

테스트 결과

  • LoRA 통합 테스트 14개 신규 추가 (ADAPTER_PATHS 파싱, _run_engine lora_request 전달, enable_lora 조건부 활성화, SKIP_MODEL_LOAD 스킵, LoRARequest import 방어)
  • 기존 테스트 401개 전체 통과 (timeout 변경 반영 포함)
  • CI 전체 통과 (lint, security, test 3.10/3.11, build, runtime-contract)

기타 사항

  • legal-adapter는 현재 학습 중(siwo/govon-legal-adapter-train)이므로 lora_req=None fallback으로 base model 사용
  • legal-adapter 통합 테스트는 별도 이슈 #510으로 분리하여 학습 완료 후 진행 예정
  • LoRARequest import는 try/except로 방어하여 vllm 미설치 CI 환경에서도 안전

머지 조건 체크리스트

  • 1명 이상의 코드리뷰 승인 완료
  • CODEOWNERS(팀장) 최종 승인 완료
  • 모든 리뷰 코멘트 해결(resolved) 완료

- ADAPTER_PATHS 환경변수 파싱 (Dict[str, str]) 및 ModelConfig 확장
- AsyncEngineArgs에 enable_lora/max_loras/max_lora_rank 조건부 설정
- _run_engine()에 lora_request 파라미터 추가 및 generate_civil_response() 관통
- draft_civil_response closure에서 civil LoRA per-request attach
- append_evidence closure에 LLM 호출 경로 추가 (legal LoRA 또는 base model fallback)
- append_evidence timeout 15→30초 상향
- ADAPTER_PATHS 파싱/LoRA 통합 테스트 14개 추가
Copilot AI review requested due to automatic review settings April 6, 2026 11:41
@github-actions github-actions Bot added enhancement New feature or request ai-model AI 모델 관련 backend 백엔드 관련 labels Apr 6, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

vLLM 단일 엔진에서 Multi-LoRA를 per-request로 attach 할 수 있도록 런타임 설정/엔진 호출 체인을 확장하고, draft_civil_response(civil) 및 append_evidence(legal)에서 LoRA를 조건부로 적용하며 관련 통합 테스트를 추가합니다.

Changes:

  • ADAPTER_PATHS 환경변수 파싱 결과를 ModelConfig.adapter_paths: Dict[str, str]로 확장
  • vLLM 엔진 초기화 시 adapter 존재 여부에 따라 LoRA 기능을 조건부 활성화하고, _run_engine()/generate_civil_response()lora_request 전달 경로 추가
  • append_evidence timeout 상향 및 LoRA 통합 관련 테스트 신규 추가

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/inference/runtime_config.py ADAPTER_PATHS 파싱 및 adapter_paths 타입을 dict로 전환하고 요약 로그에 반영
src/inference/api_server.py vLLM LoRA 활성화 조건 분기 추가, _run_engine()lora_request 관통, civil/legal LoRA를 tool closure에서 per-request로 attach
src/inference/graph/capabilities/defaults.py append_evidence capability timeout을 30초로 상향
tests/test_inference/test_lora_integration.py ADAPTER_PATHS 파싱 및 _run_enginelora_request 전달 등을 검증하는 통합 테스트 추가
.env.example Multi-LoRA 설정을 위한 ADAPTER_PATHS 예시 추가

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +166 to +168
# Multi-LoRA 어댑터 경로: {"civil": "/path/to/civil", "legal": "/path/to/legal"}
# 환경변수 ADAPTER_PATHS="civil=/path/to/civil,legal=/path/to/legal" 형식으로 설정
adapter_paths: Dict[str, str] = field(default_factory=dict)
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ModelConfig docstring still describes adapter_paths as a List[str] in --lora-modules format (e.g., ["civil-adapter=/path"]), but the field was changed to Dict[str, str] keyed by adapter name. Please update the class docstring to reflect the new dict format to avoid misleading configuration guidance.

Copilot uses AI. Check for mistakes.
Comment on lines +199 to +206
# Multi-LoRA 서빙: adapter_paths가 설정되어 있으면 활성화
lora_enabled = bool(runtime_config.model.adapter_paths)
if lora_enabled:
engine_kwargs.update(
enable_lora=True,
max_loras=4,
max_lora_rank=64,
)
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new enable_lora/max_loras/max_lora_rank initialization branch isn’t covered by a unit test that asserts the actual AsyncEngineArgs(**engine_kwargs) call (e.g., adapter_paths set → enable_lora included; adapter_paths empty → kwargs omitted). Please add a test that patches AsyncEngineArgs/AsyncLLM.from_engine_args and validates the kwargs to prevent regressions in LoRA activation logic.

Copilot uses AI. Check for mistakes.
- [MUST] LoRA adapter_id 매직 넘버 → _LORA_ID_MAP 상수로 분리
- [MUST] output.outputs[0] 빈 배열 방어 (IndexError 방지)
- [SHOULD] append_evidence 프롬프트에 _escape_special_tokens() 적용 (인젝션 방어)
- [SHOULD] ModelConfig docstring Dict[str, str] 형식 반영
- [SHOULD] TestLoraEngineConfig → AsyncEngineArgs mock 기반 실제 검증으로 교체
- [SHOULD] test_draft_tool_skips_lora_when_none → 모듈 속성 직접 검증으로 교체
@umyunsang umyunsang merged commit ff2a472 into main Apr 6, 2026
12 checks passed
@umyunsang umyunsang deleted the feat/468-vllm-multi-lora-integration branch April 6, 2026 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-model AI 모델 관련 backend 백엔드 관련 enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Task 1.5] vLLM Multi-LoRA 서빙 통합 및 draft_civil_response 어댑터 연결

2 participants