{"id":275,"date":"2024-03-12T18:17:36","date_gmt":"2024-03-12T18:17:36","guid":{"rendered":"https:\/\/sanjayk7r.com\/?p=275"},"modified":"2024-03-12T21:15:38","modified_gmt":"2024-03-12T21:15:38","slug":"how-llms-can-get-better-with-self-reflection","status":"publish","type":"post","link":"https:\/\/sanjayk7r.com\/index.php\/2024\/03\/12\/how-llms-can-get-better-with-self-reflection\/","title":{"rendered":"How LLMs can get better with Self Reflection"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"585\" height=\"585\" src=\"https:\/\/sanjayk7r.com\/wp-content\/uploads\/2024\/03\/DALL\u00b7E-2024-03-12-08.32.40-A-whimsical-self-reflective-llama-in-a-scene-inspired-by-the-movie-The-Grand-Budapest-Hotel.-The-llama-elegantly-dressed-in-a-bellhops-uniform-s-edited.webp\" alt=\"\" class=\"wp-image-279\" srcset=\"https:\/\/sanjayk7r.com\/wp-content\/uploads\/2024\/03\/DALL\u00b7E-2024-03-12-08.32.40-A-whimsical-self-reflective-llama-in-a-scene-inspired-by-the-movie-The-Grand-Budapest-Hotel.-The-llama-elegantly-dressed-in-a-bellhops-uniform-s-edited.webp 585w, https:\/\/sanjayk7r.com\/wp-content\/uploads\/2024\/03\/DALL\u00b7E-2024-03-12-08.32.40-A-whimsical-self-reflective-llama-in-a-scene-inspired-by-the-movie-The-Grand-Budapest-Hotel.-The-llama-elegantly-dressed-in-a-bellhops-uniform-s-edited-300x300.webp 300w, https:\/\/sanjayk7r.com\/wp-content\/uploads\/2024\/03\/DALL\u00b7E-2024-03-12-08.32.40-A-whimsical-self-reflective-llama-in-a-scene-inspired-by-the-movie-The-Grand-Budapest-Hotel.-The-llama-elegantly-dressed-in-a-bellhops-uniform-s-edited-150x150.webp 150w\" sizes=\"(max-width: 585px) 100vw, 585px\" \/><\/figure>\n\n\n\n<p>SELF-RAG is a method that can make your LLMs more accurate by using self reflection. You can read all about it in this white-paper \ud83d\udc49 <a href=\"https:\/\/arxiv.org\/abs\/2310.11511\" target=\"_blank\" rel=\"noopener\" title=\"\">Self-RAG: Learning to Retrieve, Generate, and Critique through Self-Reflection<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">TL;DR<\/h3>\n\n\n\n<p>The paper addresses the challenge of factual inaccuracies in large language models (LLMs) due to their reliance solely on parametric knowledge. Current Retrieval-Augmented Generation (RAG) methods aid in reducing factual errors but have limitations, such as indiscriminate retrieval of passages and inconsistency in output relevance.<\/p>\n\n\n\n<p> Self-Reflective Retrieval-Augmented Generation (SELF-RAG) enhances LLMs by adaptively retrieving passages and using self-reflection to assess quality of its response. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"537\" src=\"https:\/\/sanjayk7r.com\/wp-content\/uploads\/2024\/03\/image-2-1024x537.png\" alt=\"https:\/\/selfrag.github.io\/\" class=\"wp-image-280\" srcset=\"https:\/\/sanjayk7r.com\/wp-content\/uploads\/2024\/03\/image-2-1024x537.png 1024w, https:\/\/sanjayk7r.com\/wp-content\/uploads\/2024\/03\/image-2-300x157.png 300w, https:\/\/sanjayk7r.com\/wp-content\/uploads\/2024\/03\/image-2-768x402.png 768w, https:\/\/sanjayk7r.com\/wp-content\/uploads\/2024\/03\/image-2.png 1124w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">image source: https:\/\/selfrag.github.io\/<\/figcaption><\/figure>\n\n\n\n<p>In regular RAG, we retrieve documents regardless if they are necessary or not, in SELF-RAG it is more &#8216;on-demand&#8217; retrieval. <\/p>\n\n\n\n<p>In simple words, lets imagine a sentence is being generated, here is what the framework does:<\/p>\n\n\n\n<p>a. Retrieval &#8211; SELF-RAG evaluates if further generation of text will benefit from retrieval, and if so, generates retrieval tokens and processes retrieved content in parallel.<\/p>\n\n\n\n<p>b. Generate &#8211; If retrieval was necessary, the model will generate critique tokens that indicate if the retrieved documents are relevant. If retrieval was not necessary then it will proceed like a normal LLM.<\/p>\n\n\n\n<p>c. Critique &#8211; If retrieval was needed, the model evaluates if the retrieved passages support generation and the overall response.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h5 class=\"wp-block-heading\">EVALUATION<\/h5>\n\n\n\n<p>According to the paper, the SELF-RAG approach demonstrates a significant improvement in performance.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Experiments show that SELFRAG (7B and 13B parameters) significantly outperforms state-of-the-art LLMs and retrieval-augmented models on a diverse set of tasks. Specifically, SELF-RAG outperforms ChatGPT and retrieval-augmented Llama2-chat on Open-domain QA, reasoning and fact verification tasks&#8230;<\/p>\n<cite>https:\/\/arxiv.org\/abs\/2310.11511<\/cite><\/blockquote>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udc50<\/h2>\n\n\n\n<p>This summary just scratches the surface of SELF-RAG&#8217;s potential. Fancy a deep dive, here is the <a href=\"https:\/\/selfrag.github.io\/\" target=\"_blank\" rel=\"noopener\" title=\"Github repo\">Github repo<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>SELF-RAG is a method that can make your LLMs more accurate by using self reflection. You can read all about it in this white-paper \ud83d\udc49 Self-RAG: Learning to Retrieve, Generate, and Critique through Self-Reflection TL;DR The paper addresses the challenge of factual inaccuracies in large language models (LLMs) due to their reliance solely on parametric [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":279,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/sanjayk7r.com\/index.php\/wp-json\/wp\/v2\/posts\/275"}],"collection":[{"href":"https:\/\/sanjayk7r.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sanjayk7r.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sanjayk7r.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sanjayk7r.com\/index.php\/wp-json\/wp\/v2\/comments?post=275"}],"version-history":[{"count":6,"href":"https:\/\/sanjayk7r.com\/index.php\/wp-json\/wp\/v2\/posts\/275\/revisions"}],"predecessor-version":[{"id":285,"href":"https:\/\/sanjayk7r.com\/index.php\/wp-json\/wp\/v2\/posts\/275\/revisions\/285"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sanjayk7r.com\/index.php\/wp-json\/wp\/v2\/media\/279"}],"wp:attachment":[{"href":"https:\/\/sanjayk7r.com\/index.php\/wp-json\/wp\/v2\/media?parent=275"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sanjayk7r.com\/index.php\/wp-json\/wp\/v2\/categories?post=275"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sanjayk7r.com\/index.php\/wp-json\/wp\/v2\/tags?post=275"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}