{"id":38130,"date":"2025-02-10T19:00:53","date_gmt":"2025-02-10T11:00:53","guid":{"rendered":"https:\/\/17aitech.com\/?p=38130"},"modified":"2025-02-10T19:00:53","modified_gmt":"2025-02-10T11:00:53","slug":"deepseek%e7%94%a8%e7%9a%84grpo%e5%8d%a0%e7%94%a8%e5%a4%a7%e9%87%8f%e5%86%85%e5%ad%98%ef%bc%9f%e6%9c%89%e4%ba%ba%e7%bb%99%e5%87%ba%e4%ba%86%e4%ba%9b%e7%a0%b4%e8%a7%a3%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/17aitech.com\/?p=38130","title":{"rendered":"DeepSeek\u7528\u7684GRPO\u5360\u7528\u5927\u91cf\u5185\u5b58\uff1f\u6709\u4eba\u7ed9\u51fa\u4e86\u4e9b\u7834\u89e3\u65b9\u6cd5"},"content":{"rendered":"<p>\u6587\u7ae0\u6765\u6e90\u4e8e\u4e92\u8054\u7f51:<a href=\"https:\/\/www.jiqizhixin.com\/articles\/2025-02-07-7\" target=\"_blank\">DeepSeek\u7528\u7684GRPO\u5360\u7528\u5927\u91cf\u5185\u5b58\uff1f\u6709\u4eba\u7ed9\u51fa\u4e86\u4e9b\u7834\u89e3\u65b9\u6cd5<\/a><\/p>\n<blockquote data-author-name=\"\" data-content-utf8-length=\"53\" data-source-title=\"\" data-type=\"2\" data-url=\"\">\n<section>\n<p>RTX 3080 \u79fb\u52a8\u7248\u80fd\u8bad\u7ec3\u54ea\u79cd\u5927\u6a21\u578b\uff1f\u672c\u6587\u4e3a\u90a3\u4e9b GPU \u8d44\u6e90\u6709\u9650\u65f6\u4f7f\u7528 GRPO \u8bad\u7ec3\u7684\u5f00\u53d1\u8005\u63d0\u4f9b\u4e86\u5b9d\u8d35\u7684\u6307\u5bfc\u3002<\/p>\n<\/section>\n<\/blockquote>\n<section><\/section>\n<section>\u81ea DeepSeek-R1 \u53d1\u5e03\u4ee5\u6765\uff0c\u7fa4\u7ec4\u76f8\u5bf9\u7b56\u7565\u4f18\u5316\uff08GRPO\uff09\u56e0\u5176\u6709\u6548\u6027\u548c\u6613\u4e8e\u8bad\u7ec3\u800c\u6210\u4e3a\u5927\u578b\u8bed\u8a00\u6a21\u578b\u5f3a\u5316\u5b66\u4e60\u7684\u70ed\u95e8\u8bdd\u9898\u3002R1 \u8bba\u6587\u5c55\u793a\u4e86\u5982\u4f55\u4f7f\u7528 GRPO \u4ece\u9075\u5faa LLM\uff08DeepSeek-v3\uff09\u7684\u57fa\u672c\u6307\u4ee4\u8f6c\u53d8\u4e3a\u63a8\u7406\u6a21\u578b\uff08DeepSeek-R1\uff09\u3002<\/section>\n<section><\/section>\n<section>GRPO \u662f\u4e00\u79cd\u5728\u7ebf\u5b66\u4e60\u7b97\u6cd5\uff08online learning algorithm\uff09\uff0c\u5b83\u901a\u8fc7\u4f7f\u7528\u8bad\u7ec3\u8fc7\u7a0b\u4e2d\u7531\u8bad\u7ec3\u6a21\u578b\u81ea\u8eab\u751f\u6210\u7684\u6570\u636e\u6765\u8fdb\u884c\u8fed\u4ee3\u6539\u8fdb\u3002GRPO \u7684\u76ee\u6807\u662f\u6700\u5927\u5316\u751f\u6210\u8865\u5168\uff08completions\uff09\u7684\u4f18\u52bf\u51fd\u6570\uff08advantage\uff09\uff0c\u540c\u65f6\u786e\u4fdd\u6a21\u578b\u4fdd\u6301\u5728\u53c2\u8003\u7b56\u7565\uff08reference policy\uff09\u9644\u8fd1\u3002<\/section>\n<section><a href=\"https:\/\/17aitech.com\/wp-content\/uploads\/2025\/02\/frc-e70b29c60749a15fc1e280bba4579db9.png\" data-fancybox=\"images\" data-fancybox=\"gallery\"><img decoding=\"async\" src=\"https:\/\/17aitech.com\/wp-content\/uploads\/2025\/02\/frc-e70b29c60749a15fc1e280bba4579db9.png\"><\/a><\/section>\n<section>\u672c\u6587\u7684\u76ee\u7684\u662f\u5e2e\u4f60\u8282\u7701\u4e00\u4e9b\u65f6\u95f4\uff0c\u8ba9\u4f60\u6839\u636e\u786c\u4ef6\u9884\u7b97\u9009\u62e9\u5408\u9002\u7684\u6a21\u578b\u5927\u5c0f\u3002\u5728\u5f00\u59cb\u5fae\u8c03\u65f6\uff0c\u4f60\u5fc5\u987b\u505a\u51fa\u7684\u91cd\u8981\u51b3\u5b9a\u662f\u9009\u62e9\u6a21\u578b\u5927\u5c0f\uff0c\u4ee5\u53ca\u4f60\u662f\u6267\u884c\u5b8c\u5168\u5fae\u8c03\u8fd8\u662f\u53c2\u6570\u9ad8\u6548\u5fae\u8c03\uff08PEFT\uff09\u3002<\/section>\n<section><\/section>\n<section>\u6587\u7ae0\u4f5c\u8005\u6765\u81ea AI \u516c\u53f8 Oxen.ai \u7684 CEO Greg Schoeninger\u3002<\/section>\n<section><a href=\"https:\/\/17aitech.com\/wp-content\/uploads\/2025\/02\/frc-4efa97cb53763f9bd868c454c8534ded.png\" data-fancybox=\"images\" data-fancybox=\"gallery\"><img decoding=\"async\" src=\"https:\/\/17aitech.com\/wp-content\/uploads\/2025\/02\/frc-4efa97cb53763f9bd868c454c8534ded.png\"><\/a><\/section>\n<section><sup>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u539f\u6587\u94fe\u63a5\uff1ahttps:\/\/www.oxen.ai\/blog\/grpo-vram-requirements-for-the-gpu-poor<\/sup><\/section>\n<section><\/section>\n<section>\u4f5c\u8005\u8868\u793a\uff0c\u4ed6\u53d1\u73b0 trl \u5e93\u4e2d\u5df2\u7ecf\u6709\u4e00\u4e2a\u6613\u4e8e\u4f7f\u7528\u7684 GRPO \u5b9e\u73b0\uff0c\u4fbf\u7acb\u523b\u5f00\u59cb\u4e86\u8bad\u7ec3\uff0c\u4f7f\u7528\u7684\u786c\u4ef6\u662f\u914d\u5907\u4e86 16GB \u663e\u5b58\u7684 Nvidia GeForce RTX 3080 \u7684\u5c0f\u578b\u7b14\u8bb0\u672c\u7535\u8111\u3002\u6b63\u5982\u5927\u5bb6\u53ef\u80fd\u9047\u5230\u7684\u95ee\u9898\uff0c\u4f5c\u8005\u53d1\u73b0\u793a\u4f8b\u4ee3\u7801\u4e2d\u7684\u53c2\u6570\u8bbe\u7f6e\u5bfc\u81f4\u4e86\u4e00\u4e2a\u5de8\u5927\u7684\u663e\u5b58\u4e0d\u8db3\uff08OOM\uff0cout of memory \uff09\u9519\u8bef\u3002<\/section>\n<section><\/section>\n<pre><ol>\n<li><p><code>torch.OutOfMemoryError: CUDA out of memory.<\/code><\/p><\/li>\n<li><p><code>Tried to allocate 1.90 GiB. GPU 0 has a total capacity of 15.73 GiB of which 1.28 GiB is free. <\/code><\/p><\/li>\n<li><p><code>Including non-PyTorch memory, this process has 14.43 GiB memory in use. Of the allocated memory 11.82 GiB is allocated by PyTorch, and 2.41 GiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True to avoid fragmentation. \u00a0See documentation for Memory Management \u00a0(https:\/\/pytorch.org\/docs\/stable\/notes\/cuda.html#environment-variables)<\/code><\/p><\/li>\n<\/ol><\/pre>\n<section><strong><br \/><\/strong><\/section>\n<section><strong>\u5b9e\u9645\u4f7f\u7528\u60c5\u51b5<\/strong><\/section>\n<section><\/section>\n<section>\u4f5c\u8005\u8868\u793a\uff0c\u4ed6\u4eec\u8fdb\u884c\u4e86\u4e00\u7cfb\u5217\u5b9e\u9a8c\uff0c\u4ee5\u786e\u5b9a\u8bad\u7ec3\u5404\u79cd\u5927\u5c0f\u7684\u6a21\u578b\u6240\u9700\u7684\u663e\u5b58\uff08VRAM\uff09\u8981\u6c42\u3002\u53c2\u6570\u6570\u91cf\u4ece 5 \u4ebf\u5230 140 \u4ebf\u4e0d\u7b49\uff0c\u4ed6\u4eec\u6bd4\u8f83\u4e86\u6743\u91cd\u7684\u5b8c\u5168\u5fae\u8c03\u4e0e\u53c2\u6570\u9ad8\u6548\u5fae\u8c03\uff08\u4f7f\u7528 LoRA\uff09\uff0c\u6240\u6709\u8bad\u7ec3\u8fd0\u884c\u90fd\u5728\u82f1\u4f1f\u8fbe H100 \u4e0a\u5b8c\u6210\uff0c\u56e0\u6b64\u8fd9\u91cc\u7684 OOM \u610f\u5473\u7740 &gt;80GB \u7684 VRAM\u3002<\/section>\n<section><a href=\"https:\/\/17aitech.com\/wp-content\/uploads\/2025\/02\/frc-c4fced4f3e1c14f1fa66d59458049949.png\" data-fancybox=\"images\" data-fancybox=\"gallery\"><img decoding=\"async\" src=\"https:\/\/17aitech.com\/wp-content\/uploads\/2025\/02\/frc-c4fced4f3e1c14f1fa66d59458049949.png\"><\/a><\/section>\n<section>\u5728\u8868\u683c\u4e2d\uff0c\u4f60\u53ef\u4ee5\u627e\u5230 GSM8K \u6570\u636e\u96c6\u4e0a\u8bad\u7ec3\u7684\u524d 100 \u6b65\u4e2d\u7684\u5cf0\u503c\u5185\u5b58\u4f7f\u7528\u60c5\u51b5\u3002\u7528\u4e8e\u5b9e\u9a8c\u7684\u6a21\u578b\u662f\uff1a<\/section>\n<section><a href=\"https:\/\/17aitech.com\/wp-content\/uploads\/2025\/02\/frc-f3ae563c5b7f7823da3106667d54e1d8.png\" data-fancybox=\"images\" data-fancybox=\"gallery\"><img decoding=\"async\" src=\"https:\/\/17aitech.com\/wp-content\/uploads\/2025\/02\/frc-f3ae563c5b7f7823da3106667d54e1d8.png\"><\/a><\/section>\n<section>\u6240\u6709\u5b9e\u9a8c\u5747\u4f7f\u7528 Shadeform \u7684 GPU \u5e02\u573a\u5b8c\u6210\uff0c\u56e0\u6b64\u6bcf\u6b21\u5b9e\u9a8c\u53ea\u9700\u8981\u82b1\u8d39\u51e0\u7f8e\u5143 H100\u3002<\/section>\n<section><\/section>\n<section>\u5b9e\u9a8c\u7ed3\u679c\u8868\u660e\uff0c\u5185\u5b58\u9700\u6c42\u968f\u7740\u6a21\u578b\u5927\u5c0f\u548c\u8bad\u7ec3\u65b9\u5f0f\u7684\u4e0d\u540c\u800c\u663e\u8457\u53d8\u5316\u3002\u4f8b\u5982\uff0c\u5168\u53c2\u6570\u5fae\u8c03\u6bd4 PEFT \u9700\u8981\u66f4\u591a\u7684\u5185\u5b58\u3002<\/section>\n<section><\/section>\n<section><strong>\u4e3a\u4ec0\u4e48 GRPO \u5bf9\u5185\u5b58\u9700\u6c42\u8f83\u9ad8<\/strong><\/section>\n<section><\/section>\n<section>\u8fd9\u8981\u4ece GRPO \u7684\u539f\u7406\u8bf4\u8d77\uff0c\u8fd9\u662f\u5b83\u7684\u6d41\u7a0b\u56fe\u3002<\/section>\n<section><a href=\"https:\/\/17aitech.com\/wp-content\/uploads\/2025\/02\/frc-4744660f9765375bd2c268d1f9ba8242.png\" data-fancybox=\"images\" data-fancybox=\"gallery\"><img decoding=\"async\" src=\"https:\/\/17aitech.com\/wp-content\/uploads\/2025\/02\/frc-4744660f9765375bd2c268d1f9ba8242.png\"><\/a><\/section>\n<section>GRPO \u5bf9\u5185\u5b58\u9700\u6c42\u8f83\u9ad8\u7684\u539f\u56e0\u5728\u4e8e\uff0c\u5176\u5185\u90e8\u6d89\u53ca\u591a\u4e2a\u6a21\u578b\uff0c\u5e76\u4e14\u5728\u8bad\u7ec3\u6570\u636e\u4e2d\u6bcf\u4e2a\u67e5\u8be2\u4f1a\u4ea7\u751f\u591a\u4e2a\u8f93\u51fa\u3002\u4e0a\u56fe\u4e2d\u7684\u7b56\u7565\u6a21\u578b\u3001\u53c2\u8003\u6a21\u578b\u548c\u5956\u52b1\u6a21\u578b\u5404\u81ea\u90fd\u662f\u4e00\u4e2a\u9700\u8981\u8fdb\u884c\u63a8\u7406\u7684 LLM\u3002\uff08\u5c3d\u7ba1\u4ece\u6280\u672f\u4e0a\u8bb2\uff0c\u5956\u52b1\u6a21\u578b\u53ef\u80fd\u4e0d\u9700\u8981\u53c2\u6570\u5316\uff0c\u53ef\u4ee5\u53ea\u662f\u4e00\u4e2a Python \u51fd\u6570\u6216\u6b63\u5219\u8868\u8fbe\u5f0f\uff0c\u4f46\u4e0d\u5f71\u54cd GRPO \u5bf9\u5185\u5b58\u7684\u9ad8\u9700\u6c42\u3002\uff09<\/section>\n<section><\/section>\n<section><strong>\u4e3a\u4ec0\u4e48 8-Bit \u4f18\u5316\u548c\u68af\u5ea6\u68c0\u67e5\u70b9\u6709\u52a9\u4e8e\u51cf\u5c11\u5185\u5b58\u5360\u7528\uff1f<\/strong><\/section>\n<section><\/section>\n<section>\u901a\u5e38\u6765\u8bb2\uff0c\u8bad\u7ec3\u4e00\u4e2a\u5927\u578b\u8bed\u8a00\u6a21\u578b\u9700\u8981\u5728\u5185\u5b58\u4e2d\u5b58\u50a8\u4e09\u79cd\u4e3b\u8981\u7c7b\u578b\u7684\u4fe1\u606f\uff1a\u6a21\u578b\u53c2\u6570\u3001\u6a21\u578b\u5b66\u4e60\u6240\u9700\u7684\u68af\u5ea6\u3001\u4f18\u5316\u5668\u7684\u8ddf\u8e2a\u6570\u636e\u3002<\/section>\n<section><\/section>\n<section>\u5bf9\u4e0a\u8ff0\u5185\u5bb9\u6211\u4eec\u53ef\u4ee5\u8fd9\u6837\u7406\u89e3\uff1a\u5982\u679c\u6a21\u578b\u7684\u53c2\u6570\u5360\u7528\u4e86 X \u7684\u7a7a\u95f4\uff0c\u90a3\u4e48\u68af\u5ea6\u4e5f\u4f1a\u5360\u7528\u5927\u7ea6\u76f8\u540c\u7684\u7a7a\u95f4\u3002\u7136\u540e\uff0c\u50cf AdamW \u8fd9\u6837\u7684\u4f18\u5316\u5668\u9700\u8981\u66f4\u591a\u7684\u7a7a\u95f4\uff0c\u56e0\u4e3a\u5b83\u4eec\u5c31\u50cf\u4e00\u4e2a\u8bb0\u5f55\u5458\uff0c\u8ddf\u8e2a\u6700\u8fd1\u7684\u66f4\u65b0\u5386\u53f2\uff0c\u4ee5\u4fbf\u66f4\u597d\u5730\u51b3\u5b9a\u672a\u6765\u7684\u4f18\u5316\u3002<\/section>\n<section><\/section>\n<section>\u4e3a\u4e86\u51cf\u8f7b\u8fd9\u79cd\u5185\u5b58\u8d1f\u62c5\uff0c\u901a\u5e38\u91c7\u7528\u4e24\u79cd\u6280\u672f\uff1a<\/section>\n<section><\/section>\n<ul>\n<li>\n<section>\u9996\u5148\uff0c\u53ef\u4ee5\u4f7f\u7528\u50cf AdamW \u8fd9\u6837\u7684 8-bit \u4f18\u5316\u5668\u7248\u672c\uff0c\u5b83\u4eec\u80fd\u66f4\u9ad8\u6548\u5730\u5b58\u50a8\u8ddf\u8e2a\u6570\u636e\uff0c\u540c\u65f6\u4ecd\u4fdd\u6301\u826f\u597d\u7684\u6027\u80fd \u2014\u2014 \u7c7b\u4f3c\u4e8e\u538b\u7f29\u7167\u7247\u53ef\u4ee5\u8282\u7701\u7a7a\u95f4\uff0c\u540c\u65f6\u4fdd\u7559\u5927\u90e8\u5206\u56fe\u50cf\u8d28\u91cf\uff1b<\/section>\n<\/li>\n<li>\n<section>\u5176\u6b21\uff0c\u4f7f\u7528\u68af\u5ea6\u68c0\u67e5\u70b9\u6280\u672f\uff0c\u8fd9\u5c31\u50cf\u5728\u8bad\u7ec3\u8fc7\u7a0b\u4e2d\u62cd\u6444\u5feb\u7167\uff0c\u800c\u4e0d\u662f\u8bb0\u5f55\u6240\u6709\u5185\u5bb9\u3002\u867d\u7136\u8fd9\u4f1a\u4f7f\u8bad\u7ec3\u901f\u5ea6\u51cf\u6162\u7ea6 20-30%\uff0c\u4f46\u5b83\u663e\u8457\u51cf\u5c11\u4e86\u5185\u5b58\u4f7f\u7528\u3002<\/section>\n<\/li>\n<\/ul>\n<section><\/section>\n<section>\u7ed3\u5408\u8fd9\u4e9b\u6280\u672f\uff0c\u5373\u4f7f\u5bf9 GPU \u8d44\u6e90\u6709\u9650\u7684\u4eba\u6765\u8bf4\uff0c\u4e5f\u80fd\u591f\u8bad\u7ec3\u66f4\u5927\u7684\u6a21\u578b\u3002<\/section>\n<section><strong><br \/><\/strong><\/section>\n<section><strong>\u4ee3\u7801\u793a\u4f8b<\/strong><\/section>\n<section><\/section>\n<section>\u50cf trl \u8fd9\u6837\u7684\u5e93\u5df2\u7ecf\u5f00\u59cb\u652f\u6301 GRPO\uff0c\u4f7f\u5f97\u5fae\u8c03\u7531 transformers \u6784\u6210\u7684 LLM \u53d8\u5f97\u975e\u5e38\u7b80\u5355\u3002\u4ee3\u7801\u4e5f\u975e\u5e38\u7b80\u6d01\uff0c\u53ea\u9700\u5c06\u8bad\u7ec3\u5668\u66ff\u6362\u4e3a GRPOTrainer \u5e76\u5b9a\u4e49\u4e00\u4e9b\u5956\u52b1\u5373\u53ef\u3002GRPO \u7684\u6700\u5c0f\u4ee3\u7801\u91cf\u5927\u7ea6\u53ea\u6709 99 \u884c\uff0c\u5982\u679c\u4f60\u4f7f\u7528\u7684\u662f\u50cf meta-llama\/Llama-3.2-1B-Instruct \u8fd9\u6837\u7684\u5c0f\u578b\u6a21\u578b\u548c\u50cf openai\/GSM8K \u8fd9\u6837\u7684\u6570\u636e\u96c6\uff0c\u53ef\u4ee5\u975e\u5e38\u5feb\u901f\u5730\u542f\u52a8\u3002<\/section>\n<section><\/section>\n<section>trl \u9879\u76ee\u5730\u5740\uff1ahttps:\/\/github.com\/huggingface\/trl?ref=ghost.oxen.ai<\/section>\n<section><\/section>\n<pre><ol>\n<li><p><code>import torch<\/code><\/p><\/li>\n<li><p><code>from datasets import load_dataset, Dataset<\/code><\/p><\/li>\n<li><p><code>from transformers import AutoTokenizer, AutoModelForCausalLM<\/code><\/p><\/li>\n<li><p><code>from trl import GRPOConfig, GRPOTrainer<\/code><\/p><\/li>\n<li><p><code>import re<\/code><\/p><\/li>\n<li><p><code>SYSTEM_PROMPT = \"\"\"<\/code><\/p><\/li>\n<li><p><code>Respond in the following format:<\/code><\/p><\/li>\n<li><p><code><\/code><\/p><\/li>\n<li><p><code>...<\/code><\/p><\/li>\n<li><p><code><\/code><\/p><\/li>\n<li><p><code><\/code><\/p><\/li>\n<li><p><code>...<\/code><\/p><\/li>\n<li><p><code><\/code><\/p><\/li>\n<li><p><code>\"\"\"<\/code><\/p><\/li>\n<li><p><code>def extract_hash_answer(text: str) -&gt; str | None:<\/code><\/p><\/li>\n<li><p><code>    if \"####\" not in text:<\/code><\/p><\/li>\n<li><p><code>        return None<\/code><\/p><\/li>\n<li><p><code>    return text.split(\"####\")[1].strip()<\/code><\/p><\/li>\n<li><p><code>def get_gsm8k_questions(split = \"train\") -&gt; Dataset:<\/code><\/p><\/li>\n<li><p><code>    data = load_dataset('openai\/gsm8k', 'main')[split]<\/code><\/p><\/li>\n<li><p><code>    data = data.map(lambda x: {<\/code><\/p><\/li>\n<li><p><code>        'prompt': [<\/code><\/p><\/li>\n<li><p><code>            {'role': 'system', 'content': SYSTEM_PROMPT},<\/code><\/p><\/li>\n<li><p><code>            {'role': 'user', 'content': x['question']}<\/code><\/p><\/li>\n<li><p><code>        ],<\/code><\/p><\/li>\n<li><p><code>        'answer': extract_hash_answer(x['answer'])<\/code><\/p><\/li>\n<li><p><code>    })<\/code><\/p><\/li>\n<li><p><code>    return data<\/code><\/p><\/li>\n<li><p><code>def extract_xml_answer(text: str) -&gt; str:<\/code><\/p><\/li>\n<li><p><code>    answer = text.split(\"\")[-1]<\/code><\/p><\/li>\n<li><p><code>    answer = answer.split(\"\")[0]<\/code><\/p><\/li>\n<li><p><code>    return answer.strip()<\/code><\/p><\/li>\n<li><p><code>def format_reward_func(completions, **kwargs) -&gt; list[float]:<\/code><\/p><\/li>\n<li><p><code>    \"\"\"Reward function that checks if the completion has a specific format.\"\"\"<\/code><\/p><\/li>\n<li><p><code>    pattern = r\"^n.*?nnn.*?nn$\"<\/code><\/p><\/li>\n<li><p><code>    responses = [completion[0][\"content\"] for completion in completions]<\/code><\/p><\/li>\n<li><p><code>    matches = [re.match(pattern, r) for r in responses]<\/code><\/p><\/li>\n<li><p><code>    return [0.5 if match else 0.0 for match in matches]<\/code><\/p><\/li>\n<li><p><code>def accuracy_reward_func(prompts, completions, answer, **kwargs) -&gt; list[float]:<\/code><\/p><\/li>\n<li><p><code>    \"\"\"Reward function that extracts the answer from the xml tags and compares it to the correct answer.\"\"\"<\/code><\/p><\/li>\n<li><p><code>    responses = [completion[0]['content'] for completion in completions]<\/code><\/p><\/li>\n<li><p><code>    extracted_responses = [extract_xml_answer(r) for r in responses]<\/code><\/p><\/li>\n<li><p><code>    return [2.0 if r == a else 0.0 for r, a in zip(extracted_responses, answer)]<\/code><\/p><\/li>\n<li><p><code>def main():<\/code><\/p><\/li>\n<li><p><code>    dataset = get_gsm8k_questions()<\/code><\/p><\/li>\n<li><p><code>    model_name = \"meta-llama\/Llama-3.2-1B-Instruct\"<\/code><\/p><\/li>\n<li><p><code>    model = AutoModelForCausalLM.from_pretrained(<\/code><\/p><\/li>\n<li><p><code>        model_name,<\/code><\/p><\/li>\n<li><p><code>        torch_dtype=torch.bfloat16,<\/code><\/p><\/li>\n<li><p><code>        attn_implementation=\"flash_attention_2\",<\/code><\/p><\/li>\n<li><p><code>        device_map=None<\/code><\/p><\/li>\n<li><p><code>    ).to(\"cuda\")<\/code><\/p><\/li>\n<li><p><code>    tokenizer = AutoTokenizer.from_pretrained(model_name)<\/code><\/p><\/li>\n<li><p><code>    tokenizer.pad_token = tokenizer.eos_token<\/code><\/p><\/li>\n<li><p><code>    training_args = GRPOConfig(<\/code><\/p><\/li>\n<li><p><code>        output_dir=\"output\",<\/code><\/p><\/li>\n<li><p><code>        learning_rate=5e-6,<\/code><\/p><\/li>\n<li><p><code>        adam_beta1=0.9,<\/code><\/p><\/li>\n<li><p><code>        adam_beta2=0.99,<\/code><\/p><\/li>\n<li><p><code>        weight_decay=0.1,<\/code><\/p><\/li>\n<li><p><code>        warmup_ratio=0.1,<\/code><\/p><\/li>\n<li><p><code>        lr_scheduler_type='cosine',<\/code><\/p><\/li>\n<li><p><code>        logging_steps=1,<\/code><\/p><\/li>\n<li><p><code>        bf16=True,<\/code><\/p><\/li>\n<li><p><code>        per_device_train_batch_size=1,<\/code><\/p><\/li>\n<li><p><code>        gradient_accumulation_steps=4,<\/code><\/p><\/li>\n<li><p><code>        num_generations=4,<\/code><\/p><\/li>\n<li><p><code>        max_prompt_length=256,<\/code><\/p><\/li>\n<li><p><code>        max_completion_length=786,<\/code><\/p><\/li>\n<li><p><code>        num_train_epochs=1,<\/code><\/p><\/li>\n<li><p><code>        save_steps=100,<\/code><\/p><\/li>\n<li><p><code>        save_total_limit=1,<\/code><\/p><\/li>\n<li><p><code>        max_grad_norm=0.1,<\/code><\/p><\/li>\n<li><p><code>        log_on_each_node=False,<\/code><\/p><\/li>\n<li><p><code>    )<\/code><\/p><\/li>\n<li><p><code>    trainer = GRPOTrainer(<\/code><\/p><\/li>\n<li><p><code>        model=model,<\/code><\/p><\/li>\n<li><p><code>        processing_class=tokenizer,<\/code><\/p><\/li>\n<li><p><code>        reward_funcs=[<\/code><\/p><\/li>\n<li><p><code>            format_reward_func,<\/code><\/p><\/li>\n<li><p><code>            accuracy_reward_func<\/code><\/p><\/li>\n<li><p><code>        ],<\/code><\/p><\/li>\n<li><p><code>        args=training_args,<\/code><\/p><\/li>\n<li><p><code>        train_dataset=dataset,<\/code><\/p><\/li>\n<li><p><code>    )<\/code><\/p><\/li>\n<li><p><code>    trainer.train()<\/code><\/p><\/li>\n<li><p><code>if __name__ == \"__main__\":<\/code><\/p><\/li>\n<li><p><code>    main()<\/code><\/p><\/li>\n<\/ol><\/pre>\n<section><\/section>\n<section><strong>Num Generations \u6709\u4ec0\u4e48\u7528<\/strong><\/section>\n<section><\/section>\n<section>Num Generations \u662f\u4e00\u4e2a\u8d85\u53c2\u6570\uff0c\u5b83\u51b3\u5b9a\u4e86\u6211\u4eec\u5c06\u5728\u8bad\u7ec3\u6570\u636e\u4e2d\u5bf9\u6bcf\u4e2a\u67e5\u8be2\u91c7\u6837\u591a\u5c11\u4e2a\u8865\u5168\u3002\u7136\u800c\uff0c\u8fd9\u4f1a\u663e\u8457\u589e\u52a0 VRAM \u7684\u6d88\u8017\u3002<\/section>\n<section><a href=\"https:\/\/17aitech.com\/wp-content\/uploads\/2025\/02\/frc-b98a636a1ab7a6ed1b7ece215f637f9e.png\" data-fancybox=\"images\" data-fancybox=\"gallery\"><img decoding=\"async\" src=\"https:\/\/17aitech.com\/wp-content\/uploads\/2025\/02\/frc-b98a636a1ab7a6ed1b7ece215f637f9e.png\"><\/a><\/section>\n<section>\u76ee\u524d\u6709\u4e00\u4e2a\u5f00\u653e\u7684 GitHub \u95ee\u9898\uff0c\u53ef\u80fd\u4f1a\u5e2e\u52a9\u89e3\u51b3\u5185\u5b58\u74f6\u9888\u95ee\u9898\uff0c\u53ef\u4ee5\u53c2\u8003\u5982\u4e0b\u94fe\u63a5<\/section>\n<section><\/section>\n<section>\u5730\u5740\uff1ahttps:\/\/github.com\/huggingface\/trl\/issues\/2709?ref=ghost.oxen.ai<\/section>\n<section><\/section>\n<section>\u5bf9\u4e8e num_completions=8,16,64 (DeepSeekMath \u8bba\u6587\u4f7f\u7528\u7684 64)\uff0c\u4f5c\u8005\u8868\u793a\uff0c\u4e0d\u7528\u518d\u6b21\u8ba1\u7b97\u4e0a\u8ff0\u6240\u6709\u503c\uff0c\u800c\u662f\u4f7f\u7528\u4e86 1B \u53c2\u6570\u6a21\u578b\u8fdb\u884c\u4e86\u6d4b\u8bd5\uff0c\u4ee5\u663e\u793a\u5185\u5b58\u589e\u957f\u3002\u4e0d\u8fc7\uff0c\u4f5c\u8005\u8fd8\u662f\u5efa\u8bae\u5927\u5bb6\u5728\u5185\u5b58\u74f6\u9888\u5f97\u5230\u4fee\u590d\u4e4b\u524d\u4f7f\u7528 num_generations=4\uff0c\u4e5f\u80fd\u83b7\u5f97\u4e0d\u9519\u7684\u6027\u80fd\u3002<\/section>\n<section><a href=\"https:\/\/17aitech.com\/wp-content\/uploads\/2025\/02\/frc-05b480719cd5333dc08fdadc50c67a93.png\" data-fancybox=\"images\" data-fancybox=\"gallery\"><img decoding=\"async\" src=\"https:\/\/17aitech.com\/wp-content\/uploads\/2025\/02\/frc-05b480719cd5333dc08fdadc50c67a93.png\"><\/a><\/section>\n<section><strong>\u5f71\u54cd VRAM \u7684\u4e00\u4e9b\u56e0\u7d20<\/strong><\/section>\n<section><\/section>\n<section>\u8981\u5bf9\u6240\u6709\u5f71\u54cd\u663e\u5b58\uff08VRAM\uff09\u4f7f\u7528\u7684\u56e0\u7d20\u8fdb\u884c\u5168\u9762\u7684\u8d85\u53c2\u6570\u9a8c\u8bc1\uff0c\u9700\u8981\u8fdb\u884c\u5927\u91cf\u7684\u5b9e\u9a8c\u3002\u7b80\u5355\u8d77\u89c1\uff0c\u8fd9\u91cc\u53ea\u6307\u51fa\u4e86\u9700\u8981\u6ce8\u610f\u7684\u8bbe\u7f6e\uff0c\u4ee5\u53ca\u5b9e\u9a8c\u4e2d\u4f7f\u7528\u7684\u5177\u4f53\u6570\u503c\u3002<\/section>\n<section><\/section>\n<ul>\n<li>\n<section>batch_size=1\uff0c\u7531\u4e8e GRPO \u4e3a\u6bcf\u4e2a\u67e5\u8be2\u751f\u6210\u591a\u4e2a\u54cd\u5e94\uff0cbatch size \u4f1a\u8fc5\u901f\u5931\u63a7\u3002<\/section>\n<\/li>\n<li>\n<section>gradient_accumulation_steps=4\uff0c\u4f18\u5316\u5668\u662f\u53e6\u4e00\u4e2a\u5360\u7528\u5927\u91cf VRAM \u7684\u5730\u65b9\u3002\u6b64\u53c2\u6570\u51b3\u5b9a\u4e86\u6211\u4eec\u5c06\u5b58\u50a8\u7684\u68af\u5ea6\u4ee5\u5e2e\u52a9\u4f18\u5316\u5668\u8fdb\u884c\u5176\u300c\u722c\u5c71\u300d\u8fc7\u7a0b\u3002<\/section>\n<\/li>\n<li>\n<section>num_completions=4\uff0cDeepSeekMath \u8bba\u6587\u4e2d\u4f7f\u7528\u4e86 64\u3002\u8fd9\u5b8c\u5168\u8d85\u51fa\u4e86\u6709\u4e9b\u4eba\u7684\u8ba1\u7b97\u9884\u7b97\u3002<\/section>\n<\/li>\n<li>\n<section>max_prompt_length=256\uff0c\u5982\u679c\u4f60\u60f3\u8bad\u7ec3\u6a21\u578b\u62e5\u6709\u66f4\u5927\u4e0a\u4e0b\u6587\u7684\u63a8\u7406\u80fd\u529b\uff0c\u5c06\u4e0d\u5f97\u4e0d\u589e\u52a0 VRAM\u3002GSM8K \u7684\u63d0\u793a\u76f8\u5bf9\u8f83\u5c0f\uff0c\u9002\u5408\u6b64\u6d4b\u8bd5\u3002<\/section>\n<\/li>\n<li>\n<section>max_completion_length=786\uff0c\u540c\u6837\uff0c\u7531\u4e8e\u8ba1\u7b97\u6ce8\u610f\u529b\u7684\u5185\u5b58\u6709\u9650\uff0c\u63a8\u7406\u94fe\u5728\u8fd9\u91cc\u53d7\u5230\u9650\u5236\u3002\u4e0a\u4e0b\u6587\u6216\u751f\u6210\u7684 token \u8d8a\u591a\uff0c\u9700\u8981\u7684\u5185\u5b58\u5c31\u8d8a\u5927\u3002<\/section>\n<\/li>\n<li>\n<section>LoRA target_modules=[&#8220;q_proj&#8221;, &#8220;k_proj&#8221;, &#8220;o_proj&#8221;, &#8220;up_proj&#8221;, &#8220;down_proj&#8221;] \u5728\u8fd9\u65b9\u9762\u53ef\u4ee5\u5c1d\u8bd5\u51e0\u79cd\u4e0d\u540c\u7684\u8fed\u4ee3\u3002target_modules=&#8221;all-linear&#8221; \u662f\u4e00\u79cd\u6d41\u884c\u7684\u65b9\u5f0f\uff0c\u53ef\u4ee5\u4ece\u4f60\u7684 LoRA \u4e2d\u6324\u51fa\u6700\u591a\u7684\u6027\u80fd\uff08\u5c31\u51c6\u786e\u6027\u800c\u8a00\uff09\u3002<\/section>\n<\/li>\n<\/ul>\n<section><\/section>\n<section><strong>\u5bf9 VRAM \u4f7f\u7528\u7684\u7c97\u7565\u4f30\u7b97<\/strong><\/section>\n<section><\/section>\n<section>\u5982\u679c\u4f60\u6b63\u5728\u4f7f\u7528 FP16 \u7cbe\u5ea6\u8fdb\u884c\u8bad\u7ec3\uff0c\u4ee5\u4e0b\u662f\u4e00\u4e9b\u7b80\u5355\u7684\u4f30\u7b97\u65b9\u6cd5\uff0c\u53ef\u4ee5\u5e2e\u52a9\u4f60\u4e86\u89e3\u5185\u5b58\u4e3b\u8981\u7528\u5728\u4e86\u54ea\u4e9b\u5730\u65b9\uff1a<\/section>\n<section><\/section>\n<ul>\n<li>\n<section>\u6a21\u578b\u53c2\u6570\uff1a\u6bcf\u4e2a\u53c2\u6570\u5360\u7528 2 \u5b57\u8282\u3002<\/section>\n<\/li>\n<li>\n<section>\u53c2\u8003\u6a21\u578b\u53c2\u6570\uff1a\u6bcf\u4e2a\u53c2\u6570\u5360\u7528 2 \u5b57\u8282\u3002<\/section>\n<\/li>\n<li>\n<section>\u68af\u5ea6\uff1a\u6bcf\u4e2a\u53c2\u6570\u5360\u7528 2 \u5b57\u8282\u3002<\/section>\n<\/li>\n<li>\n<section>\u4f18\u5316\u5668\u72b6\u6001\uff1a\u6bcf\u4e2a\u53c2\u6570\u5360\u7528 8 \u5b57\u8282\u3002<\/section>\n<\/li>\n<li>\n<section>8 \u4f4d\u4f18\u5316\u5668\uff1a\u6bcf\u4e2a\u53c2\u6570\u5360\u7528 4 \u5b57\u8282\u3002<\/section>\n<\/li>\n<li>\n<section>PEFT\uff1a\u6709\u52a9\u4e8e\u51cf\u5c11\u68af\u5ea6\u7684\u663e\u5b58\u5360\u7528\u3002<\/section>\n<\/li>\n<\/ul>\n<section><\/section>\n<section>\u6700\u540e\u662f\u5173\u4e8e\u51c6\u786e\u7387\u7684\u3002\u4f5c\u8005\u5b8c\u6210\u4e86\u4e00\u4e2a 10 \u4ebf\u53c2\u6570\u7684 Llama 3.2 \u6a21\u578b\u7684\u5b8c\u6574\u8bad\u7ec3\u3002\u5728\u5e94\u7528 GRPO \u4e4b\u524d\uff0c\u8be5\u6a21\u578b\u5728\u4fdd\u7559\u6d4b\u8bd5\u96c6\u4e0a\u8fbe\u5230\u4e86\u7ea6 19% \u7684\u51c6\u786e\u7387\uff0c\u800c\u5728\u7ecf\u8fc7\u4e00\u4e2a\u8bad\u7ec3\u5468\u671f\u540e\uff0c\u6a21\u578b\u7684\u51c6\u786e\u7387\u98d9\u5347\u81f3\u7ea6 40.5%\u3002\u867d\u7136\u8fd9\u79bb SOTA \u6c34\u5e73\u8fd8\u5dee\u5f97\u5f88\u8fdc\uff0c\u4f46\u8fd9\u5c55\u793a\u4e86 GRPO \u7684\u5f3a\u5927\u6f5c\u529b\u3002<\/section>\n<p>\u6587\u7ae0\u6765\u6e90\u4e8e\u4e92\u8054\u7f51:<a href=\"https:\/\/www.jiqizhixin.com\/articles\/2025-02-07-7\" target=\"_blank\">DeepSeek\u7528\u7684GRPO\u5360\u7528\u5927\u91cf\u5185\u5b58\uff1f\u6709\u4eba\u7ed9\u51fa\u4e86\u4e9b\u7834\u89e3\u65b9\u6cd5<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6765\u6e90\u4e8e\u4e92\u8054\u7f51:DeepSeek\u7528\u7684G [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[27],"tags":[71,68],"class_list":["post-38130","post","type-post","status-publish","format-standard","hentry","category-news","tag-rag","tag-68"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>DeepSeek\u7528\u7684GRPO\u5360\u7528\u5927\u91cf\u5185\u5b58\uff1f\u6709\u4eba\u7ed9\u51fa\u4e86\u4e9b\u7834\u89e3\u65b9\u6cd5 - \u4e00\u8d77AI\u6280\u672f<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/17aitech.com\/?p=38130\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/17aitech.com\\\/?p=38130#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/17aitech.com\\\/?p=38130\"},\"author\":{\"name\":\"AI\u5c0f\u52a9\u624b\",\"@id\":\"https:\\\/\\\/17aitech.com\\\/#\\\/schema\\\/person\\\/60225458499e817ae0af73e67e440b9d\"},\"headline\":\"DeepSeek\u7528\u7684GRPO\u5360\u7528\u5927\u91cf\u5185\u5b58\uff1f\u6709\u4eba\u7ed9\u51fa\u4e86\u4e9b\u7834\u89e3\u65b9\u6cd5\",\"datePublished\":\"2025-02-10T11:00:53+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/17aitech.com\\\/?p=38130\"},\"wordCount\":167,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/17aitech.com\\\/?p=38130#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/17aitech.com\\\/wp-content\\\/uploads\\\/2025\\\/02\\\/frc-e70b29c60749a15fc1e280bba4579db9.png\",\"keywords\":[\"RAG\",\"\u5927\u6a21\u578b\"],\"articleSection\":[\"\u884c\u4e1a\u8d44\u8baf\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/17aitech.com\\\/?p=38130#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/17aitech.com\\\/?p=38130\",\"url\":\"https:\\\/\\\/17aitech.com\\\/?p=38130\",\"name\":\"DeepSeek\u7528\u7684GRPO\u5360\u7528\u5927\u91cf\u5185\u5b58\uff1f\u6709\u4eba\u7ed9\u51fa\u4e86\u4e9b\u7834\u89e3\u65b9\u6cd5 - \u4e00\u8d77AI\u6280\u672f\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/17aitech.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/17aitech.com\\\/?p=38130#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/17aitech.com\\\/?p=38130#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/17aitech.com\\\/wp-content\\\/uploads\\\/2025\\\/02\\\/frc-e70b29c60749a15fc1e280bba4579db9.png\",\"datePublished\":\"2025-02-10T11:00:53+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/17aitech.com\\\/#\\\/schema\\\/person\\\/60225458499e817ae0af73e67e440b9d\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/17aitech.com\\\/?p=38130#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/17aitech.com\\\/?p=38130\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\\\/\\\/17aitech.com\\\/?p=38130#primaryimage\",\"url\":\"https:\\\/\\\/17aitech.com\\\/wp-content\\\/uploads\\\/2025\\\/02\\\/frc-e70b29c60749a15fc1e280bba4579db9.png\",\"contentUrl\":\"https:\\\/\\\/17aitech.com\\\/wp-content\\\/uploads\\\/2025\\\/02\\\/frc-e70b29c60749a15fc1e280bba4579db9.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/17aitech.com\\\/?p=38130#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\\\/\\\/17aitech.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"DeepSeek\u7528\u7684GRPO\u5360\u7528\u5927\u91cf\u5185\u5b58\uff1f\u6709\u4eba\u7ed9\u51fa\u4e86\u4e9b\u7834\u89e3\u65b9\u6cd5\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/17aitech.com\\\/#website\",\"url\":\"https:\\\/\\\/17aitech.com\\\/\",\"name\":\"\u4e00\u8d77AI\u6280\u672f\",\"description\":\"\u8ba9AI\u77e5\u8bc6\u89e6\u624b\u53ef\u53ca\",\"alternateName\":\"\u4e00\u8d77AI\u6280\u672f\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/17aitech.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/17aitech.com\\\/#\\\/schema\\\/person\\\/60225458499e817ae0af73e67e440b9d\",\"name\":\"AI\u5c0f\u52a9\u624b\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"\\\/\\\/17aitech.com\\\/wp-content\\\/uploads\\\/2024\\\/04\\\/robot_3.png\",\"url\":\"\\\/\\\/17aitech.com\\\/wp-content\\\/uploads\\\/2024\\\/04\\\/robot_3.png\",\"contentUrl\":\"\\\/\\\/17aitech.com\\\/wp-content\\\/uploads\\\/2024\\\/04\\\/robot_3.png\",\"caption\":\"AI\u5c0f\u52a9\u624b\"},\"description\":\"\u8fd9\u4e2a\u4eba\u5f88\u61d2\uff0c\u4ec0\u4e48\u90fd\u6ca1\u6709\u7559\u4e0b\uff5e\",\"url\":\"https:\\\/\\\/17aitech.com\\\/?page_id=33738&user=3\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"DeepSeek\u7528\u7684GRPO\u5360\u7528\u5927\u91cf\u5185\u5b58\uff1f\u6709\u4eba\u7ed9\u51fa\u4e86\u4e9b\u7834\u89e3\u65b9\u6cd5 - \u4e00\u8d77AI\u6280\u672f","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/17aitech.com\/?p=38130","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/17aitech.com\/?p=38130#article","isPartOf":{"@id":"https:\/\/17aitech.com\/?p=38130"},"author":{"name":"AI\u5c0f\u52a9\u624b","@id":"https:\/\/17aitech.com\/#\/schema\/person\/60225458499e817ae0af73e67e440b9d"},"headline":"DeepSeek\u7528\u7684GRPO\u5360\u7528\u5927\u91cf\u5185\u5b58\uff1f\u6709\u4eba\u7ed9\u51fa\u4e86\u4e9b\u7834\u89e3\u65b9\u6cd5","datePublished":"2025-02-10T11:00:53+00:00","mainEntityOfPage":{"@id":"https:\/\/17aitech.com\/?p=38130"},"wordCount":167,"commentCount":0,"image":{"@id":"https:\/\/17aitech.com\/?p=38130#primaryimage"},"thumbnailUrl":"https:\/\/17aitech.com\/wp-content\/uploads\/2025\/02\/frc-e70b29c60749a15fc1e280bba4579db9.png","keywords":["RAG","\u5927\u6a21\u578b"],"articleSection":["\u884c\u4e1a\u8d44\u8baf"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/17aitech.com\/?p=38130#respond"]}]},{"@type":"WebPage","@id":"https:\/\/17aitech.com\/?p=38130","url":"https:\/\/17aitech.com\/?p=38130","name":"DeepSeek\u7528\u7684GRPO\u5360\u7528\u5927\u91cf\u5185\u5b58\uff1f\u6709\u4eba\u7ed9\u51fa\u4e86\u4e9b\u7834\u89e3\u65b9\u6cd5 - \u4e00\u8d77AI\u6280\u672f","isPartOf":{"@id":"https:\/\/17aitech.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/17aitech.com\/?p=38130#primaryimage"},"image":{"@id":"https:\/\/17aitech.com\/?p=38130#primaryimage"},"thumbnailUrl":"https:\/\/17aitech.com\/wp-content\/uploads\/2025\/02\/frc-e70b29c60749a15fc1e280bba4579db9.png","datePublished":"2025-02-10T11:00:53+00:00","author":{"@id":"https:\/\/17aitech.com\/#\/schema\/person\/60225458499e817ae0af73e67e440b9d"},"breadcrumb":{"@id":"https:\/\/17aitech.com\/?p=38130#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/17aitech.com\/?p=38130"]}]},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/17aitech.com\/?p=38130#primaryimage","url":"https:\/\/17aitech.com\/wp-content\/uploads\/2025\/02\/frc-e70b29c60749a15fc1e280bba4579db9.png","contentUrl":"https:\/\/17aitech.com\/wp-content\/uploads\/2025\/02\/frc-e70b29c60749a15fc1e280bba4579db9.png"},{"@type":"BreadcrumbList","@id":"https:\/\/17aitech.com\/?p=38130#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/17aitech.com\/"},{"@type":"ListItem","position":2,"name":"DeepSeek\u7528\u7684GRPO\u5360\u7528\u5927\u91cf\u5185\u5b58\uff1f\u6709\u4eba\u7ed9\u51fa\u4e86\u4e9b\u7834\u89e3\u65b9\u6cd5"}]},{"@type":"WebSite","@id":"https:\/\/17aitech.com\/#website","url":"https:\/\/17aitech.com\/","name":"\u4e00\u8d77AI\u6280\u672f","description":"\u8ba9AI\u77e5\u8bc6\u89e6\u624b\u53ef\u53ca","alternateName":"\u4e00\u8d77AI\u6280\u672f","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/17aitech.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/17aitech.com\/#\/schema\/person\/60225458499e817ae0af73e67e440b9d","name":"AI\u5c0f\u52a9\u624b","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"\/\/17aitech.com\/wp-content\/uploads\/2024\/04\/robot_3.png","url":"\/\/17aitech.com\/wp-content\/uploads\/2024\/04\/robot_3.png","contentUrl":"\/\/17aitech.com\/wp-content\/uploads\/2024\/04\/robot_3.png","caption":"AI\u5c0f\u52a9\u624b"},"description":"\u8fd9\u4e2a\u4eba\u5f88\u61d2\uff0c\u4ec0\u4e48\u90fd\u6ca1\u6709\u7559\u4e0b\uff5e","url":"https:\/\/17aitech.com\/?page_id=33738&user=3"}]}},"_links":{"self":[{"href":"https:\/\/17aitech.com\/index.php?rest_route=\/wp\/v2\/posts\/38130","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/17aitech.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/17aitech.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/17aitech.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/17aitech.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=38130"}],"version-history":[{"count":0,"href":"https:\/\/17aitech.com\/index.php?rest_route=\/wp\/v2\/posts\/38130\/revisions"}],"wp:attachment":[{"href":"https:\/\/17aitech.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=38130"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/17aitech.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=38130"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/17aitech.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=38130"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}