SPIN logo

SPIN

uclaml/SPIN

Official implementation of Self-Play Fine-Tuning

GraphCanon updated today · GitHub synced today

1.3k stars106 forksLast push 2y Python Apache-2.0

Decision brief

SPIN is specialized for self-play fine-tuning in large language models through deep learning.

Good fit when

  • When implementing self-play algorithms aimed at enhancing performance of large language models within constrained domains.
  • For projects that necessitate the Apache-2.0 license, supporting open-source contribution and commercial use without patent protection concerns.

Avoid when

  • If your project strictly adheres to frameworks that do not incorporate self-play techniques for training or fine-tuning models.
  • When prioritizing a model training framework that relies on supervised learning rather than the self-play methodology SPIN is based upon.

Observed Jul 14, 2026 · Source: enrich:decision_facts

Verify the decision

Maintenance and security

Full trust report
Maintenance
Dormant (837d since push)
As of today
Provenance
Not a fork · Personal account
As of today
Security (OSV)
No lockfile
As of 1mo

Public GitHub metadata and optional OSV scans. Signals, not a guarantee. Trust methodology.

Install

pip install SPIN
PyPI

Similar tools

Same-category neighbours. No typed graph edges are catalogued for this tool yet.

Evidence and technical details

Sourced facts, taxonomy, compatibility claims, README excerpt, and machine-readable endpoints.

Overview

SPIN provides methodologies for self-play fine-tuning in large language models utilizing deep learning techniques.

Capability facts

Languages
python

Source: github.language · Aug 24, 2026

Categories

Tags

README


🤗 Models | 🤗 Datasets

Self-Play Fine-Tuning (SPIN)

This repository contains the official code for the paper "Self-Play Fine-Tuning Converts Weak Language Models to Strong Language Models".

Authors: Zixiang Chen*, Yihe Deng*, Huizhuo Yuan*, Kaixuan Ji, Quanquan Gu

[Webpage] [Huggingface]

🔔 News

  • [05/01/2024] SPIN has been accepted by ICML2024!
  • [04/06/2024] We released the training scripts to reproduce our results.
  • [04/04/2024] ❗ We've discovered that the datasets previously uploaded are incorrect. We've re-upload the corrected datasets.
  • [02/13/2024] We updated our arXiv v2: https://arxiv.org/abs/2401.01335.
  • [02/09/2024] Our code is open-sourced!
  • [01/02/2024] Our paper is released on arXiv: https://arxiv.org/abs/2401.01335.

Note: We notice that the Alignment Handbook has updated their configuration and SFT checkpoint since our experiments. The configuration and SFT model from the Alignment Handbook that we used in our experiments for data generation and fine-tuning are the older version (Config, Model). The model checkpoint on Hugging Face (alignment-handbook/zephyr-7b-sft-full) has been updated once with the new config. If you wish to use the newest SFT model, you need to either load the checkpoint with revision=ac6e600eefcce74f5e8bae1035d4f66019e93190 or generate your own data instead of using the datasets we provided on Hugging Face.

Table of Contents

  • About SPIN
  • Setup
    • Data
    • Model
  • Usage
    • Step 1: Generation
      • Faster generation with vLLM
    • Step 1.5: Gather generations and convert data type
    • Step 2: Fine-tuning
  • Reproducing Our Results
  • Evaluation
  • Citation
  • Acknowledgement

🌀 About SPIN

SPIN utilizes a self-play mechanism, allowing an LLM to improve itself by playing against its previous iterations, without needing additional human-annotated preference data than the SFT dataset itself. More specifically, the LLM generates its own training data from its previous iterations, refining its policy by discerning these self-generated responses from the original SFT data.


Average score of SPIN at different iterations on the HuggingFace Open LLM leaderboard.

SPIN can significantly enhance the performance of an LLM after SFT across various benchmarks, outperforming the model trained with direct preference optimization (DPO) on labelled preference datasets. The approach is theoretically grounded, ensuring that the LLM aligns with the target data distribution, and empirically validated through exten

For agents

This page has a .md twin and JSON over the API.

Was this helpful?

Anonymous feedback helps us improve pages and translations.