feat: #468 vLLM Multi-LoRA 서빙 통합 및 draft_civil_response 어댑터 연결#511
Conversation
- 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개 추가
There was a problem hiding this comment.
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_evidencetimeout 상향 및 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_engine의 lora_request 전달 등을 검증하는 통합 테스트 추가 |
.env.example |
Multi-LoRA 설정을 위한 ADAPTER_PATHS 예시 추가 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # 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) |
There was a problem hiding this comment.
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.
| # 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, | ||
| ) |
There was a problem hiding this comment.
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.
- [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 → 모듈 속성 직접 검증으로 교체
관련 이슈
Closes #468
작업 배경
EXAONE 4.0-32B-AWQ 단일 vLLM 인스턴스에서 Multi-LoRA 서빙을 구성하고, 도구별로 LoRA adapter를 per-request attach하는 기능이 필요합니다. civil-adapter 학습이 완료되어
umyunsang/govon-civil-adapter에 배포되었으므로, 이를draft_civil_responsecapability에 연결합니다.주요 변경 사항
ADAPTER_PATHS환경변수 파싱 →ModelConfig.adapter_paths: Dict[str, str]확장AsyncEngineArgs에enable_lora/max_loras/max_lora_rank조건부 설정 (adapter 없으면 비활성화)_run_engine()→generate_civil_response()체인에lora_request파라미터 관통draft_civil_responseclosure에서 civil LoRA per-request attach (LoRARequest("civil", 1, path))append_evidenceclosure에 LLM 호출 경로 추가 (legal LoRA 또는 base model fallback, 실패 시 기존_build_evidence_section()fallback)append_evidencetimeout 15→30초 상향 (LLM 호출 추가)테스트 결과
기타 사항
siwo/govon-legal-adapter-train)이므로lora_req=Nonefallback으로 base model 사용LoRARequestimport는try/except로 방어하여 vllm 미설치 CI 환경에서도 안전머지 조건 체크리스트