<!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. Giới thiệu. Thiết lập LLM</title>
<meta name="description" content="Hướng dẫn kỹ thuật lời nhắc. Giới thiệu. Thiết lập LLM - 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. Giới thiệu. Thiết lập LLM">
<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-gioi-thieu-thiet-lap-llm-7784.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-gioi-thieu-thiet-lap-llm-7784.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-gioi-thieu-thiet-lap-llm-7784.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. Giới thiệu. Thiết lập LLM</h1>
		<ul class="list-inline">
			<li>Thứ tư - 22/10/2025 06:28</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. Giới thiệu. Thiết lập LLM" 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);">LLM Settings</span></b></p>

<p align="justify" style="font-weight: normal">Theo: <a href="https://www.promptingguide.ai/introduction/settings">https://www.promptingguide.ai/introduction/settings</a></p>

<div class="image-center"><img alt="" height="391" src="https://letrungnghia.mangvn.org/uploads/letrungnghia/news/2025/1.1-llm-settings.png" width="689" /></div>

<p align="justify">Video: <a href="https://www.youtube.com/watch?v=CB0H7esOl68&amp;t=5s">Hiểu các thiết lập LLM</a></p>

<p align="justify">Khi thiết kế và kiểm thử lời nhắc, bạn thường tương tác với LLM thông qua API. Bạn có thể cấu hình một vài tham số để có được các kết quả khác nhau cho lời nhắc của mình. Việc tinh chỉnh các thiết lập này rất quan trọng để cải thiện độ tin cậy và tính mong muốn của phản hồi, và cần một chút thử nghiệm để tìm ra thiết lập phù hợp cho các trường hợp sử dụng của bạn. Dưới đây là các cài đặt phổ biến bạn sẽ gặp phải khi sử dụng các nhà cung cấp LLM khác nhau:</p>

<p align="justify"><b>Nhiệt độ (Temperature)</b> - Tóm lại, nhiệt độ càng thấp, kết quả càng mang tính xác định theo nghĩa là mã thông báo (token) tiếp theo có xác suất cao nhất luôn được chọn. Nhiệt độ tăng có thể dẫn đến tính ngẫu nhiên cao hơn, khuyến khích các đầu ra đa dạng hoặc sáng tạo hơn. Về cơ bản, bạn đang tăng trọng số của các mã thông báo khả thi khác. Về mặt ứng dụng, bạn có thể muốn sử dụng giá trị nhiệt độ thấp hơn cho các tác vụ như QA (Hỏi Đáp) dựa trên dữ kiện để khuyến khích các phản hồi thực tế và ngắn gọn hơn. Đối với việc tạo thơ hoặc các tác vụ sáng tạo khác, việc tăng giá trị nhiệt độ có thể mang lại lợi ích.</p>

<p align="justify"><b>Top P</b> - Một kỹ thuật lấy mẫu với nhiệt độ, được gọi là lấy mẫu hạt nhân, cho phép bạn kiểm soát mức độ xác định của mô hình. Nếu bạn đang tìm kiếm các câu trả lời chính xác và thực tế, hãy giữ giá trị này ở mức thấp. Nếu bạn đang tìm kiếm các phản hồi đa dạng hơn, hãy tăng lên giá trị cao hơn. Nếu bạn sử dụng Top P, điều đó có nghĩa là chỉ các mã thông báo tạo nên khối lượng xác suất top_p mới được xem xét cho các phản hồi, do đó, giá trị top_p thấp sẽ chọn các phản hồi chắc chắn nhất. Điều này có nghĩa là giá trị top_p cao sẽ cho phép mô hình xem xét nhiều từ khả thi hơn, bao gồm cả những từ ít khả thi hơn, dẫn đến kết quả đầu ra đa dạng hơn.</p>

<p align="justify">Khuyến nghị chung là thay đổi giá trị temperature hoặc Top P nhưng không được thay đổi cả hai.</p>

<p align="justify"><b>Độ dài Tối đa (Max Length)</b> - Bạn có thể quản lý số lượng mã thông báo (token) mà mô hình tạo ra bằng cách điều chỉnh độ dài tối đa. Việc chỉ định độ dài tối đa giúp bạn tránh các phản hồi dài hoặc không liên quan và kiểm soát chi phí.</p>

<p align="justify"><b>Chuỗi Dừng </b><b>(Stop Sequences)</b> - Chuỗi dừng là một chuỗi dừng mô hình tạo ra các mã thông báo (token). Chỉ định chuỗi dừng là một cách khác để kiểm soát độ dài và cấu trúc phản hồi của mô hình. Ví dụ, bạn có thể yêu cầu mô hình tạo danh sách có không quá 10 mục bằng cách thêm &quot;11&quot; làm chuỗi dừng.</p>

<p align="justify"><b>Hình phạt Tần suất </b><b>(Frequency Penalty)</b> - Hình phạt tần suất áp dụng hình phạt cho mã thông báo tiếp theo tỷ lệ thuận với số lần mã thông báo đó đã xuất hiện trong phản hồi và lời nhắc. Hình phạt tần suất càng cao, khả năng một từ xuất hiện lại càng thấp. Thiết lập này làm giảm sự lặp lại của các từ trong phản hồi của mô hình bằng cách áp dụng hình phạt cao hơn cho các mã thông báo xuất hiện nhiều hơn.</p>

<p align="justify"><b>Hình phạt Hiện diện </b><b>(Presence Penalty)</b> - Hình phạt hiện diện cũng áp dụng hình phạt cho các mã thông báo lặp lại, nhưng không giống như hình phạt tần suất, hình phạt này giống nhau cho tất cả các mã thông báo lặp lại. Mã thông báo xuất hiện hai lần và mã thông báo xuất hiện 10 lần đều bị phạt như nhau. Thiết lập này ngăn mô hình lặp lại các cụm từ quá thường xuyên trong phản hồi của nó. Nếu bạn muốn mô hình tạo ra văn bản đa dạng hoặc sáng tạo, bạn có thể muốn sử dụng hình phạt hiện diện cao hơn. Hoặc, nếu bạn cần mô hình duy trì sự tập trung, hãy thử sử dụng hình phạt hiện diện thấp hơn.</p>

<p align="justify">Tương tự như <i>temperature</i> và <i>top_p</i>, khuyến nghị chung là thay đổi hình phạt tần suất hoặc hình phạt hiện diện nhưng không phải cả hai.</p>

<p align="justify">Trước khi bắt đầu với một số ví dụ cơ bản, hãy lưu ý rằng kết quả của bạn có thể khác nhau tùy thuộc vào phiên bản LLM bạn sử dụng.</p>

<p align="justify"><a href="https://giaoducmo.avnuc.vn/ai/huong-dan-ky-thuat-loi-nhac-gioi-thieu-1570.html">Về phần ‘Giới thiệu’</a> ………. Phần tiếp theo</p>

<p align="justify"><span style="background: rgb(255, 255, 0);">Video: <a href="https://www.youtube.com/watch?v=CB0H7esOl68&amp;t=5s">Understanding LLM Settings</a></span></p>

<p align="justify"><span style="background: rgb(255, 255, 0);">When designing and testing prompts, you typically interact with the LLM via an API. You can configure a few parameters to get different results for your prompts. Tweaking these settings are important to improve reliability and desirability of responses and it takes a bit of experimentation to figure out the proper settings for your use cases. Below are the common settings you will come across when using different LLM providers:</span></p>

<p align="justify"><strong><span style="background: rgb(255, 255, 0);">Temperature</span></strong><span style="background: rgb(255, 255, 0);"> - In short, the lower the </span><code class="western"><span style="background: rgb(255, 255, 0);">temperature</span></code><span style="background: rgb(255, 255, 0);">, the more deterministic the results in the sense that the highest probable next token is always picked. Increasing temperature could lead to more randomness, which encourages more diverse or creative outputs. You are essentially increasing the weights of the other possible tokens. In terms of application, you might want to use a lower temperature value for tasks like fact-based QA to encourage more factual and concise responses. For poem generation or other creative tasks, it might be beneficial to increase the temperature value.</span></p>

<p align="justify"><strong><span style="background: rgb(255, 255, 0);">Top P</span></strong><span style="background: rgb(255, 255, 0);"> - A sampling technique with temperature, called nucleus sampling, where you can control how deterministic the model is. If you are looking for exact and factual answers keep this low. If you are looking for more diverse responses, increase to a higher value. If you use Top P it means that only the tokens comprising the </span><code class="western"><span style="background: rgb(255, 255, 0);">top_p</span></code><span style="background: rgb(255, 255, 0);"> probability mass are considered for responses, so a low </span><code class="western"><span style="background: rgb(255, 255, 0);">top_p</span></code><span style="background: rgb(255, 255, 0);"> value selects the most confident responses. This means that a high </span><code class="western"><span style="background: rgb(255, 255, 0);">top_p</span></code><span style="background: rgb(255, 255, 0);"> value will enable the model to look at more possible words, including less likely ones, leading to more diverse outputs.</span></p>

<p align="justify"><span style="background: rgb(255, 255, 0);">The general recommendation is to alter temperature or Top P but not both.</span></p>

<p align="justify"><strong><span style="background: rgb(255, 255, 0);">Max Length</span></strong><span style="background: rgb(255, 255, 0);"> - You can manage the number of tokens the model generates by adjusting the </span><code class="western"><span style="background: rgb(255, 255, 0);">max length</span></code><span style="background: rgb(255, 255, 0);">. Specifying a max length helps you prevent long or irrelevant responses and control costs.</span></p>

<p align="justify"><strong><span style="background: rgb(255, 255, 0);">Stop Sequences</span></strong><span style="background: rgb(255, 255, 0);"> - A </span><code class="western"><span style="background: rgb(255, 255, 0);">stop sequence</span></code><span style="background: rgb(255, 255, 0);"> is a string that stops the model from generating tokens. Specifying stop sequences is another way to control the length and structure of the model&#039;s response. For example, you can tell the model to generate lists that have no more than 10 items by adding &quot;11&quot; as a stop sequence.</span></p>

<p align="justify"><strong><span style="background: rgb(255, 255, 0);">Frequency Penalty</span></strong><span style="background: rgb(255, 255, 0);"> - The </span><code class="western"><span style="background: rgb(255, 255, 0);">frequency penalty</span></code><span style="background: rgb(255, 255, 0);"> applies a penalty on the next token proportional to how many times that token already appeared in the response and prompt. The higher the frequency penalty, the less likely a word will appear again. This setting reduces the repetition of words in the model&#039;s response by giving tokens that appear more a higher penalty.</span></p>

<p align="justify"><strong><span style="background: rgb(255, 255, 0);">Presence Penalty</span></strong><span style="background: rgb(255, 255, 0);"> - The </span><code class="western"><span style="background: rgb(255, 255, 0);">presence penalty</span></code><span style="background: rgb(255, 255, 0);"> also applies a penalty on repeated tokens but, unlike the frequency penalty, the penalty is the same for all repeated tokens. A token that appears twice and a token that appears 10 times are penalized the same. This setting prevents the model from repeating phrases too often in its response. If you want the model to generate diverse or creative text, you might want to use a higher presence penalty. Or, if you need the model to stay focused, try using a lower presence penalty.</span></p>

<p align="justify"><span style="background: rgb(255, 255, 0);">Similar to </span><code class="western"><span style="background: rgb(255, 255, 0);">temperature</span></code><span style="background: rgb(255, 255, 0);"> and </span><code class="western"><span style="background: rgb(255, 255, 0);">top_p</span></code><span style="background: rgb(255, 255, 0);">, the general recommendation is to alter the frequency or presence penalty but not both.</span></p>

<p align="justify"><span style="background: rgb(255, 255, 0);">Before starting with some basic examples, keep in mind that your results may vary depending on the version of LLM you use.</span></p>

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

<p align="justify">letrungnghia.foss@gmail.com</p>
&nbsp;
		</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-gioi-thieu-thiet-lap-llm-7784.html" title="Hướng dẫn kỹ thuật lời nhắc. Giới thiệu. Thiết lập LLM">https://letrungnghia.mangvn.org/savefile/Education/huong-dan-ky-thuat-loi-nhac-gioi-thieu-thiet-lap-llm-7784.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>
<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>