Code Velocity
Công cụ nhà phát triển

SageMaker AI: Tăng tốc gọi công cụ tác nhân với tùy chỉnh mô hình phi máy chủ

·5 phút đọc·AWS·Nguồn gốc
Chia sẻ
Giao diện Amazon SageMaker AI Studio hiển thị các tùy chọn tùy chỉnh mô hình phi máy chủ và gọi công cụ tác nhân.
{
  "prompt": [
    {"role": "system", "content": "You are a helpful assistant. When using tools, respond with: [...]"},
    {"role": "user", "content": "Get the weather"}
  ],
  "reward_model": {
    "ground_truth": "To provide you with the weather information, could you please specify the location?"
  }
}

Tinh chỉnh Qwen 2.5 7B Instruct với SageMaker AI

Quá trình tinh chỉnh một mô hình như Qwen 2.5 7B Instruct trong Amazon SageMaker AI Studio được sắp xếp hợp lý và trực quan. Sau khi đảm bảo các điều kiện tiên quyết cần thiết (tài khoản AWS, vai trò IAM, miền SageMaker AI, nhóm S3) được đáp ứng, người dùng có thể điều hướng đến phần Models trong SageMaker AI Studio.

Từ đó, chọn Qwen 2.5 7B Instruct và chọn Customize with UI sẽ mở ra một trang cấu hình chuyên dụng. Giao diện này cho phép:

  • Lựa chọn kỹ thuật: Chọn rõ ràng Học tăng cường với phần thưởng có thể xác minh (RLVR) từ menu thả xuống.
  • Đầu vào dữ liệu: Trỏ đến dữ liệu huấn luyện đã chuẩn bị được lưu trữ trong một nhóm Amazon S3.
  • Hàm phần thưởng: Cấu hình cơ chế chấm điểm theo cấp độ xác định cách các phản hồi ứng cử viên được đánh giá dựa trên ground_truth.
  • Cấu hình siêu tham số: Điều chỉnh các tham số như kích thước lô, mặc dù SageMaker AI thường tự động xử lý các cài đặt tối ưu.

SageMaker AI hỗ trợ một loạt các họ mô hình đa dạng, bao gồm Amazon Nova, GPT-OSS, Llama, QwenDeepSeek, cùng với nhiều kỹ thuật khác nhau như Tinh chỉnh có giám sát (SFT), Tối ưu hóa ưu tiên trực tiếp (DPO), RLVR và Học tăng cường từ phản hồi của AI (RLAIF). Theo dõi MLflow tích hợp cung cấp khả năng hiển thị các số liệu huấn luyện và xác thực, đơn giản hóa việc giám sát hiệu suất và lặp lại. Sự dễ sử dụng này tăng tốc đáng kể chu kỳ phát triển cho các nhà phát triển xây dựng các github-agentic-workflows phức tạp.

Đánh giá và Thành công triển khai

Hiệu quả của mô hình Qwen 2.5 7B Instruct đã được tinh chỉnh của chúng tôi được đánh giá nghiêm ngặt trên dữ liệu được giữ lại, bao gồm các kịch bản với các công cụ chưa từng thấy—một thử nghiệm quan trọng để tổng quát hóa. Kết quả rất thuyết phục: mô hình đã tinh chỉnh đạt được sự cải thiện đáng kể 57% về phần thưởng gọi công cụ so với mô hình cơ bản. Bước nhảy vọt đáng kể về hiệu suất trên các kịch bản mà nó chưa gặp trong quá trình huấn luyện này nhấn mạnh sức mạnh của RLVR trong việc dạy các mô hình khả năng ra quyết định mạnh mẽ cho tương tác công cụ.

Độ tin cậy được nâng cao này trực tiếp chuyển thành lòng tin và sự tự tin cao hơn trong việc triển khai tác nhân AI vào môi trường sản xuất. Bằng cách giảm thiểu các trường hợp công cụ bị ảo giác, tham số không chính xác và hành động không phù hợp, các doanh nghiệp có thể tận dụng các tác nhân AI cho các tác vụ quan trọng và nhạy cảm hơn. Với SageMaker AI xử lý sự phức tạp của triển khai mô hìnhquản lý cơ sở hạ tầng, các nhà phát triển có thể chuyển đổi liền mạch từ tinh chỉnh sang sản xuất, hiện thực hóa toàn bộ tiềm năng của các giải pháp AI tác nhân của họ. Khả năng này phù hợp với tầm nhìn rộng lớn hơn về vận hành AI tác nhân để tạo ra tác động trong thế giới thực.

Tóm lại, sự kết hợp giữa tùy chỉnh mô hình phi máy chủ của Amazon SageMaker AI và khả năng học mạnh mẽ của RLVR cung cấp một con đường mạnh mẽ để xây dựng các hệ thống gọi công cụ tác nhân có độ tin cậy cao. Cách tiếp cận đổi mới này tăng tốc phát triển, giảm gánh nặng vận hành và cuối cùng mang lại các tác nhân AI hoạt động với độ chính xác và đáng tin cậy chưa từng có.

Câu hỏi thường gặp

What is agentic tool calling and why is it crucial for AI agents?
Agentic tool calling is the mechanism that empowers AI agents to perform real-world actions like querying databases, initiating workflows, fetching real-time information, and executing tasks on a user's behalf. It's crucial because it bridges the gap between language understanding and practical application, allowing AI agents to move beyond just generating text to actually interacting with external systems and data sources, thereby making them genuinely useful in production environments.
What are the common challenges AI agents face when performing tool calls?
AI agents frequently encounter challenges such as hallucinating tools that don't exist, passing incorrect parameters to valid tools, or attempting actions when they should instead seek clarification from the user. These failures lead to unreliable agent behavior, eroding user trust and posing significant hurdles to the successful deployment of AI agents in critical production systems, ultimately limiting their real-world utility.
How does Amazon SageMaker AI address the challenges of agentic tool calling?
Amazon SageMaker AI addresses these challenges through its serverless model customization capabilities, particularly using Reinforcement Learning with Verifiable Rewards (RLVR). This approach allows developers to fine-tune large language models (LLMs) to improve their tool-calling accuracy without managing complex infrastructure. SageMaker AI handles the operational overhead of GPU provisioning, memory management, and reward infrastructure, letting users focus on data, reward functions, and model behavior.
What is Reinforcement Learning with Verifiable Rewards (RLVR) and how does it work?
RLVR is a powerful fine-tuning technique where the model generates multiple candidate responses for a given prompt. A predefined reward function then evaluates these candidates, providing a signal about their quality and correctness. The model subsequently updates its internal policy to favor responses that received higher reward scores, using methods like Group Relative Policy Optimization (GRPO), thereby iteratively learning to produce more accurate and desired outputs for specific tasks like tool calling.
Why is RLVR considered more effective than Supervised Fine-Tuning (SFT) for tool calling tasks?
While SFT requires meticulously labeled examples for every desired behavior (e.g., calling a tool, clarifying, refusing), RLVR operates differently. SFT can struggle to generalize decision-making between these behaviors. RLVR, by contrast, allows the model to learn the optimal decision boundary by generating multiple candidates and receiving immediate feedback via a reward function, enabling it to better understand *when* to execute a tool call versus *when* to ask for more information or refuse a request.
How is training data prepared for RLVR in Amazon SageMaker AI for agentic tool calling?
Training data for RLVR in SageMaker AI is prepared as JSONL files, where each entry contains a prompt (system and user messages) and a `ground_truth` within a `reward_model` field. This `ground_truth` is what the reward function scores against. To ensure robust agent behavior, datasets are typically designed to cover three distinct scenarios: executing a tool call when all parameters are present, clarifying when information is missing, and refusing requests that are out of scope or harmful. Synthetic data generation tools like Kiro can be used for this purpose.
What agent behaviors are critical for building robust and reliable tool-calling AI agents?
Building robust tool-calling AI agents requires them to master three critical behaviors. First, they must `Execute` a tool call accurately when all necessary information is provided by the user. Second, they need to `Clarify` by asking follow-up questions when essential parameters are missing from a user's request. Third, they must `Refuse` gracefully when a request is out of scope, harmful, or cannot be fulfilled. Training models across these behaviors ensures comprehensive and trustworthy agent performance.
What prerequisites are needed to use serverless model customization in SageMaker AI?
To leverage serverless model customization in Amazon SageMaker AI, users must have an active AWS account, an AWS IAM role configured with the necessary permissions for SageMaker, a SageMaker AI domain providing Studio access for development, and an Amazon Simple Storage Service (Amazon S3) bucket to store training data and model outputs securely. These components ensure a secure and functional environment for fine-tuning models.

Cập nhật tin tức

Nhận tin tức AI mới nhất qua email.

Chia sẻ