Code Velocity
Инструменты для разработчиков

SageMaker AI: Ускорение вызова инструментов агентом с помощью бессерверной кастомизации

·5 мин чтения·AWS·Первоисточник
Поделиться
Интерфейс Amazon SageMaker AI Studio, показывающий опции для бессерверной кастомизации модели и вызова инструментов агентом.
{
  "prompt": [
    {"role": "system", "content": "Вы полезный помощник. При использовании инструментов отвечайте: [...]"},
    {"role": "user", "content": "Покажи погоду"}
  ],
  "reward_model": {
    "ground_truth": "Чтобы предоставить вам информацию о погоде, пожалуйста, укажите местоположение?"
  }
}

Дообучение Qwen 2.5 7B Instruct с помощью SageMaker AI

Процесс дообучения модели, такой как Qwen 2.5 7B Instruct, в Amazon SageMaker AI Studio упрощен и интуитивно понятен. После выполнения необходимых предварительных условий (учетная запись AWS, роль IAM, домен SageMaker AI, корзина S3) пользователи могут перейти в раздел Модели в SageMaker AI Studio.

Оттуда, выбрав Qwen 2.5 7B Instruct и затем Настроить с помощью UI, откроется специальная страница конфигурации. Этот интерфейс позволяет:

  • Выбор метода: Явный выбор обучения с подкреплением с проверяемыми вознаграждениями (RLVR) из выпадающего списка.
  • Ввод данных: Указание на подготовленные обучающие данные, хранящиеся в корзине Amazon S3.
  • Функция вознаграждения: Настройка многоуровневого механизма оценки, который определяет, как оцениваются кандидатские ответы по отношению к ground_truth.
  • Конфигурация гиперпараметров: Настройка параметров, таких как размер пакета, хотя SageMaker AI часто автоматически обрабатывает оптимальные настройки.

SageMaker AI поддерживает широкий спектр семейств моделей, включая Amazon Nova, GPT-OSS, Llama, Qwen и DeepSeek, а также различные методы, такие как обучение с учителем (SFT), оптимизация прямых предпочтений (DPO), RLVR и обучение с подкреплением на основе обратной связи ИИ (RLAIF). Интегрированное отслеживание MLflow обеспечивает видимость метрик обучения и валидации, упрощая мониторинг производительности и итерации. Эта простота использования значительно ускоряет жизненный цикл разработки для разработчиков, создающих сложные github-agentic-workflows.

Оценка и успех развертывания

Эффективность нашей дообученной модели Qwen 2.5 7B Instruct была тщательно оценена на отложенных данных, включая сценарии с полностью неизвестными инструментами — критический тест на обобщение. Результаты были убедительными: дообученная модель достигла замечательного улучшения на 57% в вознаграждении за вызов инструмента по сравнению с базовой моделью. Этот значительный скачок производительности в сценариях, с которыми она не сталкивалась во время обучения, подчеркивает мощь RLVR в обучении моделей надежным способностям принятия решений для взаимодействия с инструментами.

Эта повышенная надежность напрямую трансформируется в более высокое доверие при развертывании агентов ИИ в производственных средах. Сводя к минимуму случаи галлюцинаций инструментов, некорректных параметров и ненадлежащих действий, предприятия могут использовать агентов ИИ для более критически важных и чувствительных задач. Благодаря SageMaker AI, управляющему сложностями развертывания модели и управления инфраструктурой, разработчики могут беспрепятственно переходить от дообучения к производству, реализуя весь потенциал своих агентных решений ИИ. Эта возможность соответствует более широкой концепции операционализации агентного ИИ для реального воздействия.

В заключение, комбинация бессерверной кастомизации модели Amazon SageMaker AI и надежных возможностей обучения RLVR предоставляет мощный путь к созданию высоконадежных систем вызова инструментов агентом. Этот инновационный подход ускоряет разработку, снижает операционные издержки и в конечном итоге предоставляет агентов ИИ, которые работают с беспрецедентной точностью и надежностью.

Часто задаваемые вопросы

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.

Будьте в курсе

Получайте последние новости ИИ на почту.

Поделиться