{"id":3697,"date":"2025-07-17T22:15:01","date_gmt":"2025-07-17T14:15:01","guid":{"rendered":"https:\/\/www.15zhi.net\/blog\/?p=3697"},"modified":"2025-07-17T22:15:01","modified_gmt":"2025-07-17T14:15:01","slug":"202507-%e8%ae%ba%e6%96%87%e7%a0%94%e8%af%bb-prompt-optimization-viaadversarial-in-context-learning","status":"publish","type":"post","link":"https:\/\/www.15zhi.net\/blog\/202507-%e8%ae%ba%e6%96%87%e7%a0%94%e8%af%bb-prompt-optimization-viaadversarial-in-context-learning\/","title":{"rendered":"202507 \u8bba\u6587\u7814\u8bfb&#8211;Prompt Optimization viaAdversarial In-Context Learning"},"content":{"rendered":"\n<p>\u4f5c\u8005\uff1aXuan Long Do \u7b49<br>\u5355\u4f4d\uff1a\u65b0\u52a0\u5761\u56fd\u7acb\u5927\u5b66\u3001\u9999\u6e2f\u79d1\u6280\u5927\u5b66\u3001\u65b0\u52a0\u5761A*STAR<br>\u6765\u6e90\uff1aACL 2024 Long Paper<br>\u65f6\u95f4\uff1a202408<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u7814\u7a76\u80cc\u666f\u4e0e\u52a8\u673a<\/h2>\n\n\n\n<p>In-Context Learning (ICL) \u8ba9 LLM \u80fd\u901a\u8fc7\u793a\u4f8b\u5b8c\u6210\u4efb\u52a1\uff0c\u4f46\u5bf9 prompt \u6781\u5ea6\u654f\u611f\u3002<br>\u2022 \u73b0\u6709\u4f18\u5316\u65b9\u6cd5\u4f9d\u8d56\u76d1\u7763\u4fe1\u53f7\uff0c\u4f18\u5316\u76ee\u6807\u5355\u4e00\u3001\u65e0\u5bf9\u6297\u6027\uff0c\u6cdb\u5316\u6027\u8f83\u5f31\u3002<br>\u2022 \u672c\u6587\u52a8\u673a\uff1a\u5f15\u5165 adversarial learning\uff08\u5bf9\u6297\u535a\u5f08\uff09\u4f18\u5316\u63d0\u793a\uff0c\u63d0\u5347 ICL \u8868\u73b0\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">adv-ICL \u5bf9\u6297\u6027\u4e0a\u4e0b\u6587\u5b66\u4e60<\/h2>\n\n\n\n<p>\u4e09\u6a21\u5757\u535a\u5f08\uff08Generator G\uff0cDiscriminator D\uff0cPrompt Modifier M\uff09\uff1a<br>G \u751f\u6210\u54cd\u5e94\uff1bD \u5224\u65ad\u662f\u5426\u4e3a\u201c\u771f\u5b9e\u201d\u6570\u636e\uff1bM \u4fee\u6539 G\/D \u7684 prompt \u4ee5\u63d0\u5347\u5bf9\u6297\u76ee\u6807<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"865\" height=\"220\" src=\"https:\/\/www.15zhi.net\/blog\/wp-content\/uploads\/2025\/07\/image-20.png\" alt=\"\" class=\"wp-image-3698\" srcset=\"https:\/\/www.15zhi.net\/blog\/wp-content\/uploads\/2025\/07\/image-20.png 865w, https:\/\/www.15zhi.net\/blog\/wp-content\/uploads\/2025\/07\/image-20-300x76.png 300w, https:\/\/www.15zhi.net\/blog\/wp-content\/uploads\/2025\/07\/image-20-768x195.png 768w\" sizes=\"auto, (max-width: 865px) 100vw, 865px\" \/><\/figure>\n\n\n\n<p>\u6b65\u9aa4 1\uff1aG \u4f7f\u7528 prompt \u751f\u6210\u8f93\u51fa<br>\u6b65\u9aa4 2\uff1aD \u5224\u522b\u8be5\u8f93\u51fa\u662f\u751f\u6210\u7684\u8fd8\u662f\u4eba\u7c7b\u6837\u672c<br>\u6b65\u9aa4 3\uff1aM \u751f\u6210\u82e5\u5e72\u53d8\u4f53\uff0c\u9009\u62e9\u80fd\u6700\u4f18\u5316 adversarial loss \u7684\u7248\u672c\u66f4\u65b0 G\/D \u7684 prompt<br>\u2022 \u5168\u6d41\u7a0b\u4e3a\u6700\u5c0f\u5316 G \u751f\u6210\u7684\u88ab\u8bc6\u522b\u6982\u7387 + \u6700\u5927\u5316 D \u5224\u522b\u80fd\u529b\u7684\u5bf9\u6297\u8fc7\u7a0b<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u751f\u6210\u5668<\/h2>\n\n\n\n<p>\u521d\u59cb prompt U\uff1a<br>G \u4f7f\u7528\u7684 instruction + demonstrations<\/p>\n\n\n\n<p>\u6a21\u578b\u6839\u636e\u8f93\u5165\u4e0eprompt\u751f\u6210\u54cd\u5e94\uff0c\u751f\u6210\u5668\u7684\u8f93\u5165\u8f93\u51fa\u5bf9\u5c31\u662f\u4f2a\u9020\u6837\u672c\u5bf9\uff0c\u5c06\u4ea4\u7ed9\u5224\u522b\u5668\u8fdb\u884c\u5224\u522b\u3002<br>\u76ee\u6807\u662f\u8ba9\u5224\u522b\u5668\u65e0\u6cd5\u5224\u522b\u51fa\u8fd9\u662f\u6a21\u578b\u751f\u6210\u7684\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5224\u522b\u5668<\/h2>\n\n\n\n<p>\u521d\u59cb prompt V\uff1a<br>D \u4f7f\u7528\u7684 instruction + (x, y, label) \u793a\u4f8b<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"457\" height=\"344\" src=\"https:\/\/www.15zhi.net\/blog\/wp-content\/uploads\/2025\/07\/image-21.png\" alt=\"\" class=\"wp-image-3699\" srcset=\"https:\/\/www.15zhi.net\/blog\/wp-content\/uploads\/2025\/07\/image-21.png 457w, https:\/\/www.15zhi.net\/blog\/wp-content\/uploads\/2025\/07\/image-21-300x226.png 300w\" sizes=\"auto, (max-width: 457px) 100vw, 457px\" \/><\/figure>\n\n\n\n<p>\u63a5\u6536\u771f\u5b9e\u6837\u672c\u5bf9\u548c\u4f2a\u9020\u6837\u672c\u5bf9\uff08\u751f\u6210\u5668\u7684\u8f93\u5165\u4e0e\u8f93\u51fa\u5bf9\uff09\u3002<br>\u5224\u522b\u5668\u9488\u5bf9\u8fd9\u4e24\u7c7b\u6837\u672c\u5bf9\u7ed9\u51fa\u4e8c\u5206\u7c7b\u6807\u7b7e\u6216\u8005\u771f\u5047\u7684\u6982\u7387\u3002<br>\u76ee\u6807\u662f\u6781\u5927\u53ef\u80fd\u5224\u65ad\u51fa\u4f2a\u9020\u6837\u672c\u5bf9\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4fee\u6539\u5668<\/h2>\n\n\n\n<p>\u5e76\u6ca1\u6709\u68af\u5ea6\uff0c\u800c\u662f\u7528 LLM \u751f\u6210\u5019\u9009 prompt\uff0c\u901a\u8fc7\u201c\u5bf9\u6297\u635f\u5931\u201d\u6765\u9009\u62e9\u54ea\u4e00\u4e2a\u66f4\u6709\u6548\u6b3a\u9a97 D\uff0c\u4ece\u800c\u95f4\u63a5\u4f18\u5316 prompt\u3002<br>\u5bf9\u6bcf\u4e2a\u53d8\u4f53 prompt \uff0c\u90fd\u653e\u5165 G \u7684 prompt \u2192 \u8fd0\u884c G + D \uff0c\u8ba1\u7b97 adversarial loss\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"537\" height=\"53\" src=\"https:\/\/www.15zhi.net\/blog\/wp-content\/uploads\/2025\/07\/image-22.png\" alt=\"\" class=\"wp-image-3700\" style=\"width:537px;height:auto\" srcset=\"https:\/\/www.15zhi.net\/blog\/wp-content\/uploads\/2025\/07\/image-22.png 537w, https:\/\/www.15zhi.net\/blog\/wp-content\/uploads\/2025\/07\/image-22-300x30.png 300w\" sizes=\"auto, (max-width: 537px) 100vw, 537px\" \/><\/figure>\n\n\n\n<p>\u7528loss\u6392\u5e8f\uff0c\u7136\u540e\u9009\u53d6\u4f7fJi\u503c\u6700\u5927\u7684 prompt \u4f5c\u4e3a\u65b0\u7684 G\/D prompt\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5b9e\u9a8c<\/h2>\n\n\n\n<p>\u6a21\u578b\uff1aChatGPT, text-davinci-002, Vicuna-13B<br>\u2022 \u6570\u636e\u96c6\uff1a13 \u4e2a\u4efb\u52a1\uff0c\u542b GSM8K, MMLU, BBH, Yelp, WebNLG \u7b49<br>\u2022 \u63d0\u5347\u663e\u8457\uff1a\u5728 GSM8K \u4e0a\u63d0\u5347 +2.4%\uff1bMMLU \u63d0\u5347 +3%\uff1bBBH \u63d0\u5347 +2.4%<br>\u2022 \u5c11\u6837\u672c\u8868\u73b0\u826f\u597d\uff1a\u6bcf\u8f6e\u4ec5\u9700 5 \u6761\u6837\u672c\uff0c\u8fed\u4ee3 3 \u6b21\u5373\u53ef\u4f18\u5316<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"612\" height=\"322\" src=\"https:\/\/www.15zhi.net\/blog\/wp-content\/uploads\/2025\/07\/image-23.png\" alt=\"\" class=\"wp-image-3701\" srcset=\"https:\/\/www.15zhi.net\/blog\/wp-content\/uploads\/2025\/07\/image-23.png 612w, https:\/\/www.15zhi.net\/blog\/wp-content\/uploads\/2025\/07\/image-23-300x158.png 300w\" sizes=\"auto, (max-width: 612px) 100vw, 612px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u6838\u5fc3\u5185\u5bb9\u603b\u7ed3\u4e0e\u601d\u8003<\/h2>\n\n\n\n<p>\u6838\u5fc3\u5185\u5bb9\u603b\u7ed3\uff1a<br>\u5f15\u5165 adversarial loss \u4f18\u5316 discrete prompt \u7684\u65b9\u6cd5\u3002\u5bf9\u6297\u673a\u5236\u5b9e\u73b0\u65e0\u8bad\u7ec3\u7684 prompt \u4f18\u5316\uff0c\u9002\u914d\u4efb\u52a1\u5e7f\u6cdb\u3001\u6548\u679c\u7a33\u5b9a<br>\u9002\u914d\u5f00\u6e90\/\u95ed\u6e90 LLM\uff0c\u652f\u6301\u591a\u79cd\u4efb\u52a1\uff08\u751f\u6210\u3001\u63a8\u7406\u3001\u5206\u7c7b\uff09<br>\u65b9\u6cd5\u5728\u5f3a\u6cdb\u5316 prompt \u751f\u6210\u4e0a\u672a\u9a8c\u8bc1\uff0c\u5b9e\u9645\u90e8\u7f72\u9700\u8981 prompt \u89e3\u91ca\u63a7\u5236\u3002<br>\u601d\u8003\uff1a<br>\u4f9d\u8d56 M \u80fd\u751f\u6210\u9ad8\u8d28\u91cf prompt \u53d8\u4f53\uff1bD\/G \u9700\u6709\u5408\u7406\u6a21\u578b\u80fd\u529b\u5339\u914d\u3002<br>\u53ef\u4ee5\u4f7f\u7528Discriminator \u6a21\u5757\u4f5c\u4e3a\u63d0\u793a\u8d28\u91cf\u5224\u522b\u5668\u63d0\u5347 prompt \u7cbe\u5ea6\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f5c\u8005\uff1aXuan Long Do \u7b49\u5355\u4f4d\uff1a\u65b0\u52a0\u5761\u56fd\u7acb\u5927\u5b66\u3001\u9999\u6e2f\u79d1\u6280\u5927\u5b66\u3001\u65b0\u52a0\u5761A*STAR\u6765\u6e90\uff1aACL 2024 [&hellip;]<\/p>\n","protected":false},"author":66,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3697","post","type-post","status-publish","format-standard","hentry","category-events"],"_links":{"self":[{"href":"https:\/\/www.15zhi.net\/blog\/wp-json\/wp\/v2\/posts\/3697","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.15zhi.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.15zhi.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.15zhi.net\/blog\/wp-json\/wp\/v2\/users\/66"}],"replies":[{"embeddable":true,"href":"https:\/\/www.15zhi.net\/blog\/wp-json\/wp\/v2\/comments?post=3697"}],"version-history":[{"count":1,"href":"https:\/\/www.15zhi.net\/blog\/wp-json\/wp\/v2\/posts\/3697\/revisions"}],"predecessor-version":[{"id":3736,"href":"https:\/\/www.15zhi.net\/blog\/wp-json\/wp\/v2\/posts\/3697\/revisions\/3736"}],"wp:attachment":[{"href":"https:\/\/www.15zhi.net\/blog\/wp-json\/wp\/v2\/media?parent=3697"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.15zhi.net\/blog\/wp-json\/wp\/v2\/categories?post=3697"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.15zhi.net\/blog\/wp-json\/wp\/v2\/tags?post=3697"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}