[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6KK70DH9RF56V68HCK9GNPC":3,"skill-same:01M6KK70DH9RF56V68HCK9GNPC":46},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":6,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":14,"categories":15,"keywords":16,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":31,"install":32,"resources":45},"01M6KK70DH9RF56V68HCK9GNPC","simpo-loss",null,"cxcscmu\u002FSkillLearnBench","cxcscmu","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F142838272?v=4","01M6KCQDFQWPDSN0MKZY96MSQP","01M6KCQDM7G70TKJ28NTSQC0RZ",93,"MIT","https:\u002F\u002Fgithub.com\u002Fcxcscmu\u002FSkillLearnBench\u002Fblob\u002Fmain\u002Fskills\u002Fb4-skill-creator-claude-sonnet-4-6\u002Fnlp-paper-reproduction\u002Fsimpo-loss\u002FSKILL.md",[],[17,18],"simpo","simpo loss","2026-11-10 10:12:30",false,"---\nname: simpo-loss\ndescription: Implement the SimPO (Simple Preference Optimization) loss function for LLM alignment. Use this skill whenever implementing SimPO training objectives, reference-free reward optimization, or Bradley-Terry preference loss with target reward margin. Triggers on: SimPO, preference optimization loss, average log probability reward, gamma margin.\n---\n\n# SimPO Loss Implementation\n\n## Paper Reference\n\"SimPO: Simple Preference Optimization with a Reference-Free Reward\" (Meng et al., 2024)\n\n## Core Formula\n\nThe SimPO objective (Eq. 6 from paper):\n\n```\nL_SimPO(π_θ) = -E[(x,yw,yl)~D] [log σ(β\u002F|yw| * log π_θ(yw|x) - β\u002F|yl| * log π_θ(yl|x) - γ)]\n```\n\nWhere:\n- `β` (beta): scaling factor for rewards\n- `γ` (gamma): target reward margin = `gamma_beta_ratio * beta`\n- `|yw|`, `|yl|`: sequence lengths of winning\u002Flosing responses (used for length normalization)\n- `σ`: sigmoid function\n\n## Key Design: Length-Normalized Reward\n\nThe implicit reward is the **average log probability** (not sum):\n```\nr(x, y) = β\u002F|y| * log π_θ(y|x) = β * avg_log_prob(y)\n```\n\nThis aligns with the generation metric (average log-likelihood).\n\n## Implementation\n\n```python\ndef simpo_loss(self, policy_chosen_logps, policy_rejected_logps):\n    \"\"\"\n    Args:\n        policy_chosen_logps: Average log probs for chosen. Shape: (batch_size,)\n        policy_rejected_logps: Average log probs for rejected. Shape: (batch_size,)\n\n    Note: inputs are already length-normalized (average_log_prob=True upstream)\n    \"\"\"\n    # Compute rewards (beta * avg_log_prob)\n    chosen_rewards = self.beta * policy_chosen_logps\n    rejected_rewards = self.beta * policy_rejected_logps\n\n    # gamma = gamma_beta_ratio * beta\n    gamma = self.gamma_beta_ratio * self.beta\n\n    # Reward difference with target margin\n    logits = chosen_rewards - rejected_rewards - gamma\n\n    if self.loss_type == \"sigmoid\":\n        # With optional label smoothing\n        losses = (\n            -F.logsigmoid(logits) * (1 - self.label_smoothing)\n            - F.logsigmoid(-logits) * self.label_smoothing\n        )\n    elif self.loss_type == \"hinge\":\n        losses = torch.relu(1 - logits)\n    else:\n        raise ValueError(f\"Unknown loss type: {self.loss_type}\")\n\n    return losses, chosen_rewards, rejected_rewards\n```\n\n## Config Parameters\n\nFrom `SimPOConfig`:\n- `beta: float = 2.0` - reward scaling\n- `gamma_beta_ratio: float = 0.25` - γ\u002Fβ ratio, so γ = 0.25 * 2.0 = 0.5 by default\n- `label_smoothing: float = 0` - smoothing for sigmoid loss\n- `loss_type: Literal[\"sigmoid\", \"hinge\"] = \"sigmoid\"`\n\n## Notes\n\n- `gamma_beta_ratio` represents γ\u002Fβ, so actual gamma = `gamma_beta_ratio * beta`\n- The logps passed in are already averaged (from `get_batch_logps` with `average_log_prob=True`)\n- Rewards are beta-scaled average log probabilities\n- No reference model needed (reference-free)\n","# SimPO Loss Implementation\n\n## Paper Reference\n\"SimPO: Simple Preference Optimization with a Reference-Free Reward\" (Meng et al., 2024)\n\n## Core Formula\n\nThe SimPO objective (Eq. 6 from paper):\n\n```\nL_SimPO(π_θ) = -E[(x,yw,yl)~D] [log σ(β\u002F|yw| * log π_θ(yw|x) - β\u002F|yl| * log π_θ(yl|x) - γ)]\n```\n\nWhere:\n- `β` (beta): scaling factor for rewards\n- `γ` (gamma): target reward margin = `gamma_beta_ratio * beta`\n- `|yw|`, `|yl|`: sequence lengths of winning\u002Flosing responses (used for length normalization)\n- `σ`: sigmoid function\n\n## Key Design: Length-Normalized Reward\n\nThe implicit reward is the **average log probability** (not sum):\n```\nr(x, y) = β\u002F|y| * log π_θ(y|x) = β * avg_log_prob(y)\n```\n\nThis aligns with the generation metric (average log-likelihood).\n\n## Implementation\n\n```python\ndef simpo_loss(self, policy_chosen_logps, policy_rejected_logps):\n    \"\"\"\n    Args:\n        policy_chosen_logps: Average log probs for chosen. Shape: (batch_size,)\n        policy_rejected_logps: Average log probs for rejected. Shape: (batch_size,)\n\n    Note: inputs are already length-normalized (average_log_prob=True upstream)\n    \"\"\"\n    # Compute rewards (beta * avg_log_prob)\n    chosen_rewards = self.beta * policy_chosen_logps\n    rejected_rewards = self.beta * policy_rejected_logps\n\n    # gamma = gamma_beta_ratio * beta\n    gamma = self.gamma_beta_ratio * self.beta\n\n    # Reward difference with target margin\n    logits = chosen_rewards - rejected_rewards - gamma\n\n    if self.loss_type == \"sigmoid\":\n        # With optional label smoothing\n        losses = (\n            -F.logsigmoid(logits) * (1 - self.label_smoothing)\n            - F.logsigmoid(-logits) * self.label_smoothing\n        )\n    elif self.loss_type == \"hinge\":\n        losses = torch.relu(1 - logits)\n    else:\n        raise ValueError(f\"Unknown loss type: {self.loss_type}\")\n\n    return losses, chosen_rewards, rejected_rewards\n```\n\n## Config Parameters\n\nFrom `SimPOConfig`:\n- `beta: float = 2.0` - reward scaling\n- `gamma_beta_ratio: float = 0.25` - γ\u002Fβ ratio, so γ = 0.25 * 2.0 = 0.5 by default\n- `label_smoothing: float = 0` - smoothing for sigmoid loss\n- `loss_type: Literal[\"sigmoid\", \"hinge\"] = \"sigmoid\"`\n\n## Notes\n\n- `gamma_beta_ratio` represents γ\u002Fβ, so actual gamma = `gamma_beta_ratio * beta`\n- The logps passed in are already averaged (from `get_batch_logps` with `average_log_prob=True`)\n- Rewards are beta-scaled average log probabilities\n- No reference model needed (reference-free)\n",{},"main","726e1f79b96b0cb3d729d0e55a1c847e0b5353ae","skills\u002Fb4-skill-creator-claude-sonnet-4-6\u002Fnlp-paper-reproduction\u002Fsimpo-loss",8,"https:\u002F\u002Fgithub.com\u002Fcxcscmu\u002FSkillLearnBench","https:\u002F\u002Fcxcscmu.github.io\u002FSkillLearnBench","https:\u002F\u002Fgithub.com\u002Fcxcscmu","2026-10-02 22:55:36",{"source":7,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add cxcscmu\u002FSkillLearnBench --skill simpo-loss",{"tool":38,"command":39},"bunx","bunx skills add cxcscmu\u002FSkillLearnBench --skill simpo-loss",{"tool":41,"command":42},"pnpm","pnpm dlx skills add cxcscmu\u002FSkillLearnBench --skill simpo-loss","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fcxcscmu\u002FSkillLearnBench\u002Fblob\u002Fmain\u002Fskills\u002Fb4-skill-creator-claude-sonnet-4-6\u002Fnlp-paper-reproduction\u002Fsimpo-loss\u002FSKILL.md",true,[],[47,60,82,100,120,131],{"skillNo":48,"name":49,"nameZh":6,"description":50,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":6,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":51,"categories":52,"keywords":53,"publishedAt":19},"01M6KM5KH175P5ABP5JMX2SBDQ","object_counter","Count occurrences of an object in the image using computer vision algorithm.","https:\u002F\u002Fgithub.com\u002Fcxcscmu\u002FSkillLearnBench\u002Fblob\u002Fmain\u002Fskills\u002Fhuman_authored\u002Fvideo-object-counting\u002Fobject_counter\u002FSKILL.md",[],[54,55,56,57,58,59],"object counter","object","vision","computer","Computer Vision","image",{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":6,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":19},"01M6KM51TMVXG79MMPCS6Y8G86","travel-planning-workflow","Invoke this skill when performing travel planning. It defines a structured workflow for generating itineraries. Following this workflow is essential to ensure the final plan satisfies user requirements.","https:\u002F\u002Fgithub.com\u002Fcxcscmu\u002FSkillLearnBench\u002Fblob\u002Fmain\u002Fskills\u002Fhuman_authored\u002Ftravel-planning\u002Ftravel-planning-workflow\u002FSKILL.md",[],[67,68,69,70,71,72,73,74,75,76,77,78,79,80,81],"workflow","planning","planning workflow","travel","travel planning","travel planning workflow","structured","performing","plan","for","user","it","requirements","essential","itineraries",{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":6,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":19},"01M6KM4DY820XHS9YTSK5QP5HD","bundled-dataset-search-tool","invoke this skill when you need to perform database search for travel planning. This skill provides some useful pre-packaged tools to look up accommodations, attractions, cities, driving distance, flights, and restaurants from the bundled dataset.","https:\u002F\u002Fgithub.com\u002Fcxcscmu\u002FSkillLearnBench\u002Fblob\u002Fmain\u002Fskills\u002Fhuman_authored\u002Ftravel-planning\u002Fbundled-dataset-search-tool\u002FSKILL.md",[],[89,90,91,92,93,94,95,70,96,97,71,98,76,99,68],"search","tool","dataset","bundled dataset search tool","restaurants","Tools","up","look","flights","you","database",{"skillNo":101,"name":102,"nameZh":6,"description":103,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":6,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":104,"categories":105,"keywords":106,"publishedAt":19},"01M6KM465BB9PQ0B548HQSVAWZ","glm-output","Output-processing guidance for GLM tasks. Especially useful after glm-basics and glm-calibration when you need verifier-matching metrics from output.nc and a final \u002Froot\u002Fmetrics.json.","https:\u002F\u002Fgithub.com\u002Fcxcscmu\u002FSkillLearnBench\u002Fblob\u002Fmain\u002Fskills\u002Fhuman_authored\u002Ftemperature-simulation\u002Fglm-output\u002FSKILL.md",[],[107,108,109,76,110,111,112,113,114,115,116,117,98,118,119],"glm output","output","glm","tasks","metrics","json","basics","guidance","matching","verifier","processing","root","calibration",{"skillNo":121,"name":122,"nameZh":6,"description":123,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":6,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":124,"categories":125,"keywords":126,"publishedAt":19},"01M6KM40KY3QWDW5W97S39R2BC","glm-calibration","Calibration guidance for GLM tasks. Often most effective after glm-basics has clarified the setup; glm-output is the companion skill for exact final metric computation.","https:\u002F\u002Fgithub.com\u002Fcxcscmu\u002FSkillLearnBench\u002Fblob\u002Fmain\u002Fskills\u002Fhuman_authored\u002Ftemperature-simulation\u002Fglm-calibration\u002FSKILL.md",[],[127,119,109,108,114,113,110,128,129,76,130],"glm calibration","setup","companion","metric",{"skillNo":132,"name":133,"nameZh":6,"description":134,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":6,"repositoryNo":11,"starsCount":12,"licenseSpdxId":13,"licenseFileUrl":6,"sourceHtmlUrl":135,"categories":136,"keywords":137,"publishedAt":19},"01M6KM3VHHVSGMGHJQB3PPT6YG","glm-basics","A good starting point for GLM calibration tasks. Use to inspect glm3.nml, confirm how GLM runs, and identify the relevant files before moving on to calibration and output evaluation.","https:\u002F\u002Fgithub.com\u002Fcxcscmu\u002FSkillLearnBench\u002Fblob\u002Fmain\u002Fskills\u002Fhuman_authored\u002Ftemperature-simulation\u002Fglm-basics\u002FSKILL.md",[],[138,109,113,139,127,119,76,108,140,141,142,143,144,145,110],"glm basics","inspect","relevant","files","good","use","how","Evaluation"]