テクニカルガイド
検索拡張生成 (RAG)
Retrieval-augmented generation, or RAG, supplies retrieved material to a generative model when answering a request.
このガイドを聴くAIによるナレーション · ~2 min
概要
It can give the system access to relevant documents without retraining the model for every document change. Retrieval does not guarantee that the final answer is supported or correct.
主なポイント
- Keep provenance and document context.
- Enforce permissions before retrieval results reach the model.
- Evaluate retrieval and generation independently.
ディープダイブ
A typical pipeline collects documents, preserves their provenance, creates searchable representations, retrieves candidates for a query, and passes selected evidence to a model. Some systems combine keyword and semantic search or rerank results before generation. Each stage can introduce omissions or errors. Document preparation determines what evidence can be found. Preserve headings, dates, tables, and source identifiers when dividing content into passages. A passage separated from an exception or footnote can convey the wrong meaning even when the words are copied correctly. Apply access controls before evidence reaches the model. A search result that is semantically relevant may still belong to a document the requesting user is not allowed to see. Treat instructions inside retrieved documents as untrusted content rather than authority to change the application’s behavior. Evaluate retrieval and answering separately. Check whether the needed evidence appears in the candidate set, whether the selected context retains it, and whether the answer uses it faithfully. Include questions with no answer in the collection and conflicting or outdated documents. The system needs an explicit way to say that evidence is insufficient.
04作業例
Find where a grounded answer fails
Construct two policies: an expired version allows returns for 30 days; the current version allows 14 days.
If retrieval returns only the old policy, the failure is upstream of generation. If both are retrieved but the answer chooses 30 days, investigate context selection and evidence use.
Add the effective-date conflict to both retrieval and answer evaluations.
それが示すもの
The invented example separates two causes that would otherwise look like the same wrong answer.
現実世界の実装
Answer a support question using the current policy and its effective date.
Return source passages alongside an explanation so a reader can verify it.
実践する
なぜそれが重要なのか
- 費用と予算. アーキテクチャの決定により、パフォーマンスと運用コストが何年にもわたって推進されます。
- より明確な判決. 技術教育は、チームが最新のスタックだけでなく、適切なスタックを選択するのに役立ちます。
- 品質管理. より良いエンジニアリングの選択により、本番環境での信頼性に関するインシデントが減少します。
気をつけてください
- 1 つのベンチマークを最適化すると、より広範なシステムの弱点が隠れる可能性があります。
- インフラストラクチャとメンテナンスのコストは過小評価されがちです。
- システムが複雑になるにつれて、セキュリティと可観測性のギャップが拡大する可能性があります。
次のステップ
- 実装前にレイテンシ、品質、コストの目標を定義します。
- 現実的な負荷とデータ条件でのベンチマーク。
- エラー、ドリフト、ユーザーへの影響を計測器で監視します。
- スケーリングの前に、ロールバックとインシデント対応のパスを準備します。
出典とさらなる参考文献
- Lewis and colleaguesRetrieval-Augmented Generation for Knowledge-Intensive NLP Tasks
探検を続けましょう
よくある質問
RAGは幻覚を排除しますか?
いいえ。検索は証拠を見逃したり、誤解を招く資料を返したり、生成器が誤って使用したりする可能性があります。最終的な回答は依然として評価が必要です。