Simpo code reproduction

From XuShuwenn/RedAct · View interactive version

Simpo code reproduction is an AI agent skill from the GitHub repository XuShuwenn/RedAct. Implement SimPO loss function for language model alignment based on paper specifications and generate loss matrix.

How to use this skill

Skill file

SimPO Loss Implementation

When to Use

Input

Task

  1. Read SimPO paper to understand loss formula

1a. Before editing simpo_loss, inspect the surrounding SimPOTrainer code in /root/SimPO/scripts/simpo_trainer.py, relevant call sites/config such as /root/SimPO/scripts/simpo_config.py, and the full unit test in /root/SimPO/unit_test/unit_test_1.py so the implementation matches this repository's actual interface, tensor semantics, and expected outputs.

1b. Use the paper to confirm the loss formula, but validate assumptions against repository code; do not implement from partial snippets, summaries, or guessed normalization/scaling behavior.

  1. Implement simpo_loss function in SimPOTrainer class
  2. Run unit test to verify implementation
  3. Save loss to /root/loss.npz with key 'losses'
  4. Follow the critical path: inspect code/test/paper context -> implement only the minimal change needed in simpo_loss -> run the provided unit test -> save /root/loss.npz with key losses -> write /root/python_info.txt.
  5. Before finalizing, verify correctness against both the paper formula and the local trainer/test conventions, not just a passing test.

Requirements

Output

Unit Test

Workflow Guardrails

Workflow Guardrails

Tips

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.