[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6GH8H28484ANKGE42WSFCBQ":3,"skill-same:01M6GH8H28484ANKGE42WSFCBQ":80},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":58,"commitSha":59,"skillDirectory":60,"forksCount":61,"repositoryHtmlUrl":62,"repositoryHomepageUrl":6,"ownerHtmlUrl":63,"ownerBlogUrl":6,"ownerDescription":64,"updatedAt":65,"install":66,"resources":79},"01M6GH8H28484ANKGE42WSFCBQ","grpo-rl-training",null,"Expert guidance for GRPO\u002FRL fine-tuning with TRL for reasoning and task-specific model training","zapabob\u002FSkills","zapabob","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F130830376?v=4","01M6DBMYZAGRTFQDSQYW3W764P","峯岸 亮","01M6DBMZ3GKDSJ01NZ9XTZD7JD",2,"MIT","https:\u002F\u002Fgithub.com\u002Fzapabob\u002FSkills\u002Fblob\u002Fmain\u002Farchive\u002Fskill-md-reviewed\u002Fsha256\u002Ff8\u002Ff8326221ed9ae156572f5faf55b4b85557035bfc68efc0d2b26e7014b0bdd668\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"GRPO","grpo rl training","training","rl","model","output","Reward Modeling","TRL","structured output","modeling","task","expert","learning","tuning","Transformers","PPO","RLHF","Post-Training","DPO","Fine-Tuning","2026-11-10 10:12:30",false,"---\r\nname: grpo-rl-training\r\ndescription: Expert guidance for GRPO\u002FRL fine-tuning with TRL for reasoning and task-specific model training\r\nversion: 1.0.0\r\nauthor: Orchestra Research\r\nlicense: MIT\r\ndependencies: [transformers>=4.47.0, trl>=0.14.0, datasets>=3.2.0, peft>=0.14.0, torch]\r\nmetadata:\r\n  hermes:\r\n    tags: [Post-Training, Reinforcement Learning, GRPO, TRL, RLHF, Reward Modeling, Reasoning, DPO, PPO, Structured Output]\r\n\r\n---\r\n\r\n# GRPO\u002FRL Training with TRL\r\n\r\nExpert-level guidance for implementing Group Relative Policy Optimization (GRPO) using the Transformer Reinforcement Learning (TRL) library. This skill provides battle-tested patterns, critical insights, and production-ready workflows for fine-tuning language models with custom reward functions.\r\n\r\n## When to Use This Skill\r\n\r\nUse GRPO training when you need to:\r\n- **Enforce specific output formats** (e.g., XML tags, JSON, structured reasoning)\r\n- **Teach verifiable tasks** with objective correctness metrics (math, coding, fact-checking)\r\n- **Improve reasoning capabilities** by rewarding chain-of-thought patterns\r\n- **Align models to domain-specific behaviors** without labeled preference data\r\n- **Optimize for multiple objectives** simultaneously (format + correctness + style)\r\n\r\n**Do NOT use GRPO for:**\r\n- Simple supervised fine-tuning tasks (use SFT instead)\r\n- Tasks without clear reward signals\r\n- When you already have high-quality preference pairs (use DPO\u002FPPO instead)\r\n\r\n---\r\n\r\n## Core Concepts\r\n\r\n### 1. GRPO Algorithm Fundamentals\r\n\r\n**Key Mechanism:**\r\n- Generates **multiple completions** for each prompt (group size: 4-16)\r\n- Compares completions within each group using reward functions\r\n- Updates policy to favor higher-rewarded responses relative to the group\r\n\r\n**Critical Difference from PPO:**\r\n- No separate reward model needed\r\n- More sample-efficient (learns from within-group comparisons)\r\n- Simpler to implement and debug\r\n\r\n**Mathematical Intuition:**\r\n```\r\nFor each prompt p:\r\n  1. Generate N completions: {c₁, c₂, ..., cₙ}\r\n  2. Compute rewards: {r₁, r₂, ..., rₙ}\r\n  3. Learn to increase probability of high-reward completions\r\n     relative to low-reward ones in the same group\r\n```\r\n\r\n### 2. Reward Function Design Philosophy\r\n\r\n**Golden Rules:**\r\n1. **Compose multiple reward functions** - Each handles one aspect (format, correctness, style)\r\n2. **Scale rewards appropriately** - Higher weight = stronger signal\r\n3. **Use incremental rewards** - Partial credit for partial compliance\r\n4. **Test rewards independently** - Debug each reward function in isolation\r\n\r\n**Reward Function Types:**\r\n\r\n| Type | Use Case | Example Weight |\r\n|------|----------|----------------|\r\n| **Correctness** | Verifiable tasks (math, code) | 2.0 (highest) |\r\n| **Format** | Strict structure enforcement | 0.5-1.0 |\r\n| **Length** | Encourage verbosity\u002Fconciseness | 0.1-0.5 |\r\n| **Style** | Penalize unwanted patterns | -0.5 to 0.5 |\r\n\r\n---\r\n\r\n## Implementation Workflow\r\n\r\n### Step 1: Dataset Preparation\r\n\r\n**Critical Requirements:**\r\n- Prompts in chat format (list of dicts with 'role' and 'content')\r\n- Include system prompts to set expectations\r\n- For verifiable tasks, include ground truth answers as additional columns\r\n\r\n**Example Structure:**\r\n```python\r\nfrom datasets import load_dataset, Dataset\r\n\r\nSYSTEM_PROMPT = \"\"\"\r\nRespond in the following format:\r\n\u003Creasoning>\r\n[Your step-by-step thinking]\r\n\u003C\u002Freasoning>\r\n\u003Canswer>\r\n[Final answer]\r\n\u003C\u002Fanswer>\r\n\"\"\"\r\n\r\ndef prepare_dataset(raw_data):\r\n    \"\"\"\r\n    Transform raw data into GRPO-compatible format.\r\n\r\n    Returns: Dataset with columns:\r\n    - 'prompt': List[Dict] with role\u002Fcontent (system + user messages)\r\n    - 'answer': str (ground truth, optional but recommended)\r\n    \"\"\"\r\n    return raw_data.map(lambda x: {\r\n        'prompt': [\r\n            {'role': 'system', 'content': SYSTEM_PROMPT},\r\n            {'role': 'user', 'content': x['question']}\r\n        ],\r\n        'answer': extract_answer(x['raw_answer'])\r\n    })\r\n```\r\n\r\n**Pro Tips:**\r\n- Use one-shot or few-shot examples in system prompt for complex formats\r\n- Keep prompts concise (max_prompt_length: 256-512 tokens)\r\n- Validate data quality before training (garbage in = garbage out)\r\n\r\n### Step 2: Reward Function Implementation\r\n\r\n**Template Structure:**\r\n```python\r\ndef reward_function_name(\r\n    prompts,        # List[List[Dict]]: Original prompts\r\n    completions,    # List[List[Dict]]: Model generations\r\n    answer=None,    # Optional: Ground truth from dataset\r\n    **kwargs        # Additional dataset columns\r\n) -> list[float]:\r\n    \"\"\"\r\n    Evaluate completions and return rewards.\r\n\r\n    Returns: List of floats (one per completion)\r\n    \"\"\"\r\n    # Extract completion text\r\n    responses = [comp[0]['content'] for comp in completions]\r\n\r\n    # Compute rewards\r\n    rewards = []\r\n    for response in responses:\r\n        score = compute_score(response)\r\n        rewards.append(score)\r\n\r\n    return rewards\r\n```\r\n\r\n**Example 1: Correctness Reward (Math\u002FCoding)**\r\n```python\r\ndef correctness_reward(prompts, completions, answer, **kwargs):\r\n    \"\"\"Reward correct answers with high score.\"\"\"\r\n    responses = [comp[0]['content'] for comp in completions]\r\n    extracted = [extract_final_answer(r) for r in responses]\r\n    return [2.0 if ans == gt else 0.0\r\n            for ans, gt in zip(extracted, answer)]\r\n```\r\n\r\n**Example 2: Format Reward (Structured Output)**\r\n```python\r\nimport re\r\n\r\ndef format_reward(completions, **kwargs):\r\n    \"\"\"Reward XML-like structured format.\"\"\"\r\n    pattern = r'\u003Creasoning>.*?\u003C\u002Freasoning>\\s*\u003Canswer>.*?\u003C\u002Fanswer>'\r\n    responses = [comp[0]['content'] for comp in completions]\r\n    return [1.0 if re.search(pattern, r, re.DOTALL) else 0.0\r\n            for r in responses]\r\n```\r\n\r\n**Example 3: Incremental Format Reward (Partial Credit)**\r\n```python\r\ndef incremental_format_reward(completions, **kwargs):\r\n    \"\"\"Award partial credit for format compliance.\"\"\"\r\n    responses = [comp[0]['content'] for comp in completions]\r\n    rewards = []\r\n\r\n    for r in responses:\r\n        score = 0.0\r\n        if '\u003Creasoning>' in r:\r\n            score += 0.25\r\n        if '\u003C\u002Freasoning>' in r:\r\n            score += 0.25\r\n        if '\u003Canswer>' in r:\r\n            score += 0.25\r\n        if '\u003C\u002Fanswer>' in r:\r\n            score += 0.25\r\n        # Penalize extra text after closing tag\r\n        if r.count('\u003C\u002Fanswer>') == 1:\r\n            extra_text = r.split('\u003C\u002Fanswer>')[-1].strip()\r\n            score -= len(extra_text) * 0.001\r\n        rewards.append(score)\r\n\r\n    return rewards\r\n```\r\n\r\n**Critical Insight:**\r\nCombine 3-5 reward functions for robust training. Order matters less than diversity of signals.\r\n\r\n### Step 3: Training Configuration\r\n\r\n**Memory-Optimized Config (Small GPU)**\r\n```python\r\nfrom trl import GRPOConfig\r\n\r\ntraining_args = GRPOConfig(\r\n    output_dir=\"outputs\u002Fgrpo-model\",\r\n\r\n    # Learning rate\r\n    learning_rate=5e-6,          # Lower = more stable\r\n    adam_beta1=0.9,\r\n    adam_beta2=0.99,\r\n    weight_decay=0.1,\r\n    warmup_ratio=0.1,\r\n    lr_scheduler_type='cosine',\r\n\r\n    # Batch settings\r\n    per_device_train_batch_size=1,\r\n    gradient_accumulation_steps=4,  # Effective batch = 4\r\n\r\n    # GRPO-specific\r\n    num_generations=8,            # Group size: 8-16 recommended\r\n    max_prompt_length=256,\r\n    max_completion_length=512,\r\n\r\n    # Training duration\r\n    num_train_epochs=1,\r\n    max_steps=None,               # Or set fixed steps (e.g., 500)\r\n\r\n    # Optimization\r\n    bf16=True,                    # Faster on A100\u002FH100\r\n    optim=\"adamw_8bit\",          # Memory-efficient optimizer\r\n    max_grad_norm=0.1,\r\n\r\n    # Logging\r\n    logging_steps=1,\r\n    save_steps=100,\r\n    report_to=\"wandb\",            # Or \"none\" for no logging\r\n)\r\n```\r\n\r\n**High-Performance Config (Large GPU)**\r\n```python\r\ntraining_args = GRPOConfig(\r\n    output_dir=\"outputs\u002Fgrpo-model\",\r\n    learning_rate=1e-5,\r\n    per_device_train_batch_size=4,\r\n    gradient_accumulation_steps=2,\r\n    num_generations=16,           # Larger groups = better signal\r\n    max_prompt_length=512,\r\n    max_completion_length=1024,\r\n    num_train_epochs=1,\r\n    bf16=True,\r\n    use_vllm=True,                # Fast generation with vLLM\r\n    logging_steps=10,\r\n)\r\n```\r\n\r\n**Critical Hyperparameters:**\r\n\r\n| Parameter | Impact | Tuning Advice |\r\n|-----------|--------|---------------|\r\n| `num_generations` | Group size for comparison | Start with 8, increase to 16 if GPU allows |\r\n| `learning_rate` | Convergence speed\u002Fstability | 5e-6 (safe), 1e-5 (faster, riskier) |\r\n| `max_completion_length` | Output verbosity | Match your task (512 for reasoning, 256 for short answers) |\r\n| `gradient_accumulation_steps` | Effective batch size | Increase if GPU memory limited |\r\n\r\n### Step 4: Model Setup and Training\r\n\r\n**Standard Setup (Transformers)**\r\n```python\r\nimport torch\r\nfrom transformers import AutoModelForCausalLM, AutoTokenizer\r\nfrom peft import LoraConfig\r\nfrom trl import GRPOTrainer\r\n\r\n# Load model\r\nmodel_name = \"Qwen\u002FQwen2.5-1.5B-Instruct\"\r\nmodel = AutoModelForCausalLM.from_pretrained(\r\n    model_name,\r\n    torch_dtype=torch.bfloat16,\r\n    attn_implementation=\"flash_attention_2\",  # 2-3x faster\r\n    device_map=\"auto\"\r\n)\r\n\r\ntokenizer = AutoTokenizer.from_pretrained(model_name)\r\ntokenizer.pad_token = tokenizer.eos_token\r\n\r\n# Optional: LoRA for parameter-efficient training\r\npeft_config = LoraConfig(\r\n    r=16,                         # Rank (higher = more capacity)\r\n    lora_alpha=32,               # Scaling factor (typically 2*r)\r\n    target_modules=[\r\n        \"q_proj\", \"k_proj\", \"v_proj\", \"o_proj\",\r\n        \"gate_proj\", \"up_proj\", \"down_proj\"\r\n    ],\r\n    task_type=\"CAUSAL_LM\",\r\n    lora_dropout=0.05,\r\n)\r\n\r\n# Initialize trainer\r\ntrainer = GRPOTrainer(\r\n    model=model,\r\n    processing_class=tokenizer,\r\n    reward_funcs=[\r\n        incremental_format_reward,\r\n        format_reward,\r\n        correctness_reward,\r\n    ],\r\n    args=training_args,\r\n    train_dataset=dataset,\r\n    peft_config=peft_config,      # Remove for full fine-tuning\r\n)\r\n\r\n# Train\r\ntrainer.train()\r\n\r\n# Save\r\ntrainer.save_model(\"final_model\")\r\n```\r\n\r\n**Unsloth Setup (2-3x Faster)**\r\n```python\r\nfrom unsloth import FastLanguageModel\r\n\r\nmodel, tokenizer = FastLanguageModel.from_pretrained(\r\n    model_name=\"google\u002Fgemma-3-1b-it\",\r\n    max_seq_length=1024,\r\n    load_in_4bit=True,\r\n    fast_inference=True,\r\n    max_lora_rank=32,\r\n)\r\n\r\nmodel = FastLanguageModel.get_peft_model(\r\n    model,\r\n    r=32,\r\n    target_modules=[\"q_proj\", \"k_proj\", \"v_proj\", \"o_proj\",\r\n                    \"gate_proj\", \"up_proj\", \"down_proj\"],\r\n    lora_alpha=32,\r\n    use_gradient_checkpointing=\"unsloth\",\r\n)\r\n\r\n# Rest is identical to standard setup\r\ntrainer = GRPOTrainer(model=model, ...)\r\ntrainer.train()\r\n```\r\n\r\n---\r\n\r\n## Critical Training Insights\r\n\r\n### 1. Loss Behavior (EXPECTED PATTERN)\r\n- **Loss starts near 0 and INCREASES during training**\r\n- This is CORRECT - loss measures KL divergence from initial policy\r\n- Model is learning (diverging from original behavior to optimize rewards)\r\n- Monitor reward metrics instead of loss for progress\r\n\r\n### 2. Reward Tracking\r\nKey metrics to watch:\r\n- `reward`: Average across all completions\r\n- `reward_std`: Diversity within groups (should remain > 0)\r\n- `kl`: KL divergence from reference (should grow moderately)\r\n\r\n**Healthy Training Pattern:**\r\n```\r\nStep   Reward    Reward_Std   KL\r\n100    0.5       0.3          0.02\r\n200    0.8       0.25         0.05\r\n300    1.2       0.2          0.08  ← Good progression\r\n400    1.5       0.15         0.12\r\n```\r\n\r\n**Warning Signs:**\r\n- Reward std → 0 (model collapsing to single response)\r\n- KL exploding (> 0.5) (diverging too much, reduce LR)\r\n- Reward stuck (reward functions too harsh or model capacity issue)\r\n\r\n### 3. Common Pitfalls and Solutions\r\n\r\n| Problem | Symptom | Solution |\r\n|---------|---------|----------|\r\n| **Mode collapse** | All completions identical | Increase `num_generations`, add diversity penalty |\r\n| **No learning** | Flat rewards | Check reward function logic, increase LR |\r\n| **OOM errors** | GPU memory exceeded | Reduce `num_generations`, enable gradient checkpointing |\r\n| **Slow training** | \u003C 1 it\u002Fs | Enable `use_vllm=True`, use Unsloth, reduce seq length |\r\n| **Format ignored** | Model doesn't follow structure | Increase format reward weight, add incremental rewards |\r\n\r\n---\r\n\r\n## Advanced Patterns\r\n\r\n### 1. Multi-Stage Training\r\nFor complex tasks, train in stages:\r\n\r\n```python\r\n# Stage 1: Format compliance (epochs=1)\r\ntrainer_stage1 = GRPOTrainer(\r\n    model=model,\r\n    reward_funcs=[incremental_format_reward, format_reward],\r\n    ...\r\n)\r\ntrainer_stage1.train()\r\n\r\n# Stage 2: Correctness (epochs=1)\r\ntrainer_stage2 = GRPOTrainer(\r\n    model=model,\r\n    reward_funcs=[format_reward, correctness_reward],\r\n    ...\r\n)\r\ntrainer_stage2.train()\r\n```\r\n\r\n### 2. Adaptive Reward Scaling\r\n```python\r\nclass AdaptiveReward:\r\n    def __init__(self, base_reward_func, initial_weight=1.0):\r\n        self.func = base_reward_func\r\n        self.weight = initial_weight\r\n\r\n    def __call__(self, *args, **kwargs):\r\n        rewards = self.func(*args, **kwargs)\r\n        return [r * self.weight for r in rewards]\r\n\r\n    def adjust_weight(self, success_rate):\r\n        \"\"\"Increase weight if model struggling, decrease if succeeding.\"\"\"\r\n        if success_rate \u003C 0.3:\r\n            self.weight *= 1.2\r\n        elif success_rate > 0.8:\r\n            self.weight *= 0.9\r\n```\r\n\r\n### 3. Custom Dataset Integration\r\n```python\r\ndef load_custom_knowledge_base(csv_path):\r\n    \"\"\"Example: School communication platform docs.\"\"\"\r\n    import pandas as pd\r\n    df = pd.read_csv(csv_path)\r\n\r\n    dataset = Dataset.from_pandas(df).map(lambda x: {\r\n        'prompt': [\r\n            {'role': 'system', 'content': CUSTOM_SYSTEM_PROMPT},\r\n            {'role': 'user', 'content': x['question']}\r\n        ],\r\n        'answer': x['expert_answer']\r\n    })\r\n    return dataset\r\n```\r\n\r\n---\r\n\r\n## Deployment and Inference\r\n\r\n### Save and Merge LoRA\r\n```python\r\n# Merge LoRA adapters into base model\r\nif hasattr(trainer.model, 'merge_and_unload'):\r\n    merged_model = trainer.model.merge_and_unload()\r\n    merged_model.save_pretrained(\"production_model\")\r\n    tokenizer.save_pretrained(\"production_model\")\r\n```\r\n\r\n### Inference Example\r\n```python\r\nfrom transformers import pipeline\r\n\r\ngenerator = pipeline(\r\n    \"text-generation\",\r\n    model=\"production_model\",\r\n    tokenizer=tokenizer\r\n)\r\n\r\nresult = generator(\r\n    [\r\n        {'role': 'system', 'content': SYSTEM_PROMPT},\r\n        {'role': 'user', 'content': \"What is 15 + 27?\"}\r\n    ],\r\n    max_new_tokens=256,\r\n    do_sample=True,\r\n    temperature=0.7,\r\n    top_p=0.9\r\n)\r\nprint(result[0]['generated_text'])\r\n```\r\n\r\n---\r\n\r\n## Best Practices Checklist\r\n\r\n**Before Training:**\r\n- [ ] Validate dataset format (prompts as List[Dict])\r\n- [ ] Test reward functions on sample data\r\n- [ ] Calculate expected max_prompt_length from data\r\n- [ ] Choose appropriate num_generations based on GPU memory\r\n- [ ] Set up logging (wandb recommended)\r\n\r\n**During Training:**\r\n- [ ] Monitor reward progression (should increase)\r\n- [ ] Check reward_std (should stay > 0.1)\r\n- [ ] Watch for OOM errors (reduce batch size if needed)\r\n- [ ] Sample generations every 50-100 steps\r\n- [ ] Validate format compliance on holdout set\r\n\r\n**After Training:**\r\n- [ ] Merge LoRA weights if using PEFT\r\n- [ ] Test on diverse prompts\r\n- [ ] Compare to baseline model\r\n- [ ] Document reward weights and hyperparameters\r\n- [ ] Save reproducibility config\r\n\r\n---\r\n\r\n## Troubleshooting Guide\r\n\r\n### Debugging Workflow\r\n1. **Isolate reward functions** - Test each independently\r\n2. **Check data distribution** - Ensure diversity in prompts\r\n3. **Reduce complexity** - Start with single reward, add gradually\r\n4. **Monitor generations** - Print samples every N steps\r\n5. **Validate extraction logic** - Ensure answer parsing works\r\n\r\n### Quick Fixes\r\n```python\r\n# Debug reward function\r\ndef debug_reward(completions, **kwargs):\r\n    responses = [comp[0]['content'] for comp in completions]\r\n    for i, r in enumerate(responses[:2]):  # Print first 2\r\n        print(f\"Response {i}: {r[:200]}...\")\r\n    return [1.0] * len(responses)  # Dummy rewards\r\n\r\n# Test without training\r\ntrainer = GRPOTrainer(..., reward_funcs=[debug_reward])\r\ntrainer.generate_completions(dataset[:1])  # Generate without updating\r\n```\r\n\r\n---\r\n\r\n## References and Resources\r\n\r\n**Official Documentation:**\r\n- TRL GRPO Trainer: https:\u002F\u002Fhuggingface.co\u002Fdocs\u002Ftrl\u002Fgrpo_trainer\r\n- DeepSeek R1 Paper: https:\u002F\u002Farxiv.org\u002Fabs\u002F2501.12948\r\n- Unsloth Docs: https:\u002F\u002Fdocs.unsloth.ai\u002F\r\n\r\n**Example Repositories:**\r\n- Open R1 Implementation: https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fopen-r1\r\n- TRL Examples: https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Ftrl\u002Ftree\u002Fmain\u002Fexamples\r\n\r\n**Recommended Reading:**\r\n- Progressive Disclosure Pattern for agent instructions\r\n- Reward shaping in RL (Ng et al.)\r\n- LoRA paper (Hu et al., 2021)\r\n\r\n---\r\n\r\n## Usage Instructions for Agents\r\n\r\nWhen this skill is loaded:\r\n\r\n1. **Read this entire file** before implementing GRPO training\r\n2. **Start with the simplest reward function** (e.g., length-based) to validate setup\r\n3. **Use the templates** in `templates\u002F` directory as starting points\r\n4. **Reference examples** in `examples\u002F` for task-specific implementations\r\n5. **Follow the workflow** sequentially (don't skip steps)\r\n6. **Debug incrementally** - add one reward function at a time\r\n\r\n**Critical Reminders:**\r\n- Always use multiple reward functions (3-5 is optimal)\r\n- Monitor reward metrics, not loss\r\n- Test reward functions before training\r\n- Start small (num_generations=4), scale up gradually\r\n- Save checkpoints frequently (every 100 steps)\r\n\r\nThis skill is designed for **expert-level implementation**. Beginners should start with supervised fine-tuning before attempting GRPO.\r\n","# GRPO\u002FRL Training with TRL\r\n\r\nExpert-level guidance for implementing Group Relative Policy Optimization (GRPO) using the Transformer Reinforcement Learning (TRL) library. This skill provides battle-tested patterns, critical insights, and production-ready workflows for fine-tuning language models with custom reward functions.\r\n\r\n## When to Use This Skill\r\n\r\nUse GRPO training when you need to:\r\n- **Enforce specific output formats** (e.g., XML tags, JSON, structured reasoning)\r\n- **Teach verifiable tasks** with objective correctness metrics (math, coding, fact-checking)\r\n- **Improve reasoning capabilities** by rewarding chain-of-thought patterns\r\n- **Align models to domain-specific behaviors** without labeled preference data\r\n- **Optimize for multiple objectives** simultaneously (format + correctness + style)\r\n\r\n**Do NOT use GRPO for:**\r\n- Simple supervised fine-tuning tasks (use SFT instead)\r\n- Tasks without clear reward signals\r\n- When you already have high-quality preference pairs (use DPO\u002FPPO instead)\r\n\r\n---\r\n\r\n## Core Concepts\r\n\r\n### 1. GRPO Algorithm Fundamentals\r\n\r\n**Key Mechanism:**\r\n- Generates **multiple completions** for each prompt (group size: 4-16)\r\n- Compares completions within each group using reward functions\r\n- Updates policy to favor higher-rewarded responses relative to the group\r\n\r\n**Critical Difference from PPO:**\r\n- No separate reward model needed\r\n- More sample-efficient (learns from within-group comparisons)\r\n- Simpler to implement and debug\r\n\r\n**Mathematical Intuition:**\r\n```\r\nFor each prompt p:\r\n  1. Generate N completions: {c₁, c₂, ..., cₙ}\r\n  2. Compute rewards: {r₁, r₂, ..., rₙ}\r\n  3. Learn to increase probability of high-reward completions\r\n     relative to low-reward ones in the same group\r\n```\r\n\r\n### 2. Reward Function Design Philosophy\r\n\r\n**Golden Rules:**\r\n1. **Compose multiple reward functions** - Each handles one aspect (format, correctness, style)\r\n2. **Scale rewards appropriately** - Higher weight = stronger signal\r\n3. **Use incremental rewards** - Partial credit for partial compliance\r\n4. **Test rewards independently** - Debug each reward function in isolation\r\n\r\n**Reward Function Types:**\r\n\r\n| Type | Use Case | Example Weight |\r\n|------|----------|----------------|\r\n| **Correctness** | Verifiable tasks (math, code) | 2.0 (highest) |\r\n| **Format** | Strict structure enforcement | 0.5-1.0 |\r\n| **Length** | Encourage verbosity\u002Fconciseness | 0.1-0.5 |\r\n| **Style** | Penalize unwanted patterns | -0.5 to 0.5 |\r\n\r\n---\r\n\r\n## Implementation Workflow\r\n\r\n### Step 1: Dataset Preparation\r\n\r\n**Critical Requirements:**\r\n- Prompts in chat format (list of dicts with 'role' and 'content')\r\n- Include system prompts to set expectations\r\n- For verifiable tasks, include ground truth answers as additional columns\r\n\r\n**Example Structure:**\r\n```python\r\nfrom datasets import load_dataset, Dataset\r\n\r\nSYSTEM_PROMPT = \"\"\"\r\nRespond in the following format:\r\n\u003Creasoning>\r\n[Your step-by-step thinking]\r\n\u003C\u002Freasoning>\r\n\u003Canswer>\r\n[Final answer]\r\n\u003C\u002Fanswer>\r\n\"\"\"\r\n\r\ndef prepare_dataset(raw_data):\r\n    \"\"\"\r\n    Transform raw data into GRPO-compatible format.\r\n\r\n    Returns: Dataset with columns:\r\n    - 'prompt': List[Dict] with role\u002Fcontent (system + user messages)\r\n    - 'answer': str (ground truth, optional but recommended)\r\n    \"\"\"\r\n    return raw_data.map(lambda x: {\r\n        'prompt': [\r\n            {'role': 'system', 'content': SYSTEM_PROMPT},\r\n            {'role': 'user', 'content': x['question']}\r\n        ],\r\n        'answer': extract_answer(x['raw_answer'])\r\n    })\r\n```\r\n\r\n**Pro Tips:**\r\n- Use one-shot or few-shot examples in system prompt for complex formats\r\n- Keep prompts concise (max_prompt_length: 256-512 tokens)\r\n- Validate data quality before training (garbage in = garbage out)\r\n\r\n### Step 2: Reward Function Implementation\r\n\r\n**Template Structure:**\r\n```python\r\ndef reward_function_name(\r\n    prompts,        # List[List[Dict]]: Original prompts\r\n    completions,    # List[List[Dict]]: Model generations\r\n    answer=None,    # Optional: Ground truth from dataset\r\n    **kwargs        # Additional dataset columns\r\n) -> list[float]:\r\n    \"\"\"\r\n    Evaluate completions and return rewards.\r\n\r\n    Returns: List of floats (one per completion)\r\n    \"\"\"\r\n    # Extract completion text\r\n    responses = [comp[0]['content'] for comp in completions]\r\n\r\n    # Compute rewards\r\n    rewards = []\r\n    for response in responses:\r\n        score = compute_score(response)\r\n        rewards.append(score)\r\n\r\n    return rewards\r\n```\r\n\r\n**Example 1: Correctness Reward (Math\u002FCoding)**\r\n```python\r\ndef correctness_reward(prompts, completions, answer, **kwargs):\r\n    \"\"\"Reward correct answers with high score.\"\"\"\r\n    responses = [comp[0]['content'] for comp in completions]\r\n    extracted = [extract_final_answer(r) for r in responses]\r\n    return [2.0 if ans == gt else 0.0\r\n            for ans, gt in zip(extracted, answer)]\r\n```\r\n\r\n**Example 2: Format Reward (Structured Output)**\r\n```python\r\nimport re\r\n\r\ndef format_reward(completions, **kwargs):\r\n    \"\"\"Reward XML-like structured format.\"\"\"\r\n    pattern = r'\u003Creasoning>.*?\u003C\u002Freasoning>\\s*\u003Canswer>.*?\u003C\u002Fanswer>'\r\n    responses = [comp[0]['content'] for comp in completions]\r\n    return [1.0 if re.search(pattern, r, re.DOTALL) else 0.0\r\n            for r in responses]\r\n```\r\n\r\n**Example 3: Incremental Format Reward (Partial Credit)**\r\n```python\r\ndef incremental_format_reward(completions, **kwargs):\r\n    \"\"\"Award partial credit for format compliance.\"\"\"\r\n    responses = [comp[0]['content'] for comp in completions]\r\n    rewards = []\r\n\r\n    for r in responses:\r\n        score = 0.0\r\n        if '\u003Creasoning>' in r:\r\n            score += 0.25\r\n        if '\u003C\u002Freasoning>' in r:\r\n            score += 0.25\r\n        if '\u003Canswer>' in r:\r\n            score += 0.25\r\n        if '\u003C\u002Fanswer>' in r:\r\n            score += 0.25\r\n        # Penalize extra text after closing tag\r\n        if r.count('\u003C\u002Fanswer>') == 1:\r\n            extra_text = r.split('\u003C\u002Fanswer>')[-1].strip()\r\n            score -= len(extra_text) * 0.001\r\n        rewards.append(score)\r\n\r\n    return rewards\r\n```\r\n\r\n**Critical Insight:**\r\nCombine 3-5 reward functions for robust training. Order matters less than diversity of signals.\r\n\r\n### Step 3: Training Configuration\r\n\r\n**Memory-Optimized Config (Small GPU)**\r\n```python\r\nfrom trl import GRPOConfig\r\n\r\ntraining_args = GRPOConfig(\r\n    output_dir=\"outputs\u002Fgrpo-model\",\r\n\r\n    # Learning rate\r\n    learning_rate=5e-6,          # Lower = more stable\r\n    adam_beta1=0.9,\r\n    adam_beta2=0.99,\r\n    weight_decay=0.1,\r\n    warmup_ratio=0.1,\r\n    lr_scheduler_type='cosine',\r\n\r\n    # Batch settings\r\n    per_device_train_batch_size=1,\r\n    gradient_accumulation_steps=4,  # Effective batch = 4\r\n\r\n    # GRPO-specific\r\n    num_generations=8,            # Group size: 8-16 recommended\r\n    max_prompt_length=256,\r\n    max_completion_length=512,\r\n\r\n    # Training duration\r\n    num_train_epochs=1,\r\n    max_steps=None,               # Or set fixed steps (e.g., 500)\r\n\r\n    # Optimization\r\n    bf16=True,                    # Faster on A100\u002FH100\r\n    optim=\"adamw_8bit\",          # Memory-efficient optimizer\r\n    max_grad_norm=0.1,\r\n\r\n    # Logging\r\n    logging_steps=1,\r\n    save_steps=100,\r\n    report_to=\"wandb\",            # Or \"none\" for no logging\r\n)\r\n```\r\n\r\n**High-Performance Config (Large GPU)**\r\n```python\r\ntraining_args = GRPOConfig(\r\n    output_dir=\"outputs\u002Fgrpo-model\",\r\n    learning_rate=1e-5,\r\n    per_device_train_batch_size=4,\r\n    gradient_accumulation_steps=2,\r\n    num_generations=16,           # Larger groups = better signal\r\n    max_prompt_length=512,\r\n    max_completion_length=1024,\r\n    num_train_epochs=1,\r\n    bf16=True,\r\n    use_vllm=True,                # Fast generation with vLLM\r\n    logging_steps=10,\r\n)\r\n```\r\n\r\n**Critical Hyperparameters:**\r\n\r\n| Parameter | Impact | Tuning Advice |\r\n|-----------|--------|---------------|\r\n| `num_generations` | Group size for comparison | Start with 8, increase to 16 if GPU allows |\r\n| `learning_rate` | Convergence speed\u002Fstability | 5e-6 (safe), 1e-5 (faster, riskier) |\r\n| `max_completion_length` | Output verbosity | Match your task (512 for reasoning, 256 for short answers) |\r\n| `gradient_accumulation_steps` | Effective batch size | Increase if GPU memory limited |\r\n\r\n### Step 4: Model Setup and Training\r\n\r\n**Standard Setup (Transformers)**\r\n```python\r\nimport torch\r\nfrom transformers import AutoModelForCausalLM, AutoTokenizer\r\nfrom peft import LoraConfig\r\nfrom trl import GRPOTrainer\r\n\r\n# Load model\r\nmodel_name = \"Qwen\u002FQwen2.5-1.5B-Instruct\"\r\nmodel = AutoModelForCausalLM.from_pretrained(\r\n    model_name,\r\n    torch_dtype=torch.bfloat16,\r\n    attn_implementation=\"flash_attention_2\",  # 2-3x faster\r\n    device_map=\"auto\"\r\n)\r\n\r\ntokenizer = AutoTokenizer.from_pretrained(model_name)\r\ntokenizer.pad_token = tokenizer.eos_token\r\n\r\n# Optional: LoRA for parameter-efficient training\r\npeft_config = LoraConfig(\r\n    r=16,                         # Rank (higher = more capacity)\r\n    lora_alpha=32,               # Scaling factor (typically 2*r)\r\n    target_modules=[\r\n        \"q_proj\", \"k_proj\", \"v_proj\", \"o_proj\",\r\n        \"gate_proj\", \"up_proj\", \"down_proj\"\r\n    ],\r\n    task_type=\"CAUSAL_LM\",\r\n    lora_dropout=0.05,\r\n)\r\n\r\n# Initialize trainer\r\ntrainer = GRPOTrainer(\r\n    model=model,\r\n    processing_class=tokenizer,\r\n    reward_funcs=[\r\n        incremental_format_reward,\r\n        format_reward,\r\n        correctness_reward,\r\n    ],\r\n    args=training_args,\r\n    train_dataset=dataset,\r\n    peft_config=peft_config,      # Remove for full fine-tuning\r\n)\r\n\r\n# Train\r\ntrainer.train()\r\n\r\n# Save\r\ntrainer.save_model(\"final_model\")\r\n```\r\n\r\n**Unsloth Setup (2-3x Faster)**\r\n```python\r\nfrom unsloth import FastLanguageModel\r\n\r\nmodel, tokenizer = FastLanguageModel.from_pretrained(\r\n    model_name=\"google\u002Fgemma-3-1b-it\",\r\n    max_seq_length=1024,\r\n    load_in_4bit=True,\r\n    fast_inference=True,\r\n    max_lora_rank=32,\r\n)\r\n\r\nmodel = FastLanguageModel.get_peft_model(\r\n    model,\r\n    r=32,\r\n    target_modules=[\"q_proj\", \"k_proj\", \"v_proj\", \"o_proj\",\r\n                    \"gate_proj\", \"up_proj\", \"down_proj\"],\r\n    lora_alpha=32,\r\n    use_gradient_checkpointing=\"unsloth\",\r\n)\r\n\r\n# Rest is identical to standard setup\r\ntrainer = GRPOTrainer(model=model, ...)\r\ntrainer.train()\r\n```\r\n\r\n---\r\n\r\n## Critical Training Insights\r\n\r\n### 1. Loss Behavior (EXPECTED PATTERN)\r\n- **Loss starts near 0 and INCREASES during training**\r\n- This is CORRECT - loss measures KL divergence from initial policy\r\n- Model is learning (diverging from original behavior to optimize rewards)\r\n- Monitor reward metrics instead of loss for progress\r\n\r\n### 2. Reward Tracking\r\nKey metrics to watch:\r\n- `reward`: Average across all completions\r\n- `reward_std`: Diversity within groups (should remain > 0)\r\n- `kl`: KL divergence from reference (should grow moderately)\r\n\r\n**Healthy Training Pattern:**\r\n```\r\nStep   Reward    Reward_Std   KL\r\n100    0.5       0.3          0.02\r\n200    0.8       0.25         0.05\r\n300    1.2       0.2          0.08  ← Good progression\r\n400    1.5       0.15         0.12\r\n```\r\n\r\n**Warning Signs:**\r\n- Reward std → 0 (model collapsing to single response)\r\n- KL exploding (> 0.5) (diverging too much, reduce LR)\r\n- Reward stuck (reward functions too harsh or model capacity issue)\r\n\r\n### 3. Common Pitfalls and Solutions\r\n\r\n| Problem | Symptom | Solution |\r\n|---------|---------|----------|\r\n| **Mode collapse** | All completions identical | Increase `num_generations`, add diversity penalty |\r\n| **No learning** | Flat rewards | Check reward function logic, increase LR |\r\n| **OOM errors** | GPU memory exceeded | Reduce `num_generations`, enable gradient checkpointing |\r\n| **Slow training** | \u003C 1 it\u002Fs | Enable `use_vllm=True`, use Unsloth, reduce seq length |\r\n| **Format ignored** | Model doesn't follow structure | Increase format reward weight, add incremental rewards |\r\n\r\n---\r\n\r\n## Advanced Patterns\r\n\r\n### 1. Multi-Stage Training\r\nFor complex tasks, train in stages:\r\n\r\n```python\r\n# Stage 1: Format compliance (epochs=1)\r\ntrainer_stage1 = GRPOTrainer(\r\n    model=model,\r\n    reward_funcs=[incremental_format_reward, format_reward],\r\n    ...\r\n)\r\ntrainer_stage1.train()\r\n\r\n# Stage 2: Correctness (epochs=1)\r\ntrainer_stage2 = GRPOTrainer(\r\n    model=model,\r\n    reward_funcs=[format_reward, correctness_reward],\r\n    ...\r\n)\r\ntrainer_stage2.train()\r\n```\r\n\r\n### 2. Adaptive Reward Scaling\r\n```python\r\nclass AdaptiveReward:\r\n    def __init__(self, base_reward_func, initial_weight=1.0):\r\n        self.func = base_reward_func\r\n        self.weight = initial_weight\r\n\r\n    def __call__(self, *args, **kwargs):\r\n        rewards = self.func(*args, **kwargs)\r\n        return [r * self.weight for r in rewards]\r\n\r\n    def adjust_weight(self, success_rate):\r\n        \"\"\"Increase weight if model struggling, decrease if succeeding.\"\"\"\r\n        if success_rate \u003C 0.3:\r\n            self.weight *= 1.2\r\n        elif success_rate > 0.8:\r\n            self.weight *= 0.9\r\n```\r\n\r\n### 3. Custom Dataset Integration\r\n```python\r\ndef load_custom_knowledge_base(csv_path):\r\n    \"\"\"Example: School communication platform docs.\"\"\"\r\n    import pandas as pd\r\n    df = pd.read_csv(csv_path)\r\n\r\n    dataset = Dataset.from_pandas(df).map(lambda x: {\r\n        'prompt': [\r\n            {'role': 'system', 'content': CUSTOM_SYSTEM_PROMPT},\r\n            {'role': 'user', 'content': x['question']}\r\n        ],\r\n        'answer': x['expert_answer']\r\n    })\r\n    return dataset\r\n```\r\n\r\n---\r\n\r\n## Deployment and Inference\r\n\r\n### Save and Merge LoRA\r\n```python\r\n# Merge LoRA adapters into base model\r\nif hasattr(trainer.model, 'merge_and_unload'):\r\n    merged_model = trainer.model.merge_and_unload()\r\n    merged_model.save_pretrained(\"production_model\")\r\n    tokenizer.save_pretrained(\"production_model\")\r\n```\r\n\r\n### Inference Example\r\n```python\r\nfrom transformers import pipeline\r\n\r\ngenerator = pipeline(\r\n    \"text-generation\",\r\n    model=\"production_model\",\r\n    tokenizer=tokenizer\r\n)\r\n\r\nresult = generator(\r\n    [\r\n        {'role': 'system', 'content': SYSTEM_PROMPT},\r\n        {'role': 'user', 'content': \"What is 15 + 27?\"}\r\n    ],\r\n    max_new_tokens=256,\r\n    do_sample=True,\r\n    temperature=0.7,\r\n    top_p=0.9\r\n)\r\nprint(result[0]['generated_text'])\r\n```\r\n\r\n---\r\n\r\n## Best Practices Checklist\r\n\r\n**Before Training:**\r\n- [ ] Validate dataset format (prompts as List[Dict])\r\n- [ ] Test reward functions on sample data\r\n- [ ] Calculate expected max_prompt_length from data\r\n- [ ] Choose appropriate num_generations based on GPU memory\r\n- [ ] Set up logging (wandb recommended)\r\n\r\n**During Training:**\r\n- [ ] Monitor reward progression (should increase)\r\n- [ ] Check reward_std (should stay > 0.1)\r\n- [ ] Watch for OOM errors (reduce batch size if needed)\r\n- [ ] Sample generations every 50-100 steps\r\n- [ ] Validate format compliance on holdout set\r\n\r\n**After Training:**\r\n- [ ] Merge LoRA weights if using PEFT\r\n- [ ] Test on diverse prompts\r\n- [ ] Compare to baseline model\r\n- [ ] Document reward weights and hyperparameters\r\n- [ ] Save reproducibility config\r\n\r\n---\r\n\r\n## Troubleshooting Guide\r\n\r\n### Debugging Workflow\r\n1. **Isolate reward functions** - Test each independently\r\n2. **Check data distribution** - Ensure diversity in prompts\r\n3. **Reduce complexity** - Start with single reward, add gradually\r\n4. **Monitor generations** - Print samples every N steps\r\n5. **Validate extraction logic** - Ensure answer parsing works\r\n\r\n### Quick Fixes\r\n```python\r\n# Debug reward function\r\ndef debug_reward(completions, **kwargs):\r\n    responses = [comp[0]['content'] for comp in completions]\r\n    for i, r in enumerate(responses[:2]):  # Print first 2\r\n        print(f\"Response {i}: {r[:200]}...\")\r\n    return [1.0] * len(responses)  # Dummy rewards\r\n\r\n# Test without training\r\ntrainer = GRPOTrainer(..., reward_funcs=[debug_reward])\r\ntrainer.generate_completions(dataset[:1])  # Generate without updating\r\n```\r\n\r\n---\r\n\r\n## References and Resources\r\n\r\n**Official Documentation:**\r\n- TRL GRPO Trainer: https:\u002F\u002Fhuggingface.co\u002Fdocs\u002Ftrl\u002Fgrpo_trainer\r\n- DeepSeek R1 Paper: https:\u002F\u002Farxiv.org\u002Fabs\u002F2501.12948\r\n- Unsloth Docs: https:\u002F\u002Fdocs.unsloth.ai\u002F\r\n\r\n**Example Repositories:**\r\n- Open R1 Implementation: https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fopen-r1\r\n- TRL Examples: https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Ftrl\u002Ftree\u002Fmain\u002Fexamples\r\n\r\n**Recommended Reading:**\r\n- Progressive Disclosure Pattern for agent instructions\r\n- Reward shaping in RL (Ng et al.)\r\n- LoRA paper (Hu et al., 2021)\r\n\r\n---\r\n\r\n## Usage Instructions for Agents\r\n\r\nWhen this skill is loaded:\r\n\r\n1. **Read this entire file** before implementing GRPO training\r\n2. **Start with the simplest reward function** (e.g., length-based) to validate setup\r\n3. **Use the templates** in `templates\u002F` directory as starting points\r\n4. **Reference examples** in `examples\u002F` for task-specific implementations\r\n5. **Follow the workflow** sequentially (don't skip steps)\r\n6. **Debug incrementally** - add one reward function at a time\r\n\r\n**Critical Reminders:**\r\n- Always use multiple reward functions (3-5 is optimal)\r\n- Monitor reward metrics, not loss\r\n- Test reward functions before training\r\n- Start small (num_generations=4), scale up gradually\r\n- Save checkpoints frequently (every 100 steps)\r\n\r\nThis skill is designed for **expert-level implementation**. Beginners should start with supervised fine-tuning before attempting GRPO.\r\n",{"name":5,"author":44,"license":15,"version":45,"metadata":46,"description":7,"dependencies":52},"Orchestra Research","1.0.0",{"hermes":47},{"tags":48},[36,49,19,26,35,25,50,37,34,51],"Reinforcement Learning","Reasoning","Structured Output",[53,54,55,56,57],"transformers>=4.47.0","trl>=0.14.0","datasets>=3.2.0","peft>=0.14.0","torch","main","0d1434f89f4bc6b07e9d272accd8c1013768820f","archive\u002Fskill-md-reviewed\u002Fsha256\u002Ff8\u002Ff8326221ed9ae156572f5faf55b4b85557035bfc68efc0d2b26e7014b0bdd668",0,"https:\u002F\u002Fgithub.com\u002Fzapabob\u002FSkills","https:\u002F\u002Fgithub.com\u002Fzapabob","The Open University of JAPAN　2019-now\r\n\r\nTokyo University of Science　2007-2010","2026-10-26 16:29:01",{"source":8,"skillName":5,"commands":67,"prompt":77,"zipAvailable":78},[68,71,74],{"tool":69,"command":70},"npx","npx skills add zapabob\u002FSkills --skill grpo-rl-training",{"tool":72,"command":73},"bunx","bunx skills add zapabob\u002FSkills --skill grpo-rl-training",{"tool":75,"command":76},"pnpm","pnpm dlx skills add zapabob\u002FSkills --skill grpo-rl-training","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fzapabob\u002FSkills\u002Fblob\u002Fmain\u002Farchive\u002Fskill-md-reviewed\u002Fsha256\u002Ff8\u002Ff8326221ed9ae156572f5faf55b4b85557035bfc68efc0d2b26e7014b0bdd668\u002FSKILL.md",true,[],[81,119,154,179,205,222],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":100,"publishedAt":39},"01M6GJTE1GESGGF9K028Y7753E","xurl","X\u002FTwitter via xurl CLI: post, search, DM, media, v2 API.","https:\u002F\u002Fgithub.com\u002Fzapabob\u002FSkills\u002Fblob\u002Fmain\u002Fregistry\u002Fskills\u002Fxurl\u002Fvariants\u002Fhermes-agent\u002FSKILL.md",[87,92,95],{"categoryNo":88,"categoryName":89,"taxonomyType":90,"taxonomyTypeDesc":91},"01JBSEEDCAT000000000000010","后端与接口","SCENARIO","使用场景",{"categoryNo":93,"categoryName":94,"taxonomyType":90,"taxonomyTypeDesc":91},"01JBSEEDCAT000000000000023","Skill与智能体开发",{"categoryNo":96,"categoryName":97,"taxonomyType":98,"taxonomyTypeDesc":99},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[83,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,58,116,117,118],"openclaw","macos","cli","github","linux","windows","official","search","https","social-media","api","Media","hermes","hermes agent","twitter","social","via","post",{"skillNo":120,"name":121,"nameZh":6,"description":122,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":123,"categories":124,"keywords":136,"publishedAt":39},"01M6GJT8S1PXQ8WPXT1HSNBWH2","writing-plans","Write implementation plans: bite-sized tasks, paths, code.","https:\u002F\u002Fgithub.com\u002Fzapabob\u002FSkills\u002Fblob\u002Fmain\u002Fregistry\u002Fskills\u002Fwriting-plans\u002Fvariants\u002Fhermes-agent\u002FSKILL.md",[125,128,131,132,133],{"categoryNo":126,"categoryName":127,"taxonomyType":90,"taxonomyTypeDesc":91},"01JBSEEDCAT000000000000015","视觉设计",{"categoryNo":129,"categoryName":130,"taxonomyType":90,"taxonomyTypeDesc":91},"01JBSEEDCAT000000000000018","写作与文案",{"categoryNo":93,"categoryName":94,"taxonomyType":90,"taxonomyTypeDesc":91},{"categoryNo":96,"categoryName":97,"taxonomyType":98,"taxonomyTypeDesc":99},{"categoryNo":134,"categoryName":135,"taxonomyType":98,"taxonomyTypeDesc":99},"01JBSEEDCAT000000000000036","内容创作者",[137,138,139,140,102,141,105,142,106,143,144,145,146,147,148,149,150,151,152,153],"writing","writing plans","plans","design","review","workflow","documentation","tasks","development","code","planning","code-review","subagent","write","superpowers","paths","test-driven-development",{"skillNo":155,"name":156,"nameZh":6,"description":157,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":158,"categories":159,"keywords":163,"publishedAt":39},"01M6GJST0H5X7WHBJ3BZK0DVKH","whisper","OpenAI's general-purpose speech recognition model. Supports 99 languages, transcription, translation to English, and language identification. Six model sizes from tiny (39M params) to large (1550M params). Use for speech-to-text, podcast transcription, or multilingual audio processing. Best for robust, multilingual ASR.","https:\u002F\u002Fgithub.com\u002Fzapabob\u002FSkills\u002Fblob\u002Fmain\u002Fregistry\u002Fskills\u002Fwhisper\u002Fvariants\u002Fhermes-agent-optional\u002FSKILL.md",[160],{"categoryNo":161,"categoryName":162,"taxonomyType":90,"taxonomyTypeDesc":91},"01JBSEEDCAT000000000000016","图像与多媒体",[156,102,105,164,165,166,33,167,168,169,23,170,171,172,173,174,175,176,177,178],"openai","speech","multimodal","ASR","Audio","text","speech recognition","use","general","multilingual","translation","english","identification","processing","Audio Processing",{"skillNo":180,"name":181,"nameZh":6,"description":182,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":183,"categories":184,"keywords":188,"publishedAt":39},"01M6GJSMRQ8EETZTYMG72P70EA","weights-and-biases","W&B: log ML experiments, sweeps, model registry, dashboards.","https:\u002F\u002Fgithub.com\u002Fzapabob\u002FSkills\u002Fblob\u002Fmain\u002Fregistry\u002Fskills\u002Fweights-and-biases\u002Fvariants\u002Fhermes-agent\u002FSKILL.md",[185],{"categoryNo":186,"categoryName":187,"taxonomyType":90,"taxonomyTypeDesc":91},"01JBSEEDCAT000000000000013","分析与可视化",[189,102,190,191,106,192,193,194,195,32,196,23,197,198,199,200,201,202,203,204],"weights and biases","tensorflow","experiments","pytorch","visualization","registry","real-time","dashboards","experiment","log","time","Experiment Tracking","Model Registry","Hyperparameter Tuning","WandB","Real-Time Visualization",{"skillNo":206,"name":207,"nameZh":6,"description":208,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":209,"categories":210,"keywords":212,"publishedAt":39},"01M6GJS19KDPRY112JTR326S06","watchers","Poll RSS, JSON APIs, and GitHub with watermark dedup.","https:\u002F\u002Fgithub.com\u002Fzapabob\u002FSkills\u002Fblob\u002Fmain\u002Fregistry\u002Fskills\u002Fwatchers\u002Fvariants\u002Fhermes-agent-optional\u002FSKILL.md",[211],{"categoryNo":93,"categoryName":94,"taxonomyType":90,"taxonomyTypeDesc":91},[207,102,213,104,105,214,215,216,217,218,219,113,114,220,221],"terminal","automation","http","monitoring","cron","json","rss","devops","with",{"skillNo":223,"name":224,"nameZh":6,"description":225,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":226,"categories":227,"keywords":230,"publishedAt":39},"01M6GJRHJD2A6Q830SWF9W48BC","serving-llms-vllm","vLLM: high-throughput LLM serving, OpenAI API, quantization.","https:\u002F\u002Fgithub.com\u002Fzapabob\u002FSkills\u002Fblob\u002Fmain\u002Fregistry\u002Fskills\u002Fvllm\u002Fvariants\u002Fhermes-agent\u002FSKILL.md",[228,229],{"categoryNo":88,"categoryName":89,"taxonomyType":90,"taxonomyTypeDesc":91},{"categoryNo":96,"categoryName":97,"taxonomyType":98,"taxonomyTypeDesc":99},[231,232,233,105,234,164,235,236,237,33,238,111,239,240,241,242,243,244,245,246],"llms","vLLM","serving llms vllm","research","openai api","tensor","Inference Serving","Production","llm serving","High Throughput","PagedAttention","Continuous Batching","Quantization","Tensor Parallelism","high-throughput","throughput"]