agentsclimarketplace

Run3 Implement SimPO Loss Function

Skill cxcscmu/SkillLearnBench/skills/b3-teacher-feedback-claude-haiku-4-5/nlp-paper-reproduction/run3_Implement-SimPO-Loss-Function

Use when implementing the `simpo_loss` function in SimPOTrainer class. Extract loss computation logic from the paper and translate it to PyTorch code that accepts the expected tensor inputs.From its SKILL.md

Install
npx -y skills add cxcscmu/SkillLearnBench --skill run3_Implement-SimPO-Loss-Function

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

SKILL.md

1.3 KB, 268 tokens by cl100k_base, as published. Nobody here has run it

  1. Study the SimPO loss formula in the paper:

    • Read /root/SimPO/paper.pdf to understand the mathematical definition
    • Note the inputs expected (typically: logits for chosen/rejected, reference logits, or similar)
    • Identify any hyperparameters (temperature, beta, etc.)
  2. Examine the function signature in SimPOTrainer:

    grep -A 10 "def simpo_loss" /root/SimPO/scripts/simpo_trainer.py
    
  3. Check the unit test to understand expected inputs and outputs:

    cat /root/SimPO/unit_test/unit_test_1.py
    
    • Identify input tensor shapes and dtypes
    • Identify expected output shape and key name for .npz file
  4. Implement the loss function:

    • Translate the mathematical formula to PyTorch operations
    • Handle batch dimensions correctly
    • Ensure numerical stability (use log-sum-exp tricks if needed)
    • Return losses as a 1D tensor matching batch size
  5. Verify implementation:

    • Function accepts all required arguments from the test
    • Returns tensor with shape matching expected output
    • No undefined variables or missing imports

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.