RAG (Retrieval-Augmented Generation)
검색과 생성을 결합해 정확성·최신성·근거를 확보합니다. 데이터 수집부터 평가·거버넌스까지 엔드투엔드로 다룹니다.
개요
RAG는 모델 파라미터 밖의 지식을 검색으로 주입해 환각을 줄이고, 근거를 인용할 수 있게 합니다.
정확성
근거 중심 답변으로 신뢰도 향상.
최신성
인덱스 갱신으로 최신 정보 반영.
추적성
출처 인용·감사 추적 가능.
인덱싱·청킹
자료 구조화와 청킹 전략은 검색 품질을 좌우합니다.
- 청킹: 길이/겹침(예: 512–1,024/10–20%)·헤더 보존·표/코드 전처리
- 메타데이터: 출처, 섹션, 날짜, 권한, 태그 → 필터링/정렬에 활용
- 임베딩/인덱스: HNSW/IVF·하이브리드(BM25+Dense)·증분 갱신
검색·리랭킹
쿼리 확장과 리랭킹으로 적합성을 극대화합니다.
- 쿼리 확장: HyDE, 다중 질의 재작성, 동의어/용어 사전
- 리랭킹: Cross-Encoder, ColBERT, MMR(중복 제거)·다양성 확보
- 가드레일: 권한·신뢰도 임계값·시간 가중치(Recency)
컨텍스트 구성·생성
프롬프트 템플릿과 인용 규칙으로 일관된 답변을 만듭니다.
- 스니펫 융합·헤더 보강·참조 표기(예: [1], [2])
- 도메인 지침(포맷·어조·금지어)·툴 사용(예: 계산/검색)
- KV 캐시/컨텍스트 캐시·장문 응답 슬라이딩 윈도우
평가·거버넌스
자동/휴먼 평가 지표로 지속 개선합니다.
- Answerability·Groundedness·Faithfulness·Context P/R
- PII/저작권 필터·정책 위반 감지·감사 로그
- A/B 테스트·데이터/프롬프트 버전 관리
스택
RAG (Retrieval-Augmented Generation)
Combine retrieval with generation to ensure accuracy, freshness, and traceability. We build end-to-end pipelines from data to evaluation.
Overview
RAG injects external knowledge at query time to reduce hallucination and enable citations.
Accuracy
Evidence-grounded answers.
Freshness
Keep indexes up to date.
Traceability
Citations and audit trail.
Indexing & Chunking
Structure data to maximize retrieval quality.
- Chunking: length/overlap (e.g., 512–1,024 / 10–20%), header retention, tables/code handling
- Metadata: source, section, date, ACL, tags → filtering & ranking
- Embeddings/Index: HNSW/IVF, hybrid (BM25+Dense), incremental refresh
Retrieval & Reranking
Use query expansion and reranking to boost relevance.
- Expansion: HyDE, multi-query rewriting, synonym dictionaries
- Reranking: Cross-Encoder, ColBERT, MMR (diversity & de-dup)
- Guardrails: permissions, confidence thresholds, recency weighting
Context Building & Generation
Templates and citation rules drive consistent outputs.
- Snippet fusion, header boosting, citation markers (e.g., [1], [2])
- Domain guidelines (format/tone) and tool-use (calc/search)
- KV/context cache, sliding windows for long answers
Evaluation & Governance
Mix automated and human evaluation for continuous improvement.
- Answerability, Groundedness, Faithfulness, Context P/R
- PII/copyright filters, policy violation detection, audit logs
- A/B testing, data/prompt versioning