全景路径

AWS SageMaker多轮RL微调搜索代理

Fine-tuning teaches a small search agent your tools and environment, giving it the reliability of a frontier model at lower latency and cost. In this post, we fine-tune an LLM-powe

가이드 목록 · 본문은 주로 중국어 간체입니다. 영문 요약(English summary)을 참고하세요.

AWS SageMaker多轮RL微调搜索代理

Fine-tuning teaches a small search agent your tools and environment, giving it the reliability of a frontier model at lower latency and cost. In this post, we fine-tune an LLM-powered search agent using Amazon SageMaker AI multi-turn reinforcement learning (MTRL).

Who applies this? Enterprises building autonomous search agents that handle multi-hop queries across tools like BM25 lexical search and vector similarity, or any team needing reliable, cost-effective agentic behavior without frontier-model expense.

How to decide: Choose SageMaker MTRL when single-turn RL or supervised fine-tuning fails on interdependent multi-turn decisions; the trajectory-level reward captures full search sequences for better nDCG@10 and failure-rate reduction.

什么是AWS SageMaker AI多轮RL微调

Amazon SageMaker AI MTRL 是服务器端的多轮强化学习服务,可直接对LLM进行代理任务微调。

它将代理任务建模为决策序列,通过多轮rollout生成训练数据,并使用策略梯度算法优化模型。

核心优势包括:模块化代理-环境接口、低代码工具调用、异步rollout支持、原生PPO/CISPO算法库、恢复训练、轨迹可观测性以及评估作业。

这对搜索代理特别适用——奖励信号来自检索质量,多轮交互循环定义清晰,环境为搜索工具集。

准备环境与数据集

在AWS账户(us-west-2区域)中准备以下资源:

  • 启用Amazon SageMaker AI,创建带BM25和向量搜索工具的代理端点。
  • 将训练/验证数据集上传至S3,格式符合MTRL要求(包含prompt、response和完整轨迹)。
  • 参考官方数据集:FRAMES、BRIGHT、Enterprise RAG、ESCI、Musique、MLQA用于训练,FreshStack、WixQA、BrowseComp-Plus、Wands用于测试。

训练配置与运行

启动MultiTurnRLTrainer:


from sagemaker.modules.train import MultiTurnRLTrainer



trainer = MultiTurnRLTrainer(

 model_id="qwen3.6-27b",

 agent_endpoint="your-agent-endpoint",

 training_dataset_s3_uri="s3://your-bucket/datasets/train/",

 validation_dataset_s3_uri="s3://your-bucket/datasets/validation/",

 hyperparameters={

 "max_epochs": 1,

 "global_batch_size": 128,

 "rollout_max_concurrency": 32,

 },

 output_s3_uri="s3://your-bucket/output/",

)



trainer.train

主要调整的参数:max_epochs(训练轮次)、global_batch_size(批次大小)、rollout_max_concurrency(并行rollout数)。默认算法与优势估计器已足够。

效果与验证

在BrowseComp-Plus基准上nDCG@10提升23.7%,WixQA提升18.4%,BrowseComp-Plus失败率从22.89%降至0.68%。训练曲线显示奖励持续上升并收敛,验证集表现稳定。

完整运行曲线与基准数据见AWS官方博客。

延伸阅读

  • [AWS SageMaker MTRL官方文档]
  • [多轮RL资产创建指南]
  • [RooHome AI 价格雷达]

风险与边界

使用多轮RL微调搜索代理时,需注意资源成本(按Token计费)、数据隐私合规(AWS Region与合规标准匹配)及模型局限(非100%失败率消除)。这非法律意见,仅供参考。请以官方文档及AWS账户实际数据为准。