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/pytorch-preference-optimizationnpx skills add cxcscmu/SkillLearnBench --skill pytorch-preference-optimizationgit 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/pytorch-preference-optimization)<a href="https://agentmods.dev/skills/cxcscmu/skilllearnbench/pytorch-preference-optimization"><img src="https://agentmods.dev/badge/skills/cxcscmu/skilllearnbench/pytorch-preference-optimization.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.1 | $0.00029 | $0.00297 |
| Opus 5 | $0.00015 | $0.00148 |
| Sonnet 5 | $0.00006 | $0.00059 |
| Haiku 4.5 | $0.00003 | $0.00030 |
Grade A, and why
pytorch-preference-optimization 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.
What it actually says
PyTorch Preference Optimization Patterns
Key Functions
torch.nn.functional.logsigmoid(x): Numerically stable log-sigmoid, used in Bradley-Terry losses.torch.relu(x): Used for hinge-loss variants.torch.FloatTensor: Common type for log probability tensors.
Implementation Pattern
import torch
import torch.nn.functional as F
def preference_loss(chosen_logps, rejected_logps, beta, gamma, label_smoothing=0.0, loss_type="sigmoid"):
logits = beta * (chosen_logps - rejected_logps) - 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)
chosen_rewards = beta * chosen_logps.detach()
rejected_rewards = beta * rejected_logps.detach()
return losses, chosen_rewards, rejected_rewards
Environment Setup
- trl==0.9.6 is needed for compatibility with older SimPO codebases (CPOTrainer import).
- PyTorch CPU is sufficient for loss computation testing.
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 · 37 lines · 29 tokens per session scan A 78924966a723
pytorch-preference-optimization is a skill published in the GitHub repository cxcscmu/SkillLearnBench (83 stars, last pushed 1mo ago), licensed MIT. It adds 29 tokens to every session and 297 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-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.