Run3 simpo unit test execution
[COLM'26] SkillLearnBench is the first benchmark for evaluating continual learning methods that automatically generate agent skills.
npx -y skills add cxcscmu/SkillLearnBench --skill run3_simpo-unit-test-executionAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
What its author says it does
Copied from the file, not written here
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.
SKILL.md
2.1 KB, as published. Nobody here has run it
Running the SimPO Unit Test
Prerequisites
- Python 3.10 environment is active
simpo_lossfunction is correctly implemented in/root/SimPO/scripts/simpo_trainer.py- All dependencies (torch, transformers, trl, accelerate, etc.) are installed
Execution Steps
# 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:
- Creates fixed input tensors for
policy_chosen_logpsandpolicy_rejected_logps - Creates a SimPOTrainer (or mock) with specific
betaandgammavalues - Calls
simpo_loss()with those fixed inputs - Saves the resulting losses to
/root/loss.npzwith 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:
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.deviceis handled correctly; the unit test may mock or provide this - If the unit test creates a minimal/mock trainer, ensure your
simpo_lossmethod works with it