[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7D2NFDC3FQM7E5012MFPDF5":3,"skill-same:01M7D2NFDC3FQM7E5012MFPDF5":68},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":38,"commitSha":39,"skillDirectory":40,"forksCount":13,"repositoryHtmlUrl":41,"repositoryHomepageUrl":6,"ownerHtmlUrl":42,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":43,"install":44,"resources":57},"01M7D2NFDC3FQM7E5012MFPDF5","torchforge-rl-training",null,"Provides guidance for PyTorch-native agentic RL using torchforge, Meta's library separating infra from algorithms. Use when you want clean RL abstractions, easy algorithm experimentation, or scalable training with Monarch and TorchTitan.","beyondai\u002Fsandbox","beyondai","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F2845958?v=4","01M7D24SBNM47BJGJ9J2HB13BP","01M7D24SCDC9DYE005XH6R553S",0,"MIT","https:\u002F\u002Fgithub.com\u002Fbeyondai\u002Fsandbox\u002Fblob\u002Fmain\u002Flabs\u002F.claude\u002Fskills\u002Ftorchforge\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: torchforge-rl-training\ndescription: Provides guidance for PyTorch-native agentic RL using torchforge, Meta's library separating infra from algorithms. Use when you want clean RL abstractions, easy algorithm experimentation, or scalable training with Monarch and TorchTitan.\nversion: 1.0.0\nauthor: Orchestra Research\nlicense: MIT\ntags: [Reinforcement Learning, PyTorch, GRPO, SFT, Monarch, TorchTitan, Meta]\ndependencies: [torch>=2.9.0, torchtitan>=0.2.0, vllm, monarch]\n---\n\n# torchforge: PyTorch-Native Agentic RL Library\n\ntorchforge is Meta's PyTorch-native RL library that separates infrastructure concerns from algorithm concerns. It enables rapid RL research by letting you focus on algorithms while handling distributed training, inference, and weight sync automatically.\n\n## When to Use torchforge\n\n**Choose torchforge when you need:**\n- Clean separation between RL algorithms and infrastructure\n- PyTorch-native abstractions (no Ray dependency)\n- Easy algorithm experimentation (GRPO, DAPO, SAPO in ~100 lines)\n- Scalable training with Monarch actor system\n- Integration with TorchTitan for model parallelism\n\n**Consider alternatives when:**\n- You need production-ready stability → use **miles** or **verl**\n- You want Megatron-native training → use **slime**\n- torchforge is experimental and APIs may change\n\n## Key Features\n\n- **Algorithm isolation**: Implement RL algorithms without touching infrastructure\n- **Scalability**: From single GPU to thousands via Monarch\n- **Modern stack**: TorchTitan (training), vLLM (inference), TorchStore (sync)\n- **Loss functions**: GRPO, DAPO, CISPO, GSPO, SAPO built-in\n\n## Architecture Overview\n\n```\n┌─────────────────────────────────────────────────────────┐\n│ Application Layer (Your Code)                           │\n│ - Define reward models, loss functions, sampling        │\n└─────────────────────┬───────────────────────────────────┘\n                      │\n┌─────────────────────▼───────────────────────────────────┐\n│ Forge API Layer                                         │\n│ - Episode, Group dataclasses                           │\n│ - Service interfaces (async\u002Fawait)                      │\n└─────────────────────┬───────────────────────────────────┘\n                      │\n┌─────────────────────▼───────────────────────────────────┐\n│ Distributed Services (Monarch)                          │\n│ ├── Trainer (TorchTitan FSDP)                          │\n│ ├── Generator (vLLM inference)                          │\n│ ├── Reference Model (frozen KL baseline)               │\n│ └── Reward Actors (compute rewards)                    │\n└─────────────────────────────────────────────────────────┘\n```\n\n## Installation\n\n```bash\n# Create environment\nconda create -n forge python=3.12\nconda activate forge\n\n# Install (handles PyTorch nightly + dependencies)\n.\u002Fscripts\u002Finstall.sh\n\n# Verify\npython -c \"import torch, forge, vllm; print('OK')\"\n```\n\n### ROCm Installation\n\n```bash\n.\u002Fscripts\u002Finstall_rocm.sh\n```\n\n## Quick Start\n\n### SFT Training (2+ GPUs)\n\n```bash\npython -m apps.sft.main --config apps\u002Fsft\u002Fllama3_8b.yaml\n```\n\n### GRPO Training (3+ GPUs)\n\n```bash\npython -m apps.grpo.main --config apps\u002Fgrpo\u002Fqwen3_1_7b.yaml\n```\n\n---\n\n## Workflow 1: GRPO Training for Math Reasoning\n\nUse this workflow for training reasoning models with group-relative advantages.\n\n### Prerequisites Checklist\n- [ ] 3+ GPUs (GPU0: trainer, GPU1: ref_model, GPU2: generator)\n- [ ] Model from HuggingFace Hub\n- [ ] Training dataset (GSM8K, MATH, etc.)\n\n### Step 1: Create Configuration\n\n```yaml\n# config\u002Fgrpo_math.yaml\nmodel: \"Qwen\u002FQwen2.5-7B-Instruct\"\n\ndataset:\n  path: \"openai\u002Fgsm8k\"\n  split: \"train\"\n  streaming: true\n\ntraining:\n  batch_size: 4\n  learning_rate: 1e-6\n  seq_len: 4096\n  dtype: bfloat16\n  gradient_accumulation_steps: 4\n\ngrpo:\n  n_samples: 8           # Responses per prompt\n  clip_low: 0.2\n  clip_high: 0.28\n  beta: 0.1              # KL penalty coefficient\n  temperature: 0.7\n\nservices:\n  generator:\n    procs: 1\n    num_replicas: 1\n    with_gpus: true\n  trainer:\n    procs: 1\n    num_replicas: 1\n    with_gpus: true\n  ref_model:\n    procs: 1\n    num_replicas: 1\n    with_gpus: true\n```\n\n### Step 2: Define Reward Function\n\n```python\n# rewards.py\n# Reward functions are in forge.data.rewards\nfrom forge.data.rewards import MathReward, ThinkingReward\nimport re\n\n# Or define your own reward function\nclass CustomMathReward:\n    def __call__(self, prompt: str, response: str, target: str) -> float:\n        # Extract answer from response\n        match = re.search(r'\\\\boxed{([^}]+)}', response)\n        if not match:\n            return 0.0\n\n        answer = match.group(1).strip()\n        return 1.0 if answer == target else 0.0\n```\n\n### Step 3: Launch Training\n\n```bash\npython -m apps.grpo.main --config config\u002Fgrpo_math.yaml\n```\n\n### Step 4: Monitor Progress\n- [ ] Check W&B dashboard for loss curves\n- [ ] Verify entropy is decreasing (policy becoming more deterministic)\n- [ ] Monitor KL divergence (should stay bounded)\n\n---\n\n## Workflow 2: Custom Loss Function\n\nUse this workflow to implement new RL algorithms.\n\n### Step 1: Create Loss Class\n\n```python\n# src\u002Fforge\u002Flosses\u002Fcustom_loss.py\nimport torch\nimport torch.nn as nn\n\nclass CustomLoss(nn.Module):\n    def __init__(self, clip_range: float = 0.2, beta: float = 0.1):\n        super().__init__()\n        self.clip_range = clip_range\n        self.beta = beta\n\n    def forward(\n        self,\n        logprobs: torch.Tensor,\n        ref_logprobs: torch.Tensor,\n        advantages: torch.Tensor,\n        padding_mask: torch.Tensor,\n    ) -> torch.Tensor:\n        # Compute importance ratio\n        ratio = torch.exp(logprobs - ref_logprobs)\n\n        # Clipped policy gradient\n        clipped_ratio = torch.clamp(\n            ratio,\n            1 - self.clip_range,\n            1 + self.clip_range\n        )\n        pg_loss = -torch.min(ratio * advantages, clipped_ratio * advantages)\n\n        # KL penalty\n        kl = ref_logprobs - logprobs\n\n        # Apply mask and aggregate\n        masked_loss = (pg_loss + self.beta * kl) * padding_mask\n        loss = masked_loss.sum() \u002F padding_mask.sum()\n\n        return loss\n```\n\n### Step 2: Integrate into Application\n\n```python\n# apps\u002Fcustom\u002Fmain.py\nfrom forge.losses.custom_loss import CustomLoss\n\nloss_fn = CustomLoss(clip_range=0.2, beta=0.1)\n\n# In training loop\nloss = loss_fn(\n    logprobs=logprobs,\n    ref_logprobs=ref_logprobs,\n    advantages=advantages,\n    padding_mask=padding_mask,\n)\n```\n\n---\n\n## Workflow 3: Multi-GPU Distributed Training\n\nUse this workflow for scaling to multiple GPUs or nodes.\n\n### Configuration for Distributed\n\n```yaml\n# config\u002Fdistributed.yaml\nmodel: \"meta-llama\u002FMeta-Llama-3.1-8B-Instruct\"\n\nparallelism:\n  tensor_parallel_degree: 2    # Split model across GPUs\n  pipeline_parallel_degree: 1\n  data_parallel_shard_degree: 2\n\nservices:\n  generator:\n    procs: 2                   # 2 processes for TP=2\n    num_replicas: 1\n    with_gpus: true\n  trainer:\n    procs: 2\n    num_replicas: 1\n    with_gpus: true\n```\n\n### Launch with SLURM\n\n```bash\n# Submit job\nsbatch --nodes=2 --gpus-per-node=8 run_grpo.sh\n```\n\n### Launch Locally (Multi-GPU)\n\n```bash\n# 8 GPU setup\npython -m apps.grpo.main \\\n    --config config\u002Fdistributed.yaml \\\n    --trainer.procs 4 \\\n    --generator.procs 4\n```\n\n---\n\n## Core API Reference\n\n### Training Batch Format\n\ntorchforge uses dictionary-based batches for training:\n\n```python\n# inputs: list of dicts with torch.Tensor values\ninputs = [{\"tokens\": torch.Tensor}]\n\n# targets: list of dicts with training signals\ntargets = [{\n    \"response\": torch.Tensor,\n    \"ref_logprobs\": torch.Tensor,\n    \"advantages\": torch.Tensor,\n    \"padding_mask\": torch.Tensor\n}]\n\n# train_step returns loss as float\nloss = trainer.train_step(inputs, targets)\n```\n\n### Completion\n\nGenerated output from vLLM:\n\n```python\n@dataclass\nclass Completion:\n    text: str              # Generated text\n    token_ids: list[int]   # Token IDs\n    logprobs: list[float]  # Log probabilities\n    metadata: dict         # Custom metadata\n```\n\n---\n\n## Built-in Loss Functions\n\n### Loss Functions\n\nLoss functions are in the `forge.losses` module:\n\n```python\nfrom forge.losses import SimpleGRPOLoss, ReinforceLoss\n\n# SimpleGRPOLoss for GRPO training\nloss_fn = SimpleGRPOLoss(beta=0.1)\n\n# Forward pass\nloss = loss_fn(\n    logprobs=logprobs,\n    ref_logprobs=ref_logprobs,\n    advantages=advantages,\n    padding_mask=padding_mask\n)\n```\n\n### ReinforceLoss\n\n```python\nfrom forge.losses.reinforce_loss import ReinforceLoss\n\n# With optional importance ratio clipping\nloss_fn = ReinforceLoss(clip_ratio=0.2)\n```\n\n---\n\n## Common Issues and Solutions\n\n### Issue: Not Enough GPUs\n\n**Symptoms**: \"Insufficient GPU resources\" error\n\n**Solutions**:\n```yaml\n# Reduce service requirements\nservices:\n  generator:\n    procs: 1\n    with_gpus: true\n  trainer:\n    procs: 1\n    with_gpus: true\n  # Remove ref_model (uses generator weights)\n```\n\nOr use CPU for reference model:\n```yaml\nref_model:\n  with_gpus: false\n```\n\n### Issue: OOM During Generation\n\n**Symptoms**: CUDA OOM in vLLM\n\n**Solutions**:\n```yaml\n# Reduce batch size\ngrpo:\n  n_samples: 4  # Reduce from 8\n\n# Or reduce sequence length\ntraining:\n  seq_len: 2048\n```\n\n### Issue: Slow Weight Sync\n\n**Symptoms**: Long pauses between training and generation\n\n**Solutions**:\n```bash\n# Enable RDMA (if available)\nexport TORCHSTORE_USE_RDMA=1\n\n# Or reduce sync frequency\ntraining:\n  sync_interval: 10  # Sync every 10 steps\n```\n\n### Issue: Policy Collapse\n\n**Symptoms**: Entropy drops to zero, reward stops improving\n\n**Solutions**:\n```yaml\n# Increase KL penalty\ngrpo:\n  beta: 0.2  # Increase from 0.1\n\n# Or add entropy bonus\ntraining:\n  entropy_coef: 0.01\n```\n\n---\n\n## Resources\n\n- **Documentation**: https:\u002F\u002Fmeta-pytorch.org\u002Ftorchforge\n- **GitHub**: https:\u002F\u002Fgithub.com\u002Fmeta-pytorch\u002Ftorchforge\n- **Discord**: https:\u002F\u002Fdiscord.gg\u002FYsTYBh6PD9\n- **TorchTitan**: https:\u002F\u002Fgithub.com\u002Fpytorch\u002Ftorchtitan\n- **Monarch**: https:\u002F\u002Fgithub.com\u002Fmeta-pytorch\u002Fmonarch\n\n","# torchforge: PyTorch-Native Agentic RL Library\n\ntorchforge is Meta's PyTorch-native RL library that separates infrastructure concerns from algorithm concerns. It enables rapid RL research by letting you focus on algorithms while handling distributed training, inference, and weight sync automatically.\n\n## When to Use torchforge\n\n**Choose torchforge when you need:**\n- Clean separation between RL algorithms and infrastructure\n- PyTorch-native abstractions (no Ray dependency)\n- Easy algorithm experimentation (GRPO, DAPO, SAPO in ~100 lines)\n- Scalable training with Monarch actor system\n- Integration with TorchTitan for model parallelism\n\n**Consider alternatives when:**\n- You need production-ready stability → use **miles** or **verl**\n- You want Megatron-native training → use **slime**\n- torchforge is experimental and APIs may change\n\n## Key Features\n\n- **Algorithm isolation**: Implement RL algorithms without touching infrastructure\n- **Scalability**: From single GPU to thousands via Monarch\n- **Modern stack**: TorchTitan (training), vLLM (inference), TorchStore (sync)\n- **Loss functions**: GRPO, DAPO, CISPO, GSPO, SAPO built-in\n\n## Architecture Overview\n\n```\n┌─────────────────────────────────────────────────────────┐\n│ Application Layer (Your Code)                           │\n│ - Define reward models, loss functions, sampling        │\n└─────────────────────┬───────────────────────────────────┘\n                      │\n┌─────────────────────▼───────────────────────────────────┐\n│ Forge API Layer                                         │\n│ - Episode, Group dataclasses                           │\n│ - Service interfaces (async\u002Fawait)                      │\n└─────────────────────┬───────────────────────────────────┘\n                      │\n┌─────────────────────▼───────────────────────────────────┐\n│ Distributed Services (Monarch)                          │\n│ ├── Trainer (TorchTitan FSDP)                          │\n│ ├── Generator (vLLM inference)                          │\n│ ├── Reference Model (frozen KL baseline)               │\n│ └── Reward Actors (compute rewards)                    │\n└─────────────────────────────────────────────────────────┘\n```\n\n## Installation\n\n```bash\n# Create environment\nconda create -n forge python=3.12\nconda activate forge\n\n# Install (handles PyTorch nightly + dependencies)\n.\u002Fscripts\u002Finstall.sh\n\n# Verify\npython -c \"import torch, forge, vllm; print('OK')\"\n```\n\n### ROCm Installation\n\n```bash\n.\u002Fscripts\u002Finstall_rocm.sh\n```\n\n## Quick Start\n\n### SFT Training (2+ GPUs)\n\n```bash\npython -m apps.sft.main --config apps\u002Fsft\u002Fllama3_8b.yaml\n```\n\n### GRPO Training (3+ GPUs)\n\n```bash\npython -m apps.grpo.main --config apps\u002Fgrpo\u002Fqwen3_1_7b.yaml\n```\n\n---\n\n## Workflow 1: GRPO Training for Math Reasoning\n\nUse this workflow for training reasoning models with group-relative advantages.\n\n### Prerequisites Checklist\n- [ ] 3+ GPUs (GPU0: trainer, GPU1: ref_model, GPU2: generator)\n- [ ] Model from HuggingFace Hub\n- [ ] Training dataset (GSM8K, MATH, etc.)\n\n### Step 1: Create Configuration\n\n```yaml\n# config\u002Fgrpo_math.yaml\nmodel: \"Qwen\u002FQwen2.5-7B-Instruct\"\n\ndataset:\n  path: \"openai\u002Fgsm8k\"\n  split: \"train\"\n  streaming: true\n\ntraining:\n  batch_size: 4\n  learning_rate: 1e-6\n  seq_len: 4096\n  dtype: bfloat16\n  gradient_accumulation_steps: 4\n\ngrpo:\n  n_samples: 8           # Responses per prompt\n  clip_low: 0.2\n  clip_high: 0.28\n  beta: 0.1              # KL penalty coefficient\n  temperature: 0.7\n\nservices:\n  generator:\n    procs: 1\n    num_replicas: 1\n    with_gpus: true\n  trainer:\n    procs: 1\n    num_replicas: 1\n    with_gpus: true\n  ref_model:\n    procs: 1\n    num_replicas: 1\n    with_gpus: true\n```\n\n### Step 2: Define Reward Function\n\n```python\n# rewards.py\n# Reward functions are in forge.data.rewards\nfrom forge.data.rewards import MathReward, ThinkingReward\nimport re\n\n# Or define your own reward function\nclass CustomMathReward:\n    def __call__(self, prompt: str, response: str, target: str) -> float:\n        # Extract answer from response\n        match = re.search(r'\\\\boxed{([^}]+)}', response)\n        if not match:\n            return 0.0\n\n        answer = match.group(1).strip()\n        return 1.0 if answer == target else 0.0\n```\n\n### Step 3: Launch Training\n\n```bash\npython -m apps.grpo.main --config config\u002Fgrpo_math.yaml\n```\n\n### Step 4: Monitor Progress\n- [ ] Check W&B dashboard for loss curves\n- [ ] Verify entropy is decreasing (policy becoming more deterministic)\n- [ ] Monitor KL divergence (should stay bounded)\n\n---\n\n## Workflow 2: Custom Loss Function\n\nUse this workflow to implement new RL algorithms.\n\n### Step 1: Create Loss Class\n\n```python\n# src\u002Fforge\u002Flosses\u002Fcustom_loss.py\nimport torch\nimport torch.nn as nn\n\nclass CustomLoss(nn.Module):\n    def __init__(self, clip_range: float = 0.2, beta: float = 0.1):\n        super().__init__()\n        self.clip_range = clip_range\n        self.beta = beta\n\n    def forward(\n        self,\n        logprobs: torch.Tensor,\n        ref_logprobs: torch.Tensor,\n        advantages: torch.Tensor,\n        padding_mask: torch.Tensor,\n    ) -> torch.Tensor:\n        # Compute importance ratio\n        ratio = torch.exp(logprobs - ref_logprobs)\n\n        # Clipped policy gradient\n        clipped_ratio = torch.clamp(\n            ratio,\n            1 - self.clip_range,\n            1 + self.clip_range\n        )\n        pg_loss = -torch.min(ratio * advantages, clipped_ratio * advantages)\n\n        # KL penalty\n        kl = ref_logprobs - logprobs\n\n        # Apply mask and aggregate\n        masked_loss = (pg_loss + self.beta * kl) * padding_mask\n        loss = masked_loss.sum() \u002F padding_mask.sum()\n\n        return loss\n```\n\n### Step 2: Integrate into Application\n\n```python\n# apps\u002Fcustom\u002Fmain.py\nfrom forge.losses.custom_loss import CustomLoss\n\nloss_fn = CustomLoss(clip_range=0.2, beta=0.1)\n\n# In training loop\nloss = loss_fn(\n    logprobs=logprobs,\n    ref_logprobs=ref_logprobs,\n    advantages=advantages,\n    padding_mask=padding_mask,\n)\n```\n\n---\n\n## Workflow 3: Multi-GPU Distributed Training\n\nUse this workflow for scaling to multiple GPUs or nodes.\n\n### Configuration for Distributed\n\n```yaml\n# config\u002Fdistributed.yaml\nmodel: \"meta-llama\u002FMeta-Llama-3.1-8B-Instruct\"\n\nparallelism:\n  tensor_parallel_degree: 2    # Split model across GPUs\n  pipeline_parallel_degree: 1\n  data_parallel_shard_degree: 2\n\nservices:\n  generator:\n    procs: 2                   # 2 processes for TP=2\n    num_replicas: 1\n    with_gpus: true\n  trainer:\n    procs: 2\n    num_replicas: 1\n    with_gpus: true\n```\n\n### Launch with SLURM\n\n```bash\n# Submit job\nsbatch --nodes=2 --gpus-per-node=8 run_grpo.sh\n```\n\n### Launch Locally (Multi-GPU)\n\n```bash\n# 8 GPU setup\npython -m apps.grpo.main \\\n    --config config\u002Fdistributed.yaml \\\n    --trainer.procs 4 \\\n    --generator.procs 4\n```\n\n---\n\n## Core API Reference\n\n### Training Batch Format\n\ntorchforge uses dictionary-based batches for training:\n\n```python\n# inputs: list of dicts with torch.Tensor values\ninputs = [{\"tokens\": torch.Tensor}]\n\n# targets: list of dicts with training signals\ntargets = [{\n    \"response\": torch.Tensor,\n    \"ref_logprobs\": torch.Tensor,\n    \"advantages\": torch.Tensor,\n    \"padding_mask\": torch.Tensor\n}]\n\n# train_step returns loss as float\nloss = trainer.train_step(inputs, targets)\n```\n\n### Completion\n\nGenerated output from vLLM:\n\n```python\n@dataclass\nclass Completion:\n    text: str              # Generated text\n    token_ids: list[int]   # Token IDs\n    logprobs: list[float]  # Log probabilities\n    metadata: dict         # Custom metadata\n```\n\n---\n\n## Built-in Loss Functions\n\n### Loss Functions\n\nLoss functions are in the `forge.losses` module:\n\n```python\nfrom forge.losses import SimpleGRPOLoss, ReinforceLoss\n\n# SimpleGRPOLoss for GRPO training\nloss_fn = SimpleGRPOLoss(beta=0.1)\n\n# Forward pass\nloss = loss_fn(\n    logprobs=logprobs,\n    ref_logprobs=ref_logprobs,\n    advantages=advantages,\n    padding_mask=padding_mask\n)\n```\n\n### ReinforceLoss\n\n```python\nfrom forge.losses.reinforce_loss import ReinforceLoss\n\n# With optional importance ratio clipping\nloss_fn = ReinforceLoss(clip_ratio=0.2)\n```\n\n---\n\n## Common Issues and Solutions\n\n### Issue: Not Enough GPUs\n\n**Symptoms**: \"Insufficient GPU resources\" error\n\n**Solutions**:\n```yaml\n# Reduce service requirements\nservices:\n  generator:\n    procs: 1\n    with_gpus: true\n  trainer:\n    procs: 1\n    with_gpus: true\n  # Remove ref_model (uses generator weights)\n```\n\nOr use CPU for reference model:\n```yaml\nref_model:\n  with_gpus: false\n```\n\n### Issue: OOM During Generation\n\n**Symptoms**: CUDA OOM in vLLM\n\n**Solutions**:\n```yaml\n# Reduce batch size\ngrpo:\n  n_samples: 4  # Reduce from 8\n\n# Or reduce sequence length\ntraining:\n  seq_len: 2048\n```\n\n### Issue: Slow Weight Sync\n\n**Symptoms**: Long pauses between training and generation\n\n**Solutions**:\n```bash\n# Enable RDMA (if available)\nexport TORCHSTORE_USE_RDMA=1\n\n# Or reduce sync frequency\ntraining:\n  sync_interval: 10  # Sync every 10 steps\n```\n\n### Issue: Policy Collapse\n\n**Symptoms**: Entropy drops to zero, reward stops improving\n\n**Solutions**:\n```yaml\n# Increase KL penalty\ngrpo:\n  beta: 0.2  # Increase from 0.1\n\n# Or add entropy bonus\ntraining:\n  entropy_coef: 0.01\n```\n\n---\n\n## Resources\n\n- **Documentation**: https:\u002F\u002Fmeta-pytorch.org\u002Ftorchforge\n- **GitHub**: https:\u002F\u002Fgithub.com\u002Fmeta-pytorch\u002Ftorchforge\n- **Discord**: https:\u002F\u002Fdiscord.gg\u002FYsTYBh6PD9\n- **TorchTitan**: https:\u002F\u002Fgithub.com\u002Fpytorch\u002Ftorchtitan\n- **Monarch**: https:\u002F\u002Fgithub.com\u002Fmeta-pytorch\u002Fmonarch\n\n",{"name":5,"tags":23,"author":31,"license":14,"version":32,"description":7,"dependencies":33},[24,25,26,27,28,29,30],"Reinforcement Learning","PyTorch","GRPO","SFT","Monarch","TorchTitan","Meta","Orchestra Research","1.0.0",[34,35,36,37],"torch>=2.9.0","torchtitan>=0.2.0","vllm","monarch","main","46e03791269608c5ac886a64c08f5d94147e8786","labs\u002F.claude\u002Fskills\u002Ftorchforge","https:\u002F\u002Fgithub.com\u002Fbeyondai\u002Fsandbox","https:\u002F\u002Fgithub.com\u002Fbeyondai","2026-11-08 04:18:42",{"source":8,"skillName":5,"commands":45,"prompt":55,"zipAvailable":56},[46,49,52],{"tool":47,"command":48},"npx","npx skills add beyondai\u002Fsandbox --skill torchforge-rl-training",{"tool":50,"command":51},"bunx","bunx skills add beyondai\u002Fsandbox --skill torchforge-rl-training",{"tool":53,"command":54},"pnpm","pnpm dlx skills add beyondai\u002Fsandbox --skill torchforge-rl-training","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fbeyondai\u002Fsandbox\u002Fblob\u002Fmain\u002Flabs\u002F.claude\u002Fskills\u002Ftorchforge\u002FSKILL.md",true,[58,64],{"path":59,"resourceType":60,"resourceTypeDesc":61,"sizeBytes":62,"sourceHtmlUrl":63},"references\u002Fapi-reference.md","REFERENCE","参考文档",8685,"https:\u002F\u002Fgithub.com\u002Fbeyondai\u002Fsandbox\u002Fblob\u002Fmain\u002Flabs\u002F.claude\u002Fskills\u002Ftorchforge\u002Freferences\u002Fapi-reference.md",{"path":65,"resourceType":60,"resourceTypeDesc":61,"sizeBytes":66,"sourceHtmlUrl":67},"references\u002Ftroubleshooting.md",6709,"https:\u002F\u002Fgithub.com\u002Fbeyondai\u002Fsandbox\u002Fblob\u002Fmain\u002Flabs\u002F.claude\u002Fskills\u002Ftorchforge\u002Freferences\u002Ftroubleshooting.md",[69,76,83,90,97,104],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":18},"01M7D3GMPGJZRG8EPY404YF8TR","weights-and-biases","Track ML experiments with automatic logging, visualize training in real-time, optimize hyperparameters with sweeps, and manage model registry with W&B - collaborative MLOps platform","https:\u002F\u002Fgithub.com\u002Fbeyondai\u002Fsandbox\u002Fblob\u002Fmain\u002Flabs\u002F.opencode\u002Fskills\u002Fweights-and-biases\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":18},"01M7D3GFZH440V2J532BSZMPVP","serving-llms-vllm","Serves LLMs with high throughput using vLLM's PagedAttention and continuous batching. Use when deploying production LLM APIs, optimizing inference latency\u002Fthroughput, or serving models with limited GPU memory. Supports OpenAI-compatible endpoints, quantization (GPTQ\u002FAWQ\u002FFP8), and tensor parallelism.","https:\u002F\u002Fgithub.com\u002Fbeyondai\u002Fsandbox\u002Fblob\u002Fmain\u002Flabs\u002F.opencode\u002Fskills\u002Fvllm\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":18},"01M7D3GAE8MQCPGF72EP9G9GKY","verl-rl-training","Provides guidance for training LLMs with reinforcement learning using verl (Volcano Engine RL). Use when implementing RLHF, GRPO, PPO, or other RL algorithms for LLM post-training at scale with flexible infrastructure backends.","https:\u002F\u002Fgithub.com\u002Fbeyondai\u002Fsandbox\u002Fblob\u002Fmain\u002Flabs\u002F.opencode\u002Fskills\u002Fverl\u002FSKILL.md",[],[],{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":18},"01M7D3G7KKNE5RGNYJNXV4F0MM","unsloth","Expert guidance for fast fine-tuning with Unsloth - 2-5x faster training, 50-80% less memory, LoRA\u002FQLoRA optimization","https:\u002F\u002Fgithub.com\u002Fbeyondai\u002Fsandbox\u002Fblob\u002Fmain\u002Flabs\u002F.opencode\u002Fskills\u002Funsloth\u002FSKILL.md",[],[],{"skillNo":98,"name":99,"nameZh":6,"description":100,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":18},"01M7D3G2RCZQ08GS0KAW5CBWSC","fine-tuning-with-trl","Fine-tune LLMs using reinforcement learning with TRL - SFT for instruction tuning, DPO for preference alignment, PPO\u002FGRPO for reward optimization, and reward model training. Use when need RLHF, align model with preferences, or train from human feedback. Works with HuggingFace Transformers.","https:\u002F\u002Fgithub.com\u002Fbeyondai\u002Fsandbox\u002Fblob\u002Fmain\u002Flabs\u002F.opencode\u002Fskills\u002Ftrl-fine-tuning\u002FSKILL.md",[],[],{"skillNo":105,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":106,"categories":107,"keywords":108,"publishedAt":18},"01M7D3FX08BPB172CYGM597NZF","https:\u002F\u002Fgithub.com\u002Fbeyondai\u002Fsandbox\u002Fblob\u002Fmain\u002Flabs\u002F.opencode\u002Fskills\u002Ftorchforge\u002FSKILL.md",[],[]]