Structured Output Support
response_format 파라미터로 text, json_object, json_schema를 지원하여 OpenAI의 structured output 인터페이스와 호환성을 강화했다.
변경 사항
- response_format 파라미터에 text, json_object, json_schema 타입 지원 추가
- OpenAI structured output API와의 호환성 강화로 provider 전환 비용 절감
이 변경이 중요한 이유
Structured output은 LLM 응답을 JSON schema에 맞게 강제하는 기능으로, 계약서 분류, 체크리스트 생성 같은 구조화된 결과가 필요한 task에서 필수적이다. LoRAX에서 이를 지원함으로써 OpenAI와 self-hosted 서빙 간 코드 변경 없이 전환할 수 있게 됐다. Grammar-Aligned Decoding(Park et al., 2024)에서 이론적으로 분석된 constrained decoding 기법을 서빙 인터페이스 수준에서 구현한 것이다.
기술 상세
OpenAI API spec의 response_format 필드를 LoRAX router에서 파싱하고, json_schema 모드에서는 제공된 schema에 따라 guided decoding을 수행하도록 구현했다. 머지 다음 날(2024-10-17) 내부 registry의 LoRAX 이미지를 새 버전으로 갱신하고, image repository 선택 기능도 추가했다.
관련 내부 작업
내부에서는 contract type classification, playbook generation, legal document drafting, widget response 등에 structured output을 적용했다. 이 PR 이후 내부 middleware에서 OpenAI/Azure/LoRAX 간 response_format 인터페이스를 통일하는 작업이 진행됐다.
관련 프로젝트 보기 →