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 skills add cxcscmu/SkillLearnBench --skill simpo-loss-functiongit 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-function)<a href="https://agentmods.dev/skills/cxcscmu/skilllearnbench/simpo-loss-function"><img src="https://agentmods.dev/badge/skills/cxcscmu/skilllearnbench/simpo-loss-function/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/cxcscmu/skilllearnbench/simpo-loss-function"><img src="https://agentmods.dev/badge/skills/cxcscmu/skilllearnbench/simpo-loss-function.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector pass
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.1 | $0.00018 | $0.00724 |
| Opus 5.5 | $0.00007 | $0.00290 |
| Sonnet 5.5 | $0.00004 | $0.00145 |
| Haiku 4.5 | $0.00002 | $0.00072 |
Grade A, and why
simpo-loss-function 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 1mo ago.
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 — 83 lines — stays where its author put it; the contents beside it link to each section on GitHub.
SimPO Loss Function Implementation
Overview
SimPO (Simple Preference Optimization) implements a preference optimization objective that uses length-normalized average log probability as an implicit reward, with a target reward margin component.
Key Formula
L_SimPO(πθ) = -E_(x,yw,yl)~D log σ(β/|yw| log πθ(yw|x) - β/|yl| log πθ(yl|x) - γ)
Components
1. Length-Normalized Reward
- Formula:
r_SimPO(x, y) = β/|y| * log πθ(y|x) - Purpose: Average log probability per token, prevents length bias
- Why: Aligns training with generation metric (which uses average log likelihood for beam search)
2. Bradley-Terry Objective
- Formula:
p(yw ≻ yl | x) = σ(r(x, yw) - r(x, yl) - γ) - Purpose: Probabilistic ranking between winning and losing responses
- Function: σ is sigmoid function
3. Target Reward Margin (γ)
- Purpose: Ensure reward difference exceeds a target threshold
- Effect: Improves generalization by enforcing margin between classes
- Typical range: 0.5 to 1.5
Implementation Details
Computing Log Probabilities
# log_probs shape: (batch_size, seq_len)
# Sum across sequence dimension to get total log probability
log_prob_sum = log_probs.sum(dim=1) # (batch_size,)
# Divide by sequence length for normalization
seq_lengths = (input_ids != pad_token_id).sum(dim=1) # (batch_size,)
avg_log_prob = log_prob_sum / seq_lengths.float() # (batch_size,)
Computing Reward Differences
# Batch structure: pairs of (winning, losing) responses
batch_size = avg_log_probs.shape[0]
winning_rewards = avg_log_probs[:batch_size//2]
losing_rewards = avg_log_probs[batch_size//2:]
# Reward difference with margin
reward_diff = beta * winning_rewards - beta * losing_rewards - gamma
Computing Loss
# Bradley-Terry with sigmoid
import torch.nn.functional as F
sigmoid_term = torch.sigmoid(reward_diff)
loss = -torch.log(sigmoid_term).mean()
Common Pitfalls
- Not using length normalization: Creates bias toward longer sequences
- Wrong batch structure: Ensure paired winning/losing responses
- Missing average in log probabilities: Use sum/length, not just sum
- Gradient flow: Ensure no detach() breaks gradients to model
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.
- 1mo ago First seen · 83 lines · 18 tokens per session scan A dd61897e5dbb
simpo-loss-function is a skill published in the GitHub repository cxcscmu/SkillLearnBench (88 stars, last pushed 17d ago), licensed MIT. It adds 18 tokens to every session and 724 once invoked, about $0.0001 per session on Opus 5.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-08-30.
Other skills, from other repositories
gpt-multimodal
Analyze images and multi-frame sequences using OpenAI GPT series.
senior-data-engineer
World-class data engineering skill for building scalable data pipelines, ETL/ELT systems, real-time streaming, and data infrastructure. Expertise in Python, SQL, Spark, Airflow, dbt, Kafka, Flink, Kinesis, and modern data stack. Includes data modeling, pipeline orchestration, data quality, streaming quality…
Speaker Clustering Methods
Choose and implement clustering algorithms for grouping speaker embeddings after VAD and embedding extraction. Compare Hierarchical clustering (auto-tunes speaker count), KMeans (fast, requires known count), and Agglomerative clustering (fixed clusters). Use Hierarchical clustering when speaker count is unknown…
prefix-cache-replay
Replay an LLM inference request trace (Mooncake / vLLM / SGLang hashids format) against a block-level KV prefix cache and compute hit statistics. Use when given a request trace plus cache configuration and asked for hit rate, hit tokens, or final cache contents. Covers the longest-contiguous-prefix semantics that…
seisbench-model-api
An overview of the core model API of SeisBench, a Python framework for training and applying machine learning algorithms to seismic data. It is useful for annotating waveforms using pretrained SOTA ML models, for tasks like phase picking, earthquake detection, waveform denoising and depth estimation. For any waveform…
cache-policy-comparison
Compare and implement eviction policies (LRU, LFU, FIFO, S3FIFO, ARC) for bounded-capacity caches. Use when choosing or implementing an eviction policy for a buffer pool, page cache, CDN edge, or LLM KV cache, or when writing a replay simulator that supports multiple policies. Clarifies recency vs frequency semantics…