Skip to content
Skills Library
AI & agents · Testing

simpo-unit-test-execution

/simpo-unit-test-execution

How to correctly run the SimPO unit test to generate the loss.npz output file with reproducible results. Use when executing the unit test after implementing the loss function.

Licence
MIT
Last repository change
02.10.2026

Assessment and security

95/ 100Class: good
Format20 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 02.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

How to correctly run the SimPO unit test to generate the loss.npz output file with reproducible results. Use when executing the unit test after implementing the loss function.

Original author description

How to correctly run the SimPO unit test to generate the loss.npz output file with reproducible results. Use when executing the unit test after implementing the loss function.

How it works

  1. Running the SimPO Unit Test
Original SKILL.md headings · 58 lines, 268 words
SKILL.md preview
---
name: simpo-unit-test-execution
description: How to correctly run the SimPO unit test to generate the loss.npz output file with reproducible results. Use when executing the unit test after implementing the loss function.
---

## Running the SimPO Unit Test

### Prerequisites
- Python 3.10 environment is active
- `simpo_loss` function is correctly implemented in `/root/SimPO/scripts/simpo_trainer.py`
- All dependencies (torch, transformers, trl, accelerate, etc.) are installed

### Execution Steps

```bash
# 1. Ensure correct Python
source /root/SimPO/.venv/bin/activate  # or however the venv is activated
python -VV  # Must show Python 3.10.x

# 2. Run the unit test (DO NOT modify unit_test_1.py)
cd /root/SimPO
python unit_test/unit_test_1.py

# 3. Verify output exists
python -c "import numpy as np; data = np.load('/root/loss.npz'); print('losses:', data['losses'])"

# 4. Generate the python info file
python -VV > /root/python_info.txt 2>&1
python -m pip freeze >> /root/python_info.txt
```

### What the Unit Test Does

The unit test:
1. Creates fixed input tensors for `policy_chosen_logps` and `policy_rejected_logps`
2. Creates a SimPOTrainer (or mock) with specific `beta` and `gamma` values
3. Calls `simpo_loss()` with those fixed inputs
4. Saves the resulting losses to `/root/loss.npz` with key `'losses'`

### Verifying Correctness

The SimPO loss with sigmoid loss type should compute:
```
losses = -log(sigmoid(beta * (chosen_avg_logps - rejected_avg_logps - gamma)))
```

If the test provides specific beta and gamma values, you can manually verify:
```python
import torch
import torch.nn.functional as F

# Example verification
logits = policy_chosen_logps - policy_rejected_logps - gamma
losses = -F.logsigmoid(beta * logits)
```

### Important Notes

- Do NOT modify `unit_test_1.py` — it has fixed inputs for reproducibility
- The loss output must be deterministic (no randomness involved)
- Make sure `self.accelerator.device` is handled correctly; the unit test may mock or provide this
- If the unit test creates a minimal/mock trainer, ensure your `simpo_loss` method works with it

Versions

The database has no other skills named simpo-unit-test-execution.

Database snapshot: 13.11.2026 · package version e781c785bfbf (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 95run-simpo-with-python310-and-log
    Use this skill to execute the SimPO unit test with Python 3.10, save the loss results to /root/loss.npz, and log Python version and package info to /root/python_info.txt using the correct Python 3.10 executable.
  • 100simpo-loss
    Implements the SimPO (Simple Preference Optimization) loss function from the paper "SimPO: Simple Preference Optimization with a Reference-Free Reward". Use this when implementing or understanding SimPO training objectives.
  • 95simpo-training
    Simple Preference Optimization for LLM alignment. Reference-free alternative to DPO with better performance (+6.4 points on AlpacaEval 2.0). No reference model needed, more efficient than DPO. Use for preference alignment when want simpler, faster training than DPO/PPO.
  • 100preference-optimization
    Align a fine-tuned model with preference data using DPO, ORPO, KTO, or SimPO. Use when preference pairs or thumbs-up/down feedback exist, when choosing between preference-optimization methods, or when a DPO run needs hyperparameters or debugging.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.