Skip to content

Dominando a engenharia RAG10 / 10

The Production RAG Reference Architecture

Every piece, assembled: ingestion, hybrid retrieval, re-ranking, grounded generation, guardrails, eval and caching — the blueprint you can ship.

The Production RAG Reference Architecture

Here is the whole system on one page — the blueprint that turns the previous nine articles into something you can deploy.

The ingestion pipeline (offline)

  1. Clean source docs (strip boilerplate, fix encoding).
  2. Chunk structurally, 300–600 tokens, ~15% overlap.
  3. Enrich each chunk with metadata (source, section, date, url).
  4. Embed with a versioned model.
  5. Index into Postgres/pgvector with an ANN index + a keyword index.

The query pipeline (online)

  1. (Optional) Rewrite the query with a small model.
  2. Hybrid retrieve — vector + keyword, fused with RRF, top 30–50.
  3. Re-rank with a cross-encoder; keep top 3–8.
  4. Confidence gate — if the top score is weak, return "I don't know."
  5. Generate grounded, with citations, from the kept chunks.
  6. Faithfulness check the output; cache the answer.

The loop that keeps it honest

Wrap it in evaluation + observability: run the eval set on every change (recall, faithfulness, relevance), and log real queries with their retrieval scores so you can grow the eval set from production.

That's production RAG: measurable retrieval, grounded generation, honest under uncertainty, and affordable at scale. You now have the map and the mechanics.

Compartilhar este artigo

#RAG #LLM #AI

LinkedInX / TwitterBlueskyThreadsRedditHacker NewsWhatsAppE-mail

Série — Dominando a engenharia RAG

  1. Parte 01Por que RAG Ingênuo Falha em ProduçãoA demo de busca vetorial de 50 linhas que impressiona no notebook desmorona no momento em que usuários reais fazem perguntas reais. Aqui está o porquê — e o mapa de saída.
  2. Parte 02Chunking — The Decision That Sets Your CeilingYou can't retrieve what you chunked badly. Chunking is the most under-rated lever in RAG — and the cheapest to get right.
  3. Parte 03Embeddings & Vector Stores 101Um embedding transforma significado em geometria. Uma vector store torna essa geometria pesquisável em milissegundos. Acerte ambos e a recuperação fica fácil.
  4. Parte 04Hybrid Retrieval — Keyword + VectorVector search compreende significado mas tropeça em termos exatos, IDs e palavras raras. Keyword search acerta nesses e erra em paráfrase. Use ambos.
  5. Parte 05Re-Ranking — The Cheap Quality WinRetrieval gets you 30 plausible chunks. A re-ranker reads them against the actual question and floats the truly relevant few to the top.
  6. Parte 06Prompting the Generator — Grounding & CitationsGreat retrieval is wasted if the model ignores it or can't point to its sources. Grounding is a prompt-design discipline, not an afterthought.
  7. Parte 07Avaliação — Você Não Pode Melhorar o Que Não MedeSem um conjunto de avaliação, toda mudança em RAG é uma intuição. Com um, você afina chunking, retrieval e prompts com um número que diz se ajudou ou prejudicou.
  8. Parte 08Tratando Alucinações e GuardrailsQuando a recuperação vem vazia, um modelo prestativo inventa. Guardrails transformam 'confiantemente errado' em 'honestamente incerto' — a diferença que os usuários realmente confiam.
  9. Parte 09Disciplina de Custo e LatênciaUma consulta RAG toca embeddings, um vector DB, um re-ranker e um LLM. Cada um adiciona milissegundos e centavos. Em escala, disciplina aqui é a diferença entre uma margem e um incêndio.
  10. Parte 10The Production RAG Reference Architecturevocê está aquiEvery piece, assembled: ingestion, hybrid retrieval, re-ranking, grounded generation, guardrails, eval and caching — the blueprint you can ship.

Continue aprendendo

Skill do catálogo

architecture

Architectural decision-making framework. Requirements analysis, trade-off evaluation, ADR documentation. Use when making architecture decisions or analyzing system design.

Abrir o skill →

PDF — vitalício

MCP

Ligue o Claude Code às suas ferramentas e dados através do Model Context Protocol.

Ver o PDF →

Curso

O curso Claude Mastery

12 módulos · 5 idiomas · certificado · teste 3 dias grátis.

Ver planos →
LinkedInX / TwitterBlueskyThreads