# Simpo Loss

> SimPO (Simple Preference Optimization) loss computation for LLM alignment without a reference model.

- Skill: `cxcscmu/simpo-loss` (Agent Skill)
- Install (CLI): `npx get-skill add cxcscmu/simpo-loss`
- Raw SKILL.md: https://api.skillmd.com/api/skills/cxcscmu/simpo-loss/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: cxcscmu (https://skillmd.com/u/cxcscmu)
- Updated: 2026-11-24
- Page: https://skillmd.com/skills/cxcscmu/simpo-loss

---


# SimPO Loss

## Overview
SimPO is a reference-free preference optimization algorithm. Its key innovation is using the **average log probability** of a sequence as the implicit reward, plus a **target reward margin** γ.

## Loss Formula (Eq. 6 from the paper)

```
L_SimPO = -E log σ(β/|yw| · log πθ(yw|x) - β/|yl| · log πθ(yl|x) - γ)
```

Since the log probabilities passed to `simpo_loss` are **already length-normalized** (average log prob), the loss simplifies to:

```
logits = β * policy_chosen_logps - β * policy_rejected_logps - γ
```

where `γ = gamma_beta_ratio * beta`.

## Loss Types

- **sigmoid** (default): `losses = -log σ(logits) * (1 - label_smoothing) - log σ(-logits) * label_smoothing`
- **hinge**: `losses = relu(1 - logits)`

## Rewards

- `chosen_rewards = β * policy_chosen_logps`
- `rejected_rewards = β * policy_rejected_logps`

## Default Hyperparameters
- β = 2.0
- gamma_beta_ratio = 0.25 (so γ = 0.5)
- label_smoothing = 0.0
- loss_type = "sigmoid"

