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-functionnpx skills add cxcscmu/SkillLearnBench --skill simpo-loss-functiongit clone --depth 1 https://github.com/cxcscmu/SkillLearnBenchWhat 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.00018 | $0.00724 |
| Opus 5 | $0.00009 | $0.00362 |
| Sonnet 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 2d 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.
- 2d 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 (82 stars, last pushed 1mo ago), licensed MIT. It adds 18 tokens to every session and 724 once invoked, about $0.0001 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-08-30.
Other skills, from other repositories
generating-mod-envs
Generates and reviews mod learning env JSON files for Letta Code local mods. Use when asked to teach, learn, or optimize a mod behavior; create, draft, validate, improve, or explain envs for /mods learn --env; or design evaluation scenarios, memory fixtures, requiredResultMarkers, requiredTraceMarkers, negative…
agentsop-signature-design
Decision rubric for promoting a prose prompt into a typed DSPy Signature. This is an ENHANCE overlay on top of the [[dspy]] library skill: it does NOT teach DSPy syntax — it answers the coder-agent decision "when do I stop hand-writing a prompt string and declare it as a dspy.Signature, and how do I name/describe its…
speech-to-text
Transcribe video to timestamped text using Whisper tiny model (pre-installed).
aspirations-spark
Runs the Spark Check (Phase 6) and Immediate Learning (Phase 6.5) of the aspirations loop: adaptive spark questions, all sq-XXX handlers (including sq-012 self-purpose update), aspiration-level spark, and immediate capture of reasoning-bank entries, guardrails, and forge awareness. Use whenever a goal completes — this…
respond
Handles every user message in assistant and autonomous modes: activates persona, runs mandatory 3-tier retrieval escalation (tree → codebase → web), detects and routes user directives (new aspirations, corrections, preferences), performs knowledge-freshness reconciliation, and captures interaction-level learning into…
start
Creates or resumes an agent in reader (read-only), assistant (user-directed), or autonomous mode (perpetual loop), handling full initialization for new agents (Self, program, paths, aspirations, curriculum) and state transitions for existing ones. USER-ONLY — Claude must NEVER invoke /start. Fires only when the user…