DOCS/journey/troubleshooting/260203_intent_llm_call_optimization.md
Claude-51124 3ec28464f4 docs: 251023 남은 작업 3·5·6 완료, 계획 archive 이동
- troubleshooting: LLM 호출 최적화(경로별·할당량), 의도 프롬프트 313 정리
- 251023 전체 완료 → plans/archive 이동, README 갱신

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-03 11:12:18 +09:00

1.6 KiB

의도 분류 경로별 LLM 호출 최적화 (311 섹션 14)

날짜: 2026-02-03 작성자: happybell80 관련 파일: rb8001/app/services/brain/intent_graph.py, intent_langgraph_workflow.py, app/services/llm/intent_parser.py


경로별 LLM 호출 수 (메시지 1건당)

경로 조건 LLM 호출 수 비고
fastpath DecisionEngine 규칙/패턴 매칭, conf ≥ τ 0 LLM 미호출
semantic 임베딩 Top-K + 신뢰도 ≥ accept 0 임베딩 API만, LLM 미호출
llm fastpath/semantic 미충족 시 1 IntentParserLLM.parse 1회
LangGraph INTENT_USE_LANGGRAPH=true 시 0~2 짧은 메시지: expand_question 1회 + classify(내부 fastpath/semantic/llm) 0~1 + extract_entities 시 parser.parse 1회
  • traditional (_detect_traditional): 메시지당 0 또는 1 LLM 호출.
  • LangGraph: 메시지당 0 (fastpath/semantic으로 종료) 또는 1 (expand만) 또는 2 (expand + parse).

API 할당량 검토

  • Gemini API: RPM(분당 요청), RPD(일당 요청), TPM(분당 토큰) 제한. 초과 시 429.
  • 의도 분류는 메시지당 최대 2회 LLM 호출이므로, 동시 사용자 증가 시 RPM/RPD 모니터링 권장.
  • 할당량: Google AI Rate limits 참고. 프로젝트별 한도 확인 필수.

교훈

  • FastPath·Semantic으로 대부분 메시지에서 LLM 호출 0회로 비용 절감. LLM 호출은 불확실한 케이스에만 발생.
  • 경로별 호출 수를 문서화해 할당량 계획 및 311 체크리스트 충족.