0Pricing
Prompt Engineering & LLM Optimization for Developers · บทเรียน

การสร้างเสริมด้วยการค้นคืน (RAG)

ทำความเข้าใจและนำ RAG ไปใช้งานเพื่ออ้างอิงคำตอบของ LLM กับข้อมูลภายนอกที่เป็นปัจจุบัน เพิ่มความแม่นยำและลดการสร้างข้อมูลหลอน

การสร้างเสริมด้วยการค้นคืน (RAG) เป็นบทเรียน Prompt Engineering & LLM Optimization for Developers ฟรีบน CoddyKit นี่คือบทเรียนที่ 1 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน Prompt Engineering & LLM Optimization for Developers และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส Prompt Engineering & LLM Optimization for Developers มีบทเรียนทั้งหมด 4 บทเรียน

บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ

What is RAG?

Welcome! In this lesson, we'll dive into Retrieval Augmented Generation (RAG). It's a powerful technique that helps Large Language Models (LLMs) give more accurate and up-to-date answers.

Think of it as giving an LLM a personal research assistant before it answers your question. This assistant quickly finds relevant information from a trusted source.

LLMs: Smart, but Limited

Traditional LLMs are trained on vast amounts of data, but this data has a cut-off date. This means they can't know about recent events or specific, private information.

Without external help, LLMs might:

  • Hallucinate: Make up facts that sound plausible but are incorrect.
  • Provide outdated info: Give answers based on old data.
  • Lack domain-specific knowledge: Struggle with highly specialized topics.

RAG to the Rescue!

RAG addresses these limitations by connecting LLMs to external, up-to-date, and authoritative knowledge sources. It's like giving the LLM an open-book exam!

Instead of relying solely on its pre-trained memory, an LLM enhanced with RAG can:

  • Access real-time information.
  • Cite specific sources for its answers.
  • Reduce the chance of making things up (hallucinations).

Retrieval and Generation

RAG works in two main stages:

  1. Retrieval: First, it finds relevant pieces of information from a knowledge base based on your query.
  2. Generation: Then, it uses this retrieved information as context to help the LLM formulate a precise and accurate answer.

These two steps work together seamlessly to provide better responses.

Step 1: Retrieval

The retrieval phase is all about efficiently searching a collection of documents. Imagine you have a library of all your company's internal documents or the latest news articles.

When you ask a question, the RAG system quickly scans this library to pull out only the most relevant paragraphs or sections. This ensures the LLM gets focused, helpful context.

Smart Searching with Vectors

How does the system "know" what's relevant? It uses something called embeddings and vector databases.

  • Embeddings: Convert text (your question, document chunks) into numerical representations (vectors). Similar texts have similar vectors.
  • Vector Databases: Store these text embeddings and allow for super-fast "similarity searches." So, when you ask a question, it finds document chunks whose vectors are closest to your question's vector.

Step 2: Generation

Once the relevant information is retrieved, it's combined with your original prompt and sent to the LLM. This extra context acts as a guiding hand for the LLM.

The prompt might look something like: "Using the following context, answer the question: [Retrieved Context] Question: [User's Question]"

The LLM then generates an answer, grounded in the provided facts.

RAG Process Flow

Let's visualize the basic flow:

  1. User asks a question.
  2. Question is embedded (converted to a vector).
  3. Vector database finds relevant document chunks using similarity search.
  4. Retrieved chunks are added to the prompt as context.
  5. LLM generates an answer using the augmented prompt.
  6. LLM's answer is returned to the user.

This cycle ensures informed responses.

Benefits of Using RAG

RAG offers significant advantages for building reliable LLM applications:

  • Reduced Hallucinations: Answers are based on facts from your knowledge base.
  • Up-to-Date Information: Easily update your knowledge base without retraining the LLM.
  • Domain Specificity: Tailor LLM responses to your specific industry or internal data.
  • Transparency: Can often cite sources, increasing user trust.

Applying RAG Knowledge

Imagine you're building an LLM-powered chatbot for a company's internal HR knowledge base. Employees ask questions about policies that frequently change.

Which of the following problems would RAG primarily help solve for this chatbot?

RAG: Smarter, Factual LLMs

You've learned about Retrieval Augmented Generation (RAG), a vital technique for grounding LLMs in external knowledge.

  • RAG tackles LLM limitations like hallucinations and outdated information.
  • It involves two phases: Retrieval (finding relevant info) and Generation (LLM using that info).
  • Vector databases and embeddings are key for efficient retrieval.

RAG empowers LLMs to be more accurate, current, and trustworthy, making them practical for real-world applications. Keep exploring how to implement RAG in your projects!

คำถามที่พบบ่อย

บทเรียน “การสร้างเสริมด้วยการค้นคืน (RAG)” ฟรีหรือไม่

ใช่ — ข้อความเต็มของ “การสร้างเสริมด้วยการค้นคืน (RAG)” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Prompt Engineering & LLM Optimization for Developers ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Prompt Engineering & LLM Optimization for Developers มีบทเรียนทั้งหมด 4 บทเรียน

คุณจะเรียนรู้อะไรในบทเรียน “การสร้างเสริมด้วยการค้นคืน (RAG)”

ทำความเข้าใจและนำ RAG ไปใช้งานเพื่ออ้างอิงคำตอบของ LLM กับข้อมูลภายนอกที่เป็นปัจจุบัน เพิ่มความแม่นยำและลดการสร้างข้อมูลหลอน คุณปฏิบัติ Prompt Engineering & LLM Optimization for Developers ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน

คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Prompt Engineering & LLM Optimization for Developers หรือไม่

ไม่จำเป็นต้องมีประสบการณ์มาก่อน Prompt Engineering & LLM Optimization for Developers บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 1 จากทั้งหมด 4 บทเรียน

บทเรียน “การสร้างเสริมด้วยการค้นคืน (RAG)” ใช้เวลานานแค่ไหน

บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย

ฉันเขียนและรันโค้ดในบทเรียน Prompt Engineering & LLM Optimization for Developers นี้ได้ไหม

ได้ บทเรียน Prompt Engineering & LLM Optimization for Developers ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ

บทเรียนทั้งหมดในหลักสูตรนี้

  1. การสร้างเสริมด้วยการค้นคืน (RAG)
  2. การเรียกใช้ฟังก์ชันและการใช้เครื่องมือ
  3. การสร้างเอเจนต์ LLM อย่างง่าย
  4. การสตรีมคำตอบ LLM ไปยังผู้ใช้
← กลับไปที่ Prompt Engineering & LLM Optimization for Developers