aws-solutions-library-samples/guidance-for-claude-code-with-amazon-bedrock/grpo-finetuning
Claude Code and agent skill by aws-solutions-library-samples/guidance-for-claude-code-with-amazon-bedrock
- community
Checking that the SKILL.md file is still in the repository.
Implement GRPO (Group Relative Policy Optimization) fine-tuning for vision-language models on small datasets. Use when SFT underperforms or training data is limited (<1000 examples).
Install
npx vskill@latest install aws-solutions-library-samples/guidance-for-claude-code-with-amazon-bedrock/grpo-finetuningSKILL.md
This skill guides implementation of GRPO fine-tuning for vision-language models, particularly effective when training data is limited. GRPO uses reinforcement learning with custom reward functions instead of traditional supervised fine-tuning.
When to Use GRPO vs SFT
| Scenario | Recommended Approach | |
|---|---|---|
| Large dataset (>5000 examples) | SFT (Supervised Fine-Tuning) | |
| Small dataset (<1000 examples) | GRPO | |
| Clear correctness criteria (JSON, format) | GRPO | |
| Subjective quality (style, tone) | SFT | |
| Need diversity in outputs | GRPO |
Core Concepts
GRPO generates multiple completions per prompt, scores them with reward functions, and optimizes the policy to favor higher-reward outputs:
Implementation Pattern
1. Define Reward Functions
Create reward functions that return scores between 0 and 1 (or custom ranges):
2. Training Configuration
Key hyperparameters for GRPO (different from SFT):
3. Dataset Format
GRPO expects prompts and reference answers:
4. Trainer Setup
AWS Infrastructure
SageMaker Training Job
GRPO requires more VRAM than SFT due to multiple generations:
| Model Size | SFT Instance | GRPO Instance | |
|---|---|---|---|
| 7-8B | ml.g5.2xlarge (24GB) | ml.g5.4xlarge (48GB) or ml.p4d.24xlarge | |
| 13B | ml.g5.4xlarge | ml.p4d.24xlarge | |
| 70B | ml.p4d.24xlarge | ml.p5.48xlarge |
Docker Container
Security Note: The example below uses a mutable third-party image tag. For production use, you should:
- Pin to a specific version or image digest (e.g.,
@sha256:...) - Mirror the image to your own registry (e.g., Amazon ECR)
- Scan the image for vulnerabilities before use
For maximum security, mirror the image to your own ECR registry:
Training Time Estimation
GRPO is slower than SFT due to generation overhead:
For 1000 examples: ~45-55 hours on ml.p4d.24xlarge
Common Issues
1. OOM During Generation
Symptom: Exit code 139 (SIGSEGV) Fix: Reduce num_generations or max_completion_length, or use larger instance
2. Zero Rewards
Symptom: reward_std: 0.0 in logs Fix: Reward functions may be too strict; add partial credit
3. No Learning Signal
Symptom: loss: 0.0 throughout training Fix: Ensure reward variance between generations; check frac_reward_zero_std
Success Metrics
Monitor these in CloudWatch/logs:
reward/mean: Should increase over trainingreward_std: Non-zero indicates learning signalcompletions/clipped_ratio: High ratio suggests max_length too shortkl: Should stay small (policy not diverging too far)
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingassets/claude-code-plugins/plugins/ml-training/skills/grpo-finetuning/SKILL.md
Popularity
- Repository stars
- 179
- Repository forks
- 69
- 7-day trend score
- 26
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 21 Mar 2026, 7 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/aws-solutions-library-samples/guidance-for-claude-code-with-amazon-bedrock/grpo-finetuning)