<!DOCTYPE html>
    <html lang="vi" xmlns="http://www.w3.org/1999/xhtml" prefix="og: http://ogp.me/ns#">
    <head>
<title>Hướng dẫn kỹ thuật lời nhắc. Kỹ thuật viết lời nhắc. Phản xạ</title>
<meta name="description" content="Hướng dẫn kỹ thuật lời nhắc. Kỹ thuật viết lời nhắc. Phản xạ - Savefile - Blogs -...">
<meta name="author" content="Blog FOSS by Lê Trung Nghĩa">
<meta name="copyright" content="Blog FOSS by Lê Trung Nghĩa [webmaster@vinades.vn]">
<meta name="generator" content="NukeViet v4.5">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta property="og:title" content="Hướng dẫn kỹ thuật lời nhắc. Kỹ thuật viết lời nhắc. Phản xạ">
<meta property="og:type" content="website">
<meta property="og:description" content="Savefile - Blogs - https&#x3A;&#x002F;&#x002F;letrungnghia.mangvn.org&#x002F;savefile&#x002F;Education&#x002F;huong-dan-ky-thuat-loi-nhac-ky-thuat-viet-loi-nhac-phan-xa-7807.html">
<meta property="og:site_name" content="Blog FOSS by Lê Trung Nghĩa">
<meta property="og:url" content="https://letrungnghia.mangvn.org/savefile/Education/huong-dan-ky-thuat-loi-nhac-ky-thuat-viet-loi-nhac-phan-xa-7807.html">
<link rel="shortcut icon" href="https://letrungnghia.mangvn.org/favicon.ico">
<link rel="canonical" href="https://letrungnghia.mangvn.org/savefile/Education/huong-dan-ky-thuat-loi-nhac-ky-thuat-viet-loi-nhac-phan-xa-7807.html">
<link rel="alternate" href="https://letrungnghia.mangvn.org/rss/" title="Blogs" type="application/rss+xml">
<link rel="alternate" href="https://letrungnghia.mangvn.org/rss/Government/" title="Blogs - Government" type="application/rss+xml">
<link rel="alternate" href="https://letrungnghia.mangvn.org/rss/Policy/" title="Blogs - Policy" type="application/rss+xml">
<link rel="alternate" href="https://letrungnghia.mangvn.org/rss/Philosophy/" title="Blogs - Philosophy" type="application/rss+xml">
<link rel="alternate" href="https://letrungnghia.mangvn.org/rss/Security/" title="Blogs - Security" type="application/rss+xml">
<link rel="alternate" href="https://letrungnghia.mangvn.org/rss/Legal/" title="Blogs - Legal" type="application/rss+xml">
<link rel="alternate" href="https://letrungnghia.mangvn.org/rss/Education/" title="Blogs - Education" type="application/rss+xml">
<link rel="alternate" href="https://letrungnghia.mangvn.org/rss/Business/" title="Blogs - Business" type="application/rss+xml">
<link rel="alternate" href="https://letrungnghia.mangvn.org/rss/Community/" title="Blogs - Community" type="application/rss+xml">
<link rel="alternate" href="https://letrungnghia.mangvn.org/rss/Interoperability/" title="Blogs - Interoperability" type="application/rss+xml">
<link rel="alternate" href="https://letrungnghia.mangvn.org/rss/Standards/" title="Blogs - Standards" type="application/rss+xml">
<link rel="alternate" href="https://letrungnghia.mangvn.org/rss/Author/" title="Blogs - Author" type="application/rss+xml">
<link rel="alternate" href="https://letrungnghia.mangvn.org/rss/Opinions/" title="Blogs - Opinions" type="application/rss+xml">
<link rel="alternate" href="https://letrungnghia.mangvn.org/rss/CC/" title="Blogs - CC" type="application/rss+xml">
<link rel="alternate" href="https://letrungnghia.mangvn.org/rss/Cloud/" title="Blogs - Cloud" type="application/rss+xml">
<link rel="alternate" href="https://letrungnghia.mangvn.org/rss/Hardware/" title="Blogs - Hardware" type="application/rss+xml">
<link rel="alternate" href="https://letrungnghia.mangvn.org/rss/Software/" title="Blogs - Software" type="application/rss+xml">
<link rel="alternate" href="https://letrungnghia.mangvn.org/rss/Statistics/" title="Blogs - Statistics" type="application/rss+xml">
<link rel="alternate" href="https://letrungnghia.mangvn.org/rss/Trends/" title="Blogs - Trends" type="application/rss+xml">
<link rel="alternate" href="https://letrungnghia.mangvn.org/rss/China/" title="Blogs - China" type="application/rss+xml">
<link rel="alternate" href="https://letrungnghia.mangvn.org/rss/OSs/" title="Blogs - OSs" type="application/rss+xml">
<link rel="alternate" href="https://letrungnghia.mangvn.org/rss/Blogs/" title="Blogs - Blogs" type="application/rss+xml">
<link rel="alternate" href="https://letrungnghia.mangvn.org/rss/Outsourcing/" title="Blogs - Outsourcing" type="application/rss+xml">
<link rel="alternate" href="https://letrungnghia.mangvn.org/rss/elearning/" title="Blogs - Elearning" type="application/rss+xml">
<link rel="preload" as="style" href="https://letrungnghia.mangvn.org/assets/css/font-awesome.min.css" type="text/css">
<link rel="preload" as="style" href="https://letrungnghia.mangvn.org/themes/default/css/bootstrap.non-responsive.css" type="text/css">
<link rel="preload" as="style" href="https://letrungnghia.mangvn.org/themes/default/css/style.css" type="text/css">
<link rel="preload" as="style" href="https://letrungnghia.mangvn.org/themes/default/css/style.non-responsive.css" type="text/css">
<link rel="preload" as="style" href="https://letrungnghia.mangvn.org/themes/default/css/news.css" type="text/css">
<link rel="preload" as="style" href="https://letrungnghia.mangvn.org/themes/default/css/custom.css" type="text/css">
<link rel="preload" as="style" href="https://letrungnghia.mangvn.org/assets/css/default.vi.1106.css" type="text/css">
<link rel="preload" as="script" href="https://letrungnghia.mangvn.org/assets/js/jquery/jquery.min.js" type="text/javascript">
<link rel="preload" as="script" href="https://letrungnghia.mangvn.org/assets/js/language/vi.js" type="text/javascript">
<link rel="preload" as="script" href="https://letrungnghia.mangvn.org/assets/js/DOMPurify/purify3.js" type="text/javascript">
<link rel="preload" as="script" href="https://letrungnghia.mangvn.org/assets/js/global.js" type="text/javascript">
<link rel="preload" as="script" href="https://letrungnghia.mangvn.org/assets/js/site.js" type="text/javascript">
<link rel="preload" as="script" href="https://letrungnghia.mangvn.org/themes/default/js/news.js" type="text/javascript">
<link rel="preload" as="script" href="https://letrungnghia.mangvn.org/themes/default/js/main.js" type="text/javascript">
<link rel="preload" as="script" href="https://letrungnghia.mangvn.org/themes/default/js/custom.js" type="text/javascript">
<link rel="preload" as="script" href="https://letrungnghia.mangvn.org/themes/default/js/bootstrap.min.js" type="text/javascript">
<link rel="stylesheet" href="https://letrungnghia.mangvn.org/assets/css/font-awesome.min.css">
<link rel="stylesheet" href="https://letrungnghia.mangvn.org/themes/default/css/bootstrap.non-responsive.css">
<link rel="stylesheet" href="https://letrungnghia.mangvn.org/themes/default/css/style.css">
<link rel="stylesheet" href="https://letrungnghia.mangvn.org/themes/default/css/style.non-responsive.css">
<link rel="StyleSheet" href="https://letrungnghia.mangvn.org/themes/default/css/news.css">
<link rel="stylesheet" href="https://letrungnghia.mangvn.org/themes/default/css/custom.css">
<link rel="stylesheet" href="https://letrungnghia.mangvn.org/assets/css/default.vi.1106.css">
<style type="text/css">
	body{background: #fff;}
</style>
<script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-70254229-3', '');
ga('send', 'pageview');
</script>
</head>
    <body>
<div id="print">
	<div id="hd_print">
		<h2 class="pull-left">Blog FOSS by Lê Trung Nghĩa</h2>
		<p class="pull-right"><a title="Blog FOSS by Lê Trung Nghĩa" href="https://letrungnghia.mangvn.org/">https://letrungnghia.mangvn.org</a></p>
	</div>
	<div class="clear"></div>
	<hr />
	<div id="content">
		<h1>Hướng dẫn kỹ thuật lời nhắc. Kỹ thuật viết lời nhắc. Phản xạ</h1>
		<ul class="list-inline">
			<li>Thứ ba - 18/11/2025 06:05</li>
			<li class="hidden-print txtrequired"><em class="fa fa-print">&nbsp;</em><a title="In ra" href="javascript:;" onclick="window.print()">In ra</a></li>
			<li class="hidden-print txtrequired"><em class="fa fa-power-off">&nbsp;</em><a title="Đóng cửa sổ này" href="javascript:;" onclick="window.close()">Đóng cửa sổ này</a></li>
		</ul>
		<div class="clear"></div>
		<div id="hometext">
		</div>
				<div class="imghome">
			<img alt="Hướng dẫn kỹ thuật lời nhắc. Kỹ thuật viết lời nhắc. Phản xạ" src="https://letrungnghia.mangvn.org/uploads/letrungnghia/news/2025/0_prompt-engineering.png" width="460" class="img-thumbnail" />
		</div>
		<div class="clear"></div>
		<div id="bodytext" class="clearfix">
			<p align="justify"><b><span style="background: rgb(255, 255, 0);">Reflexion</span></b></p>

<p align="justify">Theo: <a href="https://www.promptingguide.ai/techniques/reflexion">https://www.promptingguide.ai/techniques/reflexion</a></p>

<p align="justify">Phản xạ là một khuôn khổ để củng cố các tác nhân dựa trên ngôn ngữ thông qua phản hồi ngôn ngữ. Theo <a href="https://arxiv.org/pdf/2303.11366.pdf">Shinn và cộng sự (2023)</a>, &quot;Phản xạ là một mô hình mới cho việc củng cố &#039;bằng lời nói&#039;, tham số hóa chính sách thành mã hóa bộ nhớ của tác nhân kết hợp với các tham số LLM được lựa chọn.&quot;</p>

<p align="justify">Ở cấp độ cao, Phản xạ chuyển đổi phản hồi (dạng ngôn ngữ tự do hoặc dạng vô hướng) từ môi trường thành phản hồi ngôn ngữ, còn được gọi là <b>tự phản xạ</b> (<b>self-ref</b><b>lection</b>), được cung cấp làm bối cảnh cho tác nhân LLM trong hành động tiếp theo. Điều này giúp tác nhân học hỏi nhanh chóng và hiệu quả từ những sai lầm trước đó, dẫn đến cải thiện hiệu suất trong nhiều tác vụ nâng cao.</p>

<div class="image-center"><img alt="" height="549" src="https://giaoducmo.avnuc.vn/uploads/news/2025_11/2.16-reflexion_1.png" width="766" /></div>

<p align="justify">Như được minh họa trong hình ở trên, Reflexion gồm 3 mô hình riêng biệt:</p>

<ul>
	<li>
	<p align="justify"><b>Một Actor (Người hành động)</b>: Tạo văn bản và hành động dựa trên các quan sát trạng thái. Actor thực hiện một hành động trong môi trường và nhận được một quan sát, từ đó tạo ra một quỹ đạo. Chuỗi Tư duy - CoT (Chain-of-Thought) và ReAct được sử dụng làm mô hình Actor. Một thành phần bộ nhớ cũng được thêm vào để cung cấp thêm ngữ cảnh cho tác nhân.</p>
	</li>
	<li>
	<p align="justify"><b>Một Evaluator (Người </b><b>đánh giá</b><b>)</b>: Chấm điểm các kết quả đầu ra do Actor tạo ra. Cụ thể, nó lấy đầu vào là một quỹ đạo đã được tạo ra (còn được gọi là bộ nhớ ngắn hạn) và đưa ra điểm thưởng. Các hàm thưởng khác nhau được sử dụng tùy thuộc vào nhiệm vụ (LLM và phương pháp tìm kiếm dựa trên quy tắc được sử dụng cho các nhiệm vụ ra quyết định).</p>
	</li>
	<li>
	<p align="justify"><b>Tự phản ánh (Self-R</b><b>eflection)</b>: Tạo ra các tín hiệu củng cố bằng lời nói để hỗ trợ Actor trong việc tự cải thiện. Vai trò này được thực hiện bởi một LLM và cung cấp phản hồi có giá trị cho các thử nghiệm trong tương lai. Để tạo ra phản hồi cụ thể và có liên quan, điều cũng được lưu trữ trong bộ nhớ, mô hình tự phản ánh sử dụng tín hiệu thưởng, quỹ đạo hiện tại và bộ nhớ liên tục của nó. Những kinh nghiệm này (được lưu trữ trong bộ nhớ dài hạn) được tác nhân tận dụng để cải thiện nhanh chóng quá trình ra quyết định.</p>
	</li>
</ul>

<p align="justify">Tóm lại, các bước chính của quy trình Reflexion là a) xác định một nhiệm vụ, b) tạo một quỹ đạo, c) đánh giá, d) thực hiện phản ánh, và e) tạo quỹ đạo tiếp theo. Hình dưới đây minh họa các ví dụ về cách một tác nhân Reflexion có thể học cách tối ưu hóa hành vi của mình theo từng bước lặp để giải quyết các nhiệm vụ khác nhau như ra quyết định, lập trình và suy luận. Reflexion mở rộng khuôn khổ ReAct bằng cách giới thiệu các thành phần tự đánh giá, tự phản ánh và bộ nhớ.</p>

<div class="image-center"><img alt="" height="306" src="https://giaoducmo.avnuc.vn/uploads/news/2025_11/2.16-reflexion_2.png" width="766" /></div>

<p align="justify"><b>Kết quả </b></p>

<p align="justify" style="font-weight: normal">Kết quả thử nghiệm chứng minh rằng các tác nhân Reflexion cải thiện đáng kể hiệu suất trong các tác vụ ra quyết định AlfWorld, các câu hỏi suy luận trong HotPotQA và các tác vụ lập trình Python trên HumanEval.</p>

<p align="justify" style="font-weight: normal">Khi được đánh giá trên các tác vụ ra quyết định tuần tự (AlfWorld), ReAct + Reflexion vượt trội hơn đáng kể so với ReAct khi hoàn thành 130/134 tác vụ bằng các kỹ thuật tự đánh giá Heuristic và GPT để phân loại nhị phân.</p>

<div class="image-center"><img alt="" height="320" src="https://giaoducmo.avnuc.vn/uploads/news/2025_11/2.16-reflexion_3.png" width="766" /></div>

<p align="justify">Reflexion vượt trội hơn hẳn so với tất cả các phương pháp cơ bản qua nhiều bước học. Chỉ áp dụng cho suy luận và khi thêm bộ nhớ theo giai đoạn bao gồm quỹ đạo gần nhất, Reflexion + CoT vượt trội hơn so với việc chỉ áp dụng CoT và CoT kết hợp với bộ nhớ theo giai đoạn.</p>

<div class="image-center"><img alt="" height="205" src="https://giaoducmo.avnuc.vn/uploads/news/2025_11/2.16-reflexion_4.png" width="766" /></div>

<p align="justify">Như tóm tắt trong bảng dưới đây, Reflexion nhìn chung vượt trội hơn các phương pháp tiên tiến trước đây về viết mã Python và Rust trên MBPP, HumanEval và Leetcode Hard.</p>

<div class="image-center"><img alt="" height="159" src="https://giaoducmo.avnuc.vn/uploads/news/2025_11/2.16-reflexion_5.png" width="766" /></div>

<p align="justify"><b>Khi nào sử dụng Refl</b><b>exion?</b></p>

<p align="justify">Reflexion phù hợp nhất cho các trường hợp sau:</p>

<ol>
	<li>
	<p align="justify"><b>Tác nhân cần học hỏi từ quá trình thử và sai</b>: Reflexion được thiết kế để giúp tác nhân cải thiện hiệu suất bằng cách suy ngẫm về những sai lầm trong quá khứ và kết hợp kiến thức đó vào các quyết định trong tương lai. Điều này làm cho nó phù hợp với các nhiệm vụ mà tác nhân cần học hỏi thông qua quá trình thử và sai, chẳng hạn như ra quyết định, suy luận và lập trình.</p>
	</li>
	<li>
	<p align="justify" style="font-weight: normal"><b>Các phương pháp học tăng cường - RL (Reinforcement Learning) truyền thống không thực tế</b>: Các phương pháp học tăng cường (RL) truyền thống thường yêu cầu dữ liệu huấn luyện phong phú và tinh chỉnh mô hình tốn kém. Reflexion cung cấp một giải pháp thay thế nhẹ nhàng, không yêu cầu tinh chỉnh mô hình ngôn ngữ cơ bản, giúp nó hiệu quả hơn về mặt dữ liệu và tài nguyên tính toán.</p>
	</li>
	<li>
	<p align="justify"><b>Cần có phản hồi có sắc thái</b>: Reflexion sử dụng phản hồi bằng lời nói, có thể có sắc thái và cụ thể hơn so với phần thưởng vô hướng được sử dụng trong RL truyền thống. Điều này cho phép tác nhân hiểu rõ hơn về những sai lầm của mình và thực hiện các cải tiến có mục tiêu hơn trong các lần thử tiếp theo.</p>
	</li>
	<li>
	<p align="justify"><b>Khả năng diễn giải và trí nhớ rõ ràng rất quan trọng</b><span style="font-weight: normal">: Reflexion cung cấp một dạng trí nhớ theo giai đoạn dễ diễn giải và rõ ràng hơn so với các phương pháp RL truyền thống. Quá trình tự phản ánh của tác nhân được lưu trữ trong bộ nhớ, cho phép phân tích và hiểu rõ hơn về quá trình học tập của nó.</span></p>
	</li>
</ol>

<p align="justify">Reflexion hiệu quả trong các tác vụ sau:</p>

<ul>
	<li>
	<p align="justify"><b>Ra quyết định tuần tự</b>: Các tác nhân Reflexion cải thiện hiệu suất của chúng trong các tác vụ AlfWorld, bao gồm việc điều hướng qua nhiều môi trường khác nhau và hoàn thành các mục tiêu nhiều bước.</p>
	</li>
	<li>
	<p align="justify"><b>Suy luận</b>: Reflexion đã cải thiện hiệu suất của các tác nhân trên HotPotQA, một tập dữ liệu trả lời câu hỏi yêu cầu suy luận trên nhiều tài liệu.</p>
	</li>
	<li>
	<p align="justify"><b>Lập trình</b>: Các tác nhân Reflexion viết mã tốt hơn trên các điểm chuẩn như HumanEval và MBPP, đạt được kết quả tiên tiến trong một số trường hợp.</p>
	</li>
</ul>

<p align="justify">Dưới đây là một số hạn chế của Reflexion:</p>

<ul>
	<li>
	<p align="justify"><b>Dựa vào khả năng tự đánh giá</b>: Reflexion dựa vào khả năng của tác nhân trong việc đánh giá chính xác hiệu suất của nó và tạo ra các phản ánh tự phản ánh hữu ích. Điều này có thể là một thách thức, đặc biệt là đối với các tác vụ phức tạp, nhưng dự kiến Reflexion sẽ ngày càng tốt hơn theo thời gian khi các mô hình tiếp tục cải thiện khả năng.</p>
	</li>
	<li>
	<p align="justify"><b>Hạn chế về bộ nhớ dài hạn</b>: Reflexion sử dụng cửa sổ trượt với dung lượng tối đa, nhưng đối với các tác vụ phức tạp hơn, việc sử dụng các cấu trúc nâng cao như nhúng vector hoặc cơ sở dữ liệu SQL có thể mang lại lợi thế.</p>
	</li>
	<li>
	<p align="justify"><b>Hạn chế về tạo mã</b>: Phát triển hướng kiểm thử có những hạn chế trong việc chỉ định các ánh xạ đầu vào-đầu ra chính xác (ví dụ: hàm tạo không xác định và đầu ra hàm bị ảnh hưởng bởi phần cứng).</p>
	</li>
</ul>

<p align="justify">Nguồn hình ảnh: Reflexion: Tác nhân Ngôn ngữ với Học Tăng cường Bằng Lời</p>

<p align="justify"><b>Tài liệu tham khảo</b></p>

<ul>
	<li>
	<p align="justify"><a href="https://arxiv.org/pdf/2303.11366.pdf">Reflexion: Tác nhân Ngôn ngữ với Học Tăng cường Bằng Lời</a></p>
	</li>
	<li>
	<p align="justify"><a href="https://evjang.com/2023/03/26/self-reflection.html">Các Mô hình Ngôn ngữ lớn (LLM) có thể Phê bình và Lặp lại trên Đầu ra của Chính chúng không?</a></p>
	</li>
</ul>

<p align="justify" style="font-weight: normal"><span style="background: transparent"><em><span style="font-style: normal"><a href="https://giaoducmo.avnuc.vn/ai/huong-dan-ky-thuat-loi-nhac-ky-thuat-viet-loi-nhac-1577.html">Về ‘Kỹ thuật viết lời nhắc’</a> ………. <a href="https://giaoducmo.avnuc.vn/ai/huong-dan-ky-thuat-loi-nhac-ky-thuat-viet-loi-nhac-loi-nhac-tai-hanh-dong-react-1594.html">Phần trước</a> ………. Phần tiếp theo</span></em></span></p>

<p align="justify" style="font-weight: normal">&nbsp;</p>

<p align="justify"><span style="background: rgb(255, 255, 0);">Reflexion is a framework to reinforce language-based agents through linguistic feedback. According to <a href="https://arxiv.org/pdf/2303.11366.pdf" target="_blank">Shinn et al. (2023)</a>, &quot;Reflexion is a new paradigm for ‘verbal‘ reinforcement that parameterizes a policy as an agent’s memory encoding paired with a choice of LLM parameters.&quot;</span></p>

<p align="justify"><span style="background: rgb(255, 255, 0);">At a high level, Reflexion converts feedback (either free-form language or scalar) from the environment into linguistic feedback, also referred to as </span><strong><span style="background: rgb(255, 255, 0);">self-reflection</span></strong><span style="background: rgb(255, 255, 0);">, which is provided as context for an LLM agent in the next episode. This helps the agent rapidly and effectively learn from prior mistakes leading to performance improvements on many advanced tasks.</span></p>

<p align="justify"><span style="background: rgb(255, 255, 0);">As shown in the figure above, Reflexion consists of three distinct models:</span></p>

<ul>
	<li>
	<p align="justify"><strong><span style="background: rgb(255, 255, 0);">An Actor</span></strong><span style="background: rgb(255, 255, 0);">: Generates text and actions based on the state observations. The Actor takes an action in an environment and receives an observation which results in a trajectory. <a href="https://www.promptingguide.ai/techniques/cot" target="_blank">Chain-of-Thought (CoT)</a> and <a href="https://www.promptingguide.ai/techniques/react" target="_blank">ReAct</a> are used as Actor models. A memory component is also added to provide additional context to the agent. </span></p>
	</li>
</ul>

<ul>
	<li>
	<p align="justify" style="margin-bottom: 0cm"><strong><span style="background: rgb(255, 255, 0);">An Evaluator</span></strong><span style="background: rgb(255, 255, 0);">: Scores outputs produced by the Actor. Concretely, it takes as input a generated trajectory (also denoted as short-term memory) and outputs a reward score. Different reward functions are used depending on the task (LLMs and rule-based heuristics are used for decision-making tasks). </span></p>
	</li>
	<li>
	<p align="justify"><strong><span style="background: rgb(255, 255, 0);">Self-Reflection</span></strong><span style="background: rgb(255, 255, 0);">: Generates verbal reinforcement cues to assist the Actor in self-improvement. This role is achieved by an LLM and provides valuable feedback for future trials. To generate specific and relevant feedback, which is also stored in memory, the self-reflection model makes use of the reward signal, the current trajectory, and its persistent memory. These experiences (stored in long-term memory) are leveraged by the agent to rapidly improve decision-making. </span></p>
	</li>
</ul>

<p align="justify"><span style="background: rgb(255, 255, 0);">In summary, the key steps of the Reflexion process are a) define a task, b) generate a trajectory, c) evaluate, d) perform reflection, and e) generate the next trajectory. The figure below demonstrates examples of how a Reflexion agent can learn to iteratively optimize its behavior to solve various tasks such as decision-making, programming, and reasoning. Reflexion extends the ReAct framework by introducing self-evaluation, self-reflection and memory components.</span></p>

<p align="justify"><a name="results"></a><b><span style="background: rgb(255, 255, 0);">Results</span></b></p>

<p align="justify"><span style="background: rgb(255, 255, 0);">Experimental results demonstrate that Reflexion agents significantly improve performance on decision-making AlfWorld tasks, reasoning questions in HotPotQA, and Python programming tasks on HumanEval.</span></p>

<p align="justify"><span style="background: rgb(255, 255, 0);">When evaluated on sequential decision-making (AlfWorld) tasks, ReAct + Reflexion significantly outperforms ReAct by completing 130/134 tasks using self-evaluation techniques of Heuristic and GPT for binary classification.</span></p>

<p align="justify"><span style="background: rgb(255, 255, 0);">Reflexion significantly outperforms all baseline approaches over several learning steps. For reasoning only and when adding an episodic memory consisting of the most recent trajectory, Reflexion + CoT outperforms CoT only and CoT with episodic memory, respectively.</span></p>

<p align="justify"><span style="background: rgb(255, 255, 0);">As summarized in the table below, Reflexion generally outperforms the previous state-of-the-art approaches on Python and Rust code writing on MBPP, HumanEval, and Leetcode Hard.</span></p>

<p align="justify"><a name="when-to-use-reflexion"></a><b><span style="background: rgb(255, 255, 0);">When to Use Reflexion?</span></b></p>

<p align="justify"><span style="background: rgb(255, 255, 0);">Reflexion is best suited for the following:</span></p>

<ol>
	<li>
	<p align="justify"><strong><span style="background: rgb(255, 255, 0);">An agent needs to learn from trial and error</span></strong><span style="background: rgb(255, 255, 0);">: Reflexion is designed to help agents improve their performance by reflecting on past mistakes and incorporating that knowledge into future decisions. This makes it well-suited for tasks where the agent needs to learn through trial and error, such as decision-making, reasoning, and programming.</span></p>
	</li>
	<li>
	<p align="justify"><strong><span style="background: rgb(255, 255, 0);">Traditional reinforcement learning methods are impractical</span></strong><span style="background: rgb(255, 255, 0);">: Traditional reinforcement learning (RL) methods often require extensive training data and expensive model fine-tuning. Reflexion offers a lightweight alternative that doesn&#039;t require fine-tuning the underlying language model, making it more efficient in terms of data and compute resources.</span></p>
	</li>
	<li>
	<p align="justify"><strong><span style="background: rgb(255, 255, 0);">Nuanced feedback is required</span></strong><span style="background: rgb(255, 255, 0);">: Reflexion utilizes verbal feedback, which can be more nuanced and specific than scalar rewards used in traditional RL. This allows the agent to better understand its mistakes and make more targeted improvements in subsequent trials.</span></p>
	</li>
	<li>
	<p align="justify"><strong><span style="background: rgb(255, 255, 0);">Interpretability and explicit memory are important</span></strong><span style="background: rgb(255, 255, 0);">: Reflexion provides a more interpretable and explicit form of episodic memory compared to traditional RL methods. The agent&#039;s self-reflections are stored in its memory, allowing for easier analysis and understanding of its learning process.</span></p>
	</li>
</ol>

<p align="justify"><span style="background: rgb(255, 255, 0);">Reflexion is effective in the following tasks:</span></p>

<ul>
	<li>
	<p align="justify"><strong><span style="background: rgb(255, 255, 0);">Sequential decision-making</span></strong><span style="background: rgb(255, 255, 0);">: Reflexion agents improve their performance in AlfWorld tasks, which involve navigating through various environments and completing multi-step objectives. </span></p>
	</li>
	<li>
	<p align="justify"><strong><span style="background: rgb(255, 255, 0);">Reasoning</span></strong><span style="background: rgb(255, 255, 0);">: Reflexion improved the performance of agents on HotPotQA, a question-answering dataset that requires reasoning over multiple documents. </span></p>
	</li>
	<li>
	<p align="justify"><strong><span style="background: rgb(255, 255, 0);">Programming</span></strong><span style="background: rgb(255, 255, 0);">: Reflexion agents write better code on benchmarks like HumanEval and MBPP, achieving state-of-the-art results in some cases. </span></p>
	</li>
</ul>

<p align="justify"><span style="background: rgb(255, 255, 0);">Here are some limitations of Reflexion:</span></p>

<ul>
	<li>
	<p align="justify"><strong><span style="background: rgb(255, 255, 0);">Reliance on self-evaluation capabilities</span></strong><span style="background: rgb(255, 255, 0);">: Reflexion relies on the agent&#039;s ability to accurately evaluate its performance and generate useful self-reflections. This can be challenging, especially for complex tasks but it&#039;s expected that Reflexion gets better over time as models keep improving in capabilities. </span></p>
	</li>
	<li>
	<p align="justify"><strong><span style="background: rgb(255, 255, 0);">Long-term memory constraints</span></strong><span style="background: rgb(255, 255, 0);">: Reflexion makes use of a sliding window with maximum capacity but for more complex tasks it may be advantageous to use advanced structures such as vector embedding or SQL databases. </span></p>
	</li>
	<li>
	<p align="justify"><strong><span style="background: rgb(255, 255, 0);">Code generation limitations</span></strong><span style="background: rgb(255, 255, 0);">: There are limitations to test-driven development in specifying accurate input-output mappings (e.g., non-deterministic generator function and function outputs influenced by hardware). </span></p>
	</li>
</ul>

<p align="justify"><em><span style="background: rgb(255, 255, 0);">Figures source: <a href="https://arxiv.org/pdf/2303.11366.pdf" target="_blank">Reflexion: Language Agents with Verbal Reinforcement Learning</a></span></em></p>

<p align="justify"><a name="references"></a><b><span style="background: rgb(255, 255, 0);">References</span></b></p>

<ul>
	<li>
	<p align="justify"><a href="https://arxiv.org/pdf/2303.11366.pdf" target="_blank"><span style="background: rgb(255, 255, 0);">Reflexion: Language Agents with Verbal Reinforcement Learning</span></a></p>
	</li>
	<li>
	<p align="justify"><a href="https://evjang.com/2023/03/26/self-reflection.html" target="_blank"><span style="background: rgb(255, 255, 0);">Can LLMs Critique and Iterate on Their Own Outputs?</span></a></p>
	</li>
</ul>

<p align="justify">Dịch: Lê Trung Nghĩa</p>

<p align="justify">letrungnghia.foss@gmail.com</p>
		</div>
				<div id="author">
						<p>
				<strong>Tác giả:</strong>
				<a href="https://letrungnghia.mangvn.org/author/Nghia-Le-Trung/">Nghĩa Lê Trung</a>
			</p>
		</div>
	</div>
	<div id="footer" class="clearfix">
		<div id="url">
			<strong>URL của bản tin này: </strong><a href="https://letrungnghia.mangvn.org/savefile/Education/huong-dan-ky-thuat-loi-nhac-ky-thuat-viet-loi-nhac-phan-xa-7807.html" title="Hướng dẫn kỹ thuật lời nhắc. Kỹ thuật viết lời nhắc. Phản xạ">https://letrungnghia.mangvn.org/savefile/Education/huong-dan-ky-thuat-loi-nhac-ky-thuat-viet-loi-nhac-phan-xa-7807.html</a>

		</div>
		<div class="clear"></div>
		<div class="copyright">
			&copy; Blog FOSS by Lê Trung Nghĩa
		</div>
		<div id="contact">
			<a href="mailto:webmaster@vinades.vn">webmaster@vinades.vn</a>
		</div>
	</div>
</div>
        <div id="timeoutsess" class="chromeframe">
            Bạn đã không sử dụng Site, <a onclick="timeoutsesscancel();" href="https://letrungnghia.mangvn.org/#">Bấm vào đây để duy trì trạng thái đăng nhập</a>. Thời gian chờ: <span id="secField"> 60 </span> giây
        </div>
        <div id="openidResult" class="nv-alert" style="display:none"></div>
        <div id="openidBt" data-result="" data-redirect=""></div>
<div id="run_cronjobs" style="visibility:hidden;display:none;"><img alt="cron" src="/index.php?second=cronjobs&amp;p=d72pvNhI" width="1" height="1" /></div>
<script src="https://letrungnghia.mangvn.org/assets/js/jquery/jquery.min.js"></script>
<script>var nv_base_siteurl="/",nv_lang_data="vi",nv_lang_interface="vi",nv_name_variable="nv",nv_fc_variable="op",nv_lang_variable="language",nv_module_name="news",nv_func_name="savefile",nv_is_user=0, nv_my_ofs=7,nv_my_abbr="+07",nv_cookie_prefix="nv4c_Cgoz2",nv_check_pass_mstime=1738000,nv_area_admin=0,nv_safemode=0,theme_responsive=0,nv_recaptcha_ver=2,nv_recaptcha_sitekey="6LcNwC8UAAAAAMm8ZTYNygweLUQtOU0IapbDRk69",nv_recaptcha_type="image",XSSsanitize=1;</script>
<script src="https://letrungnghia.mangvn.org/assets/js/language/vi.js"></script>
<script src="https://letrungnghia.mangvn.org/assets/js/DOMPurify/purify3.js"></script>
<script src="https://letrungnghia.mangvn.org/assets/js/global.js"></script>
<script src="https://letrungnghia.mangvn.org/assets/js/site.js"></script>
<script src="https://letrungnghia.mangvn.org/themes/default/js/news.js"></script>
<script src="https://letrungnghia.mangvn.org/themes/default/js/main.js"></script>
<script src="https://letrungnghia.mangvn.org/themes/default/js/custom.js"></script>
<script type="application/ld+json">
        {
            "@context": "https://schema.org",
            "@type": "Organization",
            "url": "https://letrungnghia.mangvn.org",
            "logo": "https://letrungnghia.mangvn.org/uploads/letrungnghia/le-trung-nghia.png"
        }
        </script>
<script src="https://letrungnghia.mangvn.org/themes/default/js/bootstrap.min.js"></script>
</body>
</html>