Panduan Retrieval-Augmented Generation (RAG)

How RAG berfungsi — retrieve-lalu-generate pattern behind Google AI Overviews, ChatGPT Search, dan Perplexity — dan what ini berarti untuk getting Anda konten cited.

Pertama kali diterbitkan: 24 Jun 2026 · Terakhir diperbarui: 3 Agu 2026 · Advanced
Bahasa

RAG (Retrieval-Augmented Generation) adalah retrieve-lalu-generate pattern behind AI search. ini runs two phases di kueri time — retrieval (temukan relevant passages dari sebuah external indeks) dan augmented generation (feed itu passages untuk sebuah LLM untuk write sebuah grounded, cited jawaban) — without ever changing model's weights. ini adalah how AI jawaban cover informasi beyond sebuah model's training cutoff. retrieval phase chains chunking → embeddings → pencarian vektor → re-peringkat → top-k passages. RAG reduces hallucinations tetapi doesn't eliminate them — dan insufficient retrieved context dapat membuat them worse. untuk SEO there's no separate AI indeks: menjadi dapat di-crawl, terindeks, dan structured ke jelas, self-berisi passages adalah prerequisite untuk menjadi retrieved dan cited.

Lewis dan colleagues’ 2020 sistem paired sequence generation dengan dense retrieval dari sebuah non-parametric indeks. Evidence for this claim The original RAG paper combined a pretrained sequence-to-sequence model with a non-parametric dense-vector index retrieved during generation. Scope: Lewis et al.'s 2020 RAG architecture and experiments, not every modern retrieval system. Confidence: high · Verified: Lewis et al.: Retrieval-Augmented Generation Google Cloud’s saat ini overview defines RAG more broadly sebagai supplying retrieved external knowledge untuk sebuah model. Evidence for this claim Google Cloud describes RAG as retrieving relevant information from external knowledge sources and providing it to a model to improve generated responses. Scope: General RAG architecture in Google Cloud documentation; quality depends on retrieval, source quality, and generation. Confidence: high · Verified: Google Cloud: RAG overview

TL;DR — RAG adalah sebuah two-phase, inference-time pattern: retrieval (temukan relevant passages di sebuah external corpus) lalu augmented generation (feed itu passages untuk sebuah LLM untuk produce sebuah grounded, cited jawaban). weights tidak pernah perubahan — ini combines model’s parametric memory dengan non-parametric memory retrieved live. retrieval phase chains chunking → embeddings → pencarian vektor → re-peringkat → top-k. “Naive” (terjemahan) “Naive” RAG adalah retrieve-lalu-generate; advanced RAG menambahkan kueri rewriting dan re-peringkat; agentic RAG menambahkan iterative, multi-hop retrieval. Retrieval dapat ground jawaban tetapi melakukan not guarantee correctness; di one Gemma evaluation, insufficient context coincided dengan more incorrect jawaban. untuk SEO: there’s no separate AI indeks; crawlability, pengindeksan, dan passage-tingkat clarity adalah prerequisites untuk menjadi retrieved.

two phases (dan why “inference time” (terjemahan) “inference time” adalah whole poin)

Retrieval is a pipeline: chunk, embed, search, re-rank, then hand the survivors to the model. Sumber: /ai-search/how-search-works/rag/

Five stages run left to right at inference time. Chunking splits documents into retrievable passages. Embeddings represent each passage as a dense vector. Vector search retrieves candidates and some systems combine it with BM25 keyword search. Re-ranking re-scores and narrows the candidate set. The top surviving passages enter the model context. The model's weights do not change.

© Patrick Stox LLC · CC BY 4.0 ·

RAG combines trained model memory with retrieved context at query time — without changing the weights. Sumber: /ai-search/how-search-works/rag/

Two sources feed one generation step. Parametric memory is knowledge encoded in the model weights during training and is limited by the training data and cutoff. Non-parametric memory consists of passages retrieved from an external index at query time. Generation uses both while the weights remain unchanged, producing an answer that can be grounded in and cite the retrieved sources; this does not guarantee correctness.

© Patrick Stox LLC · CC BY 4.0 ·

Break acronym apart dan Anda memiliki model: Retrieval plus Augmented Generation. sebuah kueri comes di; sistem retrieves paling relevant passages dari sebuah external corpus; ini injects itu passages ke LLM’s context window; LLM generates sebuah jawaban grounded di them.

detail itu everyone gets wrong: ini happens di inference time, dan model’s weights adalah tidak pernah touched. RAG adalah not training dan ini adalah not fine-tuning. original 2020 paper dari Patrick Lewis dan colleagues di Facebook AI Research framed ini sebagai combining two jenis dari memory — parametric memory (knowledge baked ke weights selama training) dan non-parametric memory (knowledge retrieved live dari sebuah indeks). RAG menggunakan both di once. AWS puts practical case plainly: retraining sebuah foundation model untuk fresh atau domain-spesifik knowledge adalah expensive, dan “RAG is a more cost-effective approach to introducing new data to the LLM.” (terjemahan) “RAG adalah sebuah more cost-effective approach untuk introducing baru data untuk LLM.”

( naming, untuk what ini adalah worth, adalah sebuah accident. Lewis later admitted: “We definitely would have put more thought into the name had we known our work would become so widespread… We always planned to have a nicer sounding name, but when it came time to write the paper, no one had a better idea.” (terjemahan) “kami definitely akan memiliki put more thought ke name memiliki kami known kami berfungsi akan become so widespread… kami selalu planned untuk memiliki sebuah nicer sounding name, tetapi when ini came time untuk write paper, no one memiliki sebuah better idea.”)

Inside retrieval phase

“Retrieve the relevant passages” (terjemahan) “Retrieve relevant passages” adalah doing sebuah lot dari berfungsi di itu kalimat. di sebuah nyata sistem ini adalah sebuah pipeline:

  1. Chunking. Documents get split ke retrievable pieces. Chunk size adalah sebuah nyata tradeoff — too kecil dan sebuah passage loses -nya context; too besar dan ini floods token budget dengan irrelevance. Strategies range dari fixed token counts (100/256/512) untuk recursive/sliding windows untuk “Small2Big” (terjemahan) “Small2Big” (retrieve sebuah kecil kalimat, kembalikan -nya parent chunk untuk generation).
  2. Embeddings. setiap chunk adalah turned ke sebuah dense vector — sebuah numeric representation dari -nya meaning — so similarity adalah computed semantically, not oleh keyword match. ini adalah why konten tentang sebuah topic gets retrieved bahkan when ini doesn’t gunakan exact kueri phrasing.
  3. pencarian vektor. kueri adalah embedded too, dan sistem menemukan chunks whose vectors sit closest untuk ini. sebagian besar production stacks run hybrid search — dense vector retrieval plus BM25 keyword search — because setiap catches recall lainnya misses.
  4. Re-peringkat. sebuah separate model re-scores candidates oleh relevance untuk kueri dan reorders them, “effectively reducing the overall document pool.” (terjemahan) “effectively reducing overall document pool.” hanya top survivors membuat ini ke context.
  5. Top-k ke prompt. best passages adalah concatenated dengan pengguna’s kueri dan handed untuk generator.

Chunking adalah fragile tautan. Anthropic identified itu “traditional RAG solutions remove context when encoding information” (terjemahan) “traditional RAG solusi hapus context when encoding informasi” — sebuah chunk pulled out dari -nya document loses surrounding context itu dibuat ini meaningful. mereka Contextual Retrieval technique (prepending chunk-spesifik context sebelum pengindeksan) reduced failed retrievals oleh 49%, dan oleh 67% combined dengan re-peringkat. itu’s sebuah strong signal itu chunking masalah adalah nyata — dan itu self-berisi, context-rich passages adalah easier untuk retrieve correctly.

Naive, advanced, dan agentic RAG

survey literature (Gao et al., 2023) splits RAG ke sebuah berguna taxonomy:

  • Naive RAG“a traditional process that includes indexing, retrieval, and generation.” (terjemahan) “sebuah traditional process itu mencakup pengindeksan, retrieval, dan generation.” Retrieve top-k once, generate once. ini “struggles with precision and recall, leading to the selection of misaligned or irrelevant chunks.” (terjemahan) “struggles dengan precision dan recall, leading untuk selection dari misaligned atau irrelevant chunks.”
  • Advanced RAG — menambahkan “pre-retrieval and post-retrieval strategies.” (terjemahan) “pre-retrieval dan post-retrieval strategies.” Pre-retrieval: kueri rewriting dan better pengindeksan (including HyDE, where model generates sebuah hypothetical jawaban, embeds itu, dan retrieves documents itu look like jawaban alih-alih pertanyaan). Post-retrieval: re-peringkat dan context compression.
  • Modular / agentic RAG — model retrieves, alasan tentang what’s masih missing, dan retrieves again, iterating di seluruh multiple hops. ini adalah saat ini state dari AI search. sebagai Michael King put ini: “The retrieve-once-then- generate pattern that defined the first wave is obsolete… Agentic RAG is now the default.” (terjemahan) “ retrieve-once-lalu- generate pattern itu defined pertama wave adalah obsolete… Agentic RAG adalah now default.”

ini penting untuk SEO because konten now memiliki untuk survive multiple retrieval rounds dan contradiction-memeriksa — not hanya sebuah single retrieval pass.

melakukan RAG eliminate hallucinations? No.

In one evaluation, Gemma answered incorrectly on 10.2% of questions with no context and 66.1% with insufficient context; this is not a universal model effect. Sumber: Data: Google Research

Two bars report Gemma's incorrect-answer rate in one Google Research evaluation. With no context, the rate is 10.2 percent. With insufficient context, the rate is 66.1 percent. The comparison comes from Google Research's ICLR 2025 sufficient-context study and should not be generalized to every model, dataset, or retrieval system.

RAG dapat ground jawaban di retrieved sources, tetapi LLM dapat masih misread atau di atas-interpret what ini pulled. Google Research (ICLR 2025) documented sebuah counterintuitive hasil di one evaluation: Gemma produced incorrect jawaban pada 10,2% dari pertanyaan dengan no context dan 66,1% dengan insufficient context. researchers report itu models dapat “excel with sufficient context but fail to recognize when context is insufficient.” (terjemahan) “excel dengan sufficient context tetapi fail untuk recognize when context adalah insufficient.” Treat itu sebagai sebuah model- dan evaluation-spesifik warning, not proof itu retrieval universally causes worse jawaban. practical lesson adalah narrower: retrieval quality dan context sufficiency perlu untuk menjadi evaluated alih-alih assumed. Google operationalized finding sebagai sebuah LLM re-ranker di -nya Vertex AI RAG mesin.

RAG vs. fine-tuning

ini get conflated constantly, dan mereka’re fundamentally berbeda:

  • RAG retrieves external informasi di kueri time. Weights unchanged. Best untuk fresh/changing informasi, citation requirements, dan cost. survey ditemukan “RAG consistently outperforms [unsupervised fine-tuning], for both existing knowledge encountered during training and entirely new knowledge.” (terjemahan) “RAG consistently outperforms [unsupervised fine-tuning], untuk both existing knowledge encountered selama training dan entirely baru knowledge.”
  • Fine-tuning modifies model’s weights di sebuah separate training run. Best untuk changing style dan perilaku, atau teaching stable domain knowledge itu doesn’t perubahan.

Anda’d reach untuk RAG untuk membuat sebuah model know latest facts; Anda’d reach untuk fine-tuning untuk perubahan how ini talks.

RAG di wild: Google, ChatGPT, Perplexity

  • Google AI Overviews. Google panggilan RAG “a technique (also known as grounding)… relying on our core Search ranking systems to retrieve relevant, up-to-date web pages from our Search index.” (terjemahan) “sebuah technique (juga known sebagai grounding)… relying pada kami core Search peringkat sistem untuk retrieve relevant, up-untuk-date web halaman dari kami Search indeks.” Two things ikuti. pertama, tidak ada separate AI indeks“our generative AI features on Google Search are rooted in our core Search ranking and quality systems.” (terjemahan) “kami generative AI fitur pada Google Search adalah rooted di kami core Search peringkat dan quality sistem.” kedua, Google runs kueri fan-out: “concurrent, related queries generated by the model to request more information.” (terjemahan) “concurrent, related kueri generated oleh model untuk permintaan more informasi.” sebuah single pertanyaan dapat spawn multiple sub-kueri, setiap retrieving berbeda konten — so Anda konten memiliki untuk satisfy implied sub-pertanyaan, not hanya head kueri.
  • ChatGPT Search. Launched (October 2024) dengan Bing sebagai -nya data partner, dan OpenAI’s own crawler documentation confirms OAI-SearchBot melakukan independent fetching dan pengindeksan untuk search citations, separate dari GPTBot’s training-crawl. OpenAI hasn’t published saat ini retrieval mix antara Bing dan -nya own indeks, dan OpenAI memiliki since positioned ChatGPT Search sebagai sebuah standalone competitor untuk Bing alih-alih sebuah wrapper sekitar ini — so treat “it’s basically Bing” (terjemahan) “ini adalah basically Bing” sebagai sebuah simplification. documented, actionable lever adalah narrower dan more durable: don’t block OAI-SearchBot di robots.txt, because itu’s crawler OpenAI itself names sebagai one itu indeks konten untuk search citations.
  • Perplexity. dibangun pada hybrid retrieval (Vespa.ai — BM25 + dense) dengan custom embedding models dan sebuah strict re-peringkat threshold: oleh ketiga-party analysis, hanya top ~30% dari 60-plus retrieved sources survive untuk generation stage, dan “citations are not retrofitted post-generation — they are structurally assigned during context assembly.” (terjemahan) “citations adalah not retrofitted post-generation — mereka adalah structurally assigned selama context assembly.” Deep Research runs agentic loop di seluruh dozens dari searches.

What RAG berarti untuk SEO

Strip away jargon dan playbook adalah concrete:

  • menjadi di indeks adalah prerequisite — full stop. No separate AI indeks berarti crawl → indeks → retrieve chain memiliki untuk menjadi intact. jika sebuah halaman dapat’t menjadi di-crawl dan terindeks, ini dapat’t menjadi retrieved ke sebuah AI jawaban. yang sama adalah benar untuk AI mesin itu bangun mereka own pools: AI crawler like OAI-SearchBot dan PerplexityBot memiliki untuk menjadi allowed untuk fetch Anda, atau Anda’re invisible untuk itu jawaban.
  • Write self-berisi passages. RAG retrieves fragments, not whole halaman. sebagai iPullRank’s Francine Monahan put ini, AI sistem examine “fragments of pages rather than the page as a whole” (terjemahan) “fragments dari halaman rather daripada halaman sebagai sebuah whole” — so craft “stand-out passages and phrases” (terjemahan) “stand-out passages dan phrases” itu jawaban sebuah spesifik pertanyaan pada mereka own. ini adalah exactly H2/H3 structure dan jelas topic sentences baik SEO sudah rewards. Google explicitly says not untuk chop Anda konten ke tiny pieces untuk AI — well-structured konten chunks well pada -nya own.
  • Cover sub-topics. kueri fan-out berarti one pertanyaan dapat trigger banyak retrievals. Depth di seluruh related sub-pertanyaan beats one halaman stuffed sekitar sebuah single keyword.
  • Authority drives citation more daripada peringkat position. dari sebuah 8 000-citation analysis: “Strong organic search presence and broad web visibility leads to AI citations, not the other way around” (terjemahan) “Strong pencarian organik presence dan broad web visibilitas leads untuk AI citations, not lainnya cara sekitar” — dan “highly authoritative content from a lower-ranking page” (terjemahan) “highly authoritative konten dari sebuah lower-peringkat halaman” sometimes gets cited di atas sebuah less credible top-peringkat one. My own data lines up (dari my AI Overview citation research): mentions pada heavily-ditautkan halaman adalah strongest predictor dari AI Overview inclusion (ρ ≈ 0,70), dan branded web mentions correlated ~0,66 di seluruh 75 000 brands.
  • Fresh konten memiliki sebuah edge. AI citations skew meaningfully fresher daripada organic hasil, so currency penting.

jika Anda ingin one-kalimat versi: RAG didn’t replace SEO — ini raised stakes pada bagian dari SEO itu adalah selalu tentang menjadi findable dan menjadi jelas.

Add an expert note

Pin an expert quote

New person? Create their unclaimed profile at /admin/experts/ → Pin a quote first.