LargeLanguageModel

LargeLanguageModel

ข่าวและบทความที่เกี่ยวข้อง

All LargeLanguageModel

PostType Filter En

บทความ

Self-RAG คืออะไร มาช่วยให้ LLMs ทำงานดีขึ้นได้อย่างไร
ทุกวันนี้ Large Language Models (LLMs) ถูกนำมาใช้กันอย่างแพร่หลายมากขึ้นในปัจจุบัน หลายคนถือว่า LLMs ถูกผนวกรวมเป็นส่วนหนึ่งของชีวิตและการทำงานของเราอย่างขาดไม่ได้ แต่อย่างไรก็ตาม การประยุกต์ใช้งาน LLMs ก็ยังพบปัญหาและอุปสรรคบางอย่างอยู่ เช่น ปัญหาของการสร้างคำตอบที่ไม่ถูกต้องขึ้นมา (Hallucination) หรือปัญหาของชุดความรู้ที่ไม่อัปเดต ทำให้มีคนที่พยายามคิดค้นและพัฒนากระบวนการที่จะมาช่วยแก้ปัญหาตรงจุดนี้ ซึ่งวิธีที่จะมาช่วยแก้ปัญหาดังกล่าว เรียกว่า Retrieval-Augmented Generation (RAG)  RAG คืออะไร  Retrieval-Augmented Generation (RAG) คือ เทคนิคที่จะมาช่วยแก้ปัญหาต่าง ๆ ที่เป็นข้อจำกัดของ LLMs ในปัจจุบัน เพื่อให้ LLMs มีความถูกต้องและความน่าเชื่อถือมากยิ่งขึ้น โดยมีกระบวนการในการผนวกชุดความรู้จากแหล่งข้อมูลภายนอก (External Source) มาใช้ประกอบในกระบวนการสร้างข้อความผลลัพธ์ ซึ่งการใช้ RAG จะช่วยเพิ่มความถูกต้องและความน่าเชื่อถือของผลลัพธ์ที่ได้จาก LLMs โดยเฉพาะงานที่ต้องใช้ความรู้ที่เฉพาะเจาะจงมาก ๆ รวมถึงยังมีข้อดีที่ทำให้ผลลัพธ์ของ LLMs สามารถตอบคำถามจากการอ้างอิงชุดความรู้ที่มีการอัปเดตให้เป็นปัจจุบันได้โดยไม่ต้องทำการฝึกฝนหรือ Fine-tuning LLMs ใหม่เรื่อย ๆ โดย RAG นั้นประกอบไปกระบวนหลัก 3 ขั้นตอน ได้แก่ 1.) การสืบค้นเนื้อหาที่เกี่ยวข้อง (Retrieve) 2.) การเพิ่มเนื้อหาเข้าไปใน Prompt (Augment) และ 3.) การสร้างข้อความผลลัพธ์ (Generate) ซึ่งมีรายละเอียดของกระบวนการดังต่อไปนี้  RAG Workflow  ข้อจำกัดของ RAG ทั่วไป  ถึงแม้การใช้ RAG ใน LLMs จะช่วยให้ผลลัพธ์ที่ได้มีความถูกต้องมากขึ้น โดยการดึงข้อมูลสนับสนุนที่เกี่ยวข้องมาเป็นบริบทเพิ่มเติมสำหรับสร้างคำตอบที่เฉพาะเจาะจงขึ้น แต่อย่างไรก็ตาม บางกรณีการดึงข้อมูลที่ไม่เกี่ยวข้องออกมาใช้ อาจจะด้วยเหตุผลที่ว่าในแหล่งข้อมูลภายนอกที่ใช้อ้างอิงไม่มีเนื้อหาที่เกี่ยวข้องอยู่เลย หรืออาจจะเป็นที่ อัลกอริทึมของการสืบค้น (Retrieve) ไม่ดีเพียงพอ สิ่งเหล่านี้ก็มีผลทำให้ผลลัพธ์ที่ได้จาก LLMs แทนที่จะดีขึ้นกลับแย่ลงกว่าเดิมก็เป็นได้ เนื่องจาก RAG อาจทำให้ไปลดความสามารถในการตอบคำถามแบบ general ที่มีอยู่เดิมของ LLMs ที่ใช้ ด้วยเหตุนี้ Self-RAG จึงถูกพัฒนาขึ้นมาเพื่อมาช่วยปรับปรุงคุณภาพและความถูกต้องของผลลัพธ์ที่ได้จาก LLMs และไม่ทำให้ความสามารถที่มีอยู่เดิมของ LLMs หายไป ผ่านแนวคิด On-demand Retrieval และ Self-reflection  Self-RAG  Self-RAG (Self-Reflective Retrieval-Augmented Generation) เป็น Framework เช่นเดียวกับ RAG ที่มีการเพิ่มส่วนของการพิจารณาไตร่ตรองผลลัพธ์ของตนเอง (Self-reflection) เพื่อตัดสินใจว่าจะทำการสืบค้นข้อมูลเพิ่มเติมหรือไม่ (On-demand Retrieval) หรือจะข้ามการสืบค้นและใช้ผลลัพธ์ที่ได้จาก LLMs เลย ด้วยวิธีการนี้จะช่วยปรับปรุงผลลัพธ์จาก LLMs ให้มีคุณภาพและตรงตามความเป็นจริงมากยิ่งขึ้น โดย LLMs ที่ประยุกต์ใช้วิธีการนี้จะถูกฝึกฝนให้มีการสร้าง special token ที่ชื่อว่า “Reflection Token” ซึ่งเป็นผลที่ได้จากการพิจารณาว่า ควรดำเนินการอย่างไรกับผลลัพธ์ที่สร้างมาจาก LLMs เพื่อให้สามารถควบคุม และปรับการทำงานให้เหมาะสมเพิ่มเติม ผ่านการพิจารณา Reflection Token ที่ได้  Reflection Token สามารถแบ่งได้เป็น 2 ประเภทหลัก ได้แก่ “Retrieval Token” และ “Critique Token” โดย Retrieval Token จะเป็น Token ที่แสดงความจำเป็นของการสืบค้น หรือการตัดสินใจว่าจะทำการสืบค้นหรือ Retrieve ข้อมูลมาใช้เป็นเนื้อหาเพิ่มเติมใน prompt หรือไม่ ส่วน Critique Token จะเป็น Token ที่แสดงผลการวิเคราะห์คุณภาพของข้อความที่ถูกสร้างขึ้นมา เช่น ดูเนื้อหาของข้อความผลลัพธ์ที่ได้จาก LLMs ว่ามีความเกี่ยวข้องกับคำถามมากน้อยขนาดไหน ซึ่ง Critique Token ประกอบไปด้วย Token ย่อย 3 กลุ่ม ได้แก่ IsREL, IsSup, IsUse Tokens ดังแสดงในตารางด้านล่าง  การทำงานของ Self-RAG แบ่งเป็น 3 ขั้นตอนหลัก ได้แก่ 1) ดึงข้อมูล (Retrieve) 2) สร้าง (Generate) และ 3) วิจารณ์ (Critique) โดยมีรายละเอียดแต่ละขั้นดังต่อไปนี้  ขั้นตอนที่ 1 Retrieve on demand  จากภาพจะเห็นว่า หลังจากที่เราให้ input prompt กับ LLM ซึ่งโดยปกติ LLM จะให้ผลลัพธ์ออกมาเป็นข้อความที่ตอบคำถามที่เราใส่เข้าไปเท่านั้น แต่ในครั้งนี้ LLM จะถูกฝึกฝนมาให้สามารถทำการสร้าง Reflection Token ต่อท้ายข้อความได้ ซึ่ง Reflection Token ในตัวอย่างด้านบนนี้จะเป็นประเภท Retrieval Token ซึ่งจะเป็น token ที่บอกว่าการ retrieve ข้อมูลเพื่อใช้เป็นเนื้อหามา support เพิ่มน่าจะมีประโยชน์หรือไม่ ซึ่งถ้า Retrieval Token มีค่าเป็น yes โมเดลสำหรับทำการสืบค้น (Retriever Model) จะถูกเรียกเพื่อไปทำการสืบค้นเนื้อหาที่เกี่ยวข้องในฐานข้อมูลเป็นลำดับถัดไป  ขั้นตอนที่ 2 Generate segment in parallel  หลังจากที่ Retriever Model ทำการสืบค้นเนื้อหาหรือข้อความที่มีความเกี่ยวข้องขึ้นมา k อันดับแรก (Top k) ข้อความเหล่านั้นจะถูกนำไปใช้ประกอบรวมเพื่อเป็นบริบท (Context) ให้กับ prompt ตั้งต้น แล้วใส่เป็น input ให้กับ LLM เพื่อสร้างข้อความผลลัพธ์ออกมา ซึ่งผลลัพธ์ที่ได้จาก LLM ในรอบนี้จะมี Critique Token กำกับมาเพิ่มด้วยดังภาพ โดยเป็นการวัดคุณภาพของเนื้อหาที่ถูกสร้างจาก input context ที่ต่างกัน เพื่อวัดความเกี่ยวข้องของคำตอบที่ได้และความครบถ้วนหรือความครอบคลุมของคำตอบที่ได้ จากตัวอย่างจะเห็นว่าการใช้ context หมายเลข 1 จะได้ผลลัพธ์ที่เกี่ยวข้องกับคำถาม และครอบคลุมคำถามมากที่สุด  ขั้นตอนที่ 3 Critique output and select best segment ...
26 March 2024

บทความ

LangChain: ตัวช่วยในการพัฒนาแอปพลิเคชันที่ขับเคลื่อนด้วย AI ทางภาษา
การพัฒนาแอปพลิเคชันจาก LLM นั้น ต้องพึ่งนักพัฒนาในหลากหลายแขนง ทำให้เกิดข้อจำกัดการทำงาน LangChain จะเข้ามาช่วยในส่วนนี้
7 February 2024
PDPA Icon

We use cookies to optimize your browsing experience and improve our website’s performance. Learn more at our Privacy Policy and adjust your cookie settings at Settings

Privacy Preferences

You can choose your cookie settings by turning on/off each type of cookie as needed, except for necessary cookies.

Accept all
Manage Consent Preferences
  • Strictly Necessary Cookies
    Always Active

    This type of cookie is essential for providing services on the website of the Personal Data Protection Committee Office, allowing you to access various parts of the site. It also helps remember information you have previously provided through the website. Disabling this type of cookie will result in your inability to use key services of the Personal Data Protection Committee Office that require cookies to function.
    Cookies Details

  • Performance Cookies

    This type of cookie helps the Big Data Institute (Public Organization) understand user interactions with its website services, including which pages or areas of the site are most popular, as well as analyze other related data. The Big Data Institute (Public Organization) also uses this information to improve website performance and gain a better understanding of user behavior. Although the data collected by these cookies is non-identifiable and used solely for statistical analysis, disabling them will prevent the Big Data Institute (Public Organization) from knowing the number of website visitors and from evaluating the quality of its services.

  • Functional Cookies

    This type of cookie enables the Big Data Institute (Public Organization)’s website to remember the choices you have made and deliver enhanced features and content tailored to your usage. For example, it can remember your username or changes you have made to font sizes or other customizable settings on the page. Disabling these cookies may result in the website not functioning properly.

  • Targeting Cookies

    "This type of cookie helps the Big Data Institute (Public Organization) understand user interactions with its website services, including which pages or areas of the site are most popular, as well as analyze other related data. The Big Data Institute (Public Organization) also uses this information to improve website performance and gain a better understanding of user behavior. Although the data collected by these cookies is non-identifiable and used solely for statistical analysis, disabling them will prevent the Big Data Institute (Public Organization) from knowing the number of website visitors and from evaluating the quality of its services.

Save settings
This site is registered on wpml.org as a development site. Switch to a production site key to remove this banner.