Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/cxcscmu/skilllearnbench/simpo-loss-implementationnpx skills add cxcscmu/SkillLearnBench --skill simpo-loss-implementationgit clone --depth 1 https://github.com/cxcscmu/SkillLearnBenchWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/cxcscmu/skilllearnbench/simpo-loss-implementation)<a href="https://agentmods.dev/skills/cxcscmu/skilllearnbench/simpo-loss-implementation"><img src="https://agentmods.dev/badge/skills/cxcscmu/skilllearnbench/simpo-loss-implementation.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00034 | $0.00566 |
| Opus 5 | $0.00017 | $0.00283 |
| Sonnet 5 | $0.00007 | $0.00113 |
| Haiku 4.5 | $0.00003 | $0.00057 |
Grade A, and why
simpo-loss-implementation scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 65 lines — stays where its author put it; the contents beside it link to each section on GitHub.
SimPO Loss Implementation
SimPO is a reference-free preference optimization algorithm that uses length-normalized log probabilities as rewards and incorporates a target reward margin.
Mathematical Formulation
The SimPO loss is defined as: $$L_{SimPO}(\pi_\theta) = -\mathbb{E}{(x, y_w, y_l) \sim \mathcal{D}} \left[ \log \sigma \left( \beta r\theta(x, y_w) - \beta r_\theta(x, y_l) - \gamma \right) \right]$$
Where:
- $r_\theta(x, y) = \frac{1}{|y|} \log \pi_\theta(y|x)$ is the length-normalized log probability.
- $\beta$ is a scaling factor.
- $\gamma$ is the target reward margin.
PyTorch Implementation
import torch
import torch.nn.functional as F
def simpo_loss(
policy_chosen_logps: torch.FloatTensor,
policy_rejected_logps: torch.FloatTensor,
beta: float,
gamma: float,
label_smoothing: float = 0.0,
loss_type: str = "sigmoid"
):
"""
Args:
policy_chosen_logps: Average log probabilities of the chosen responses. (batch_size,)
policy_rejected_logps: Average log probabilities of the rejected responses. (batch_size,)
beta: Scaling factor for rewards.
gamma: Target reward margin.
label_smoothing: Label smoothing factor.
loss_type: Type of loss ("sigmoid" or "hinge").
"""
# rewards are beta * average logps
chosen_rewards = beta * policy_chosen_logps
rejected_rewards = beta * policy_rejected_logps
logits = chosen_rewards - rejected_rewards - gamma
if loss_type == "sigmoid":
losses = (
-F.logsigmoid(logits) * (1 - label_smoothing)
- F.logsigmoid(-logits) * label_smoothing
)
elif loss_type == "hinge":
losses = torch.relu(1 - logits)
else:
raise ValueError(f"Unknown loss type: {loss_type}")
return losses, chosen_rewards, rejected_rewards
Usage in Trainer
In a trainer class, ensure that policy_chosen_logps and policy_rejected_logps are already length-normalized (divided by the number of non-padded tokens).
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- yesterday First seen · 65 lines · 34 tokens per session scan A b4e7e2ed4cc0
simpo-loss-implementation is a skill published in the GitHub repository cxcscmu/SkillLearnBench (83 stars, last pushed 1mo ago), licensed MIT. It adds 34 tokens to every session and 566 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.
Other skills, from other repositories
trl
Reference for the TRL (Transformer Reinforcement Learning) library codebase. Use proactively before reading or editing any file under trl/ so you have the intended contracts and invariants in mind, not just what the current code says. Covers trainer hierarchy (SFT, DPO, GRPO, KTO), shared utility functions…
Pré-processamento de áudio para transcrição Whisper
Executa o pipeline de redução de ruído e normalização de volume em arquivos de áudio usando Python (bibliotecas como Silero, noisereduce, numpy e scipy) para otimizar a entrada para modelos de reconhecimento de voz como o Whisper.
pytorch-patterns
PyTorch deep learning patterns and best practices for building robust, efficient, and reproducible training pipelines, model architectures, and data loading.
azure-mgmt-fabric-py
Azure Fabric Management SDK for Python. Use for managing Microsoft Fabric capacities and resources. Triggers: "azure-mgmt-fabric", "FabricMgmtClient", "Fabric capacity", "Microsoft Fabric", "Power BI capacity".
data360-code-extension-generate
Develop and deploy Data Cloud Code Extensions using SF CLI plugin. Use this skill when creating custom Python transformations for Data Cloud, deploying code extensions, or testing data transformations. Supports init, run, scan, and deploy operations.
pcap-analysis
Guidance for analyzing network packet captures (PCAP files) and computing network statistics using Python, with tested utility functions.