Instruction / SFT · BAAI

Infinity-Instruct

A 7.5M high-quality instruction dataset from the Beijing Academy of AI, combining foundational skills (math, code, reasoning) with conversational ability. Used to train models that surpass Llama 3 70B while being much smaller.

Load it
from datasets import load_dataset
ds = load_dataset("BAAI/Infinity-Instruct")
Preview a sample row
{
  "id": "inf_001",
  "conversations": [
    {"from": "human", "value": "Write a Python function to find all prime numbers up to n using the Sieve of Eratosthenes."},
    {"from": "gpt", "value": "def sieve_of_eratosthenes(n):\n    primes = [True] * (n+1)\n    primes[0] = primes[1] = False\n    for i in range(2, int(n**0.5)+1):\n        if primes[i]:\n            for j in range(i*i, n+1, i):\n                primes[j] = False\n    return [i for i in range(2, n+1) if primes[i]]"}
  ]
}

Fine-tune with this dataset

Estimated VRAM to fine-tune with QLoRA (4-bit base model + LoRA adapters), using conservative defaults:

7B QLoRA · ~6GB VRAM13B QLoRA · ~10GB VRAM
Check if your GPU can fine-tune this →

New to fine-tuning? Follow the step-by-step walkthrough: Fine-Tune Your First LLM in 1 Hour

Frequently asked questions

Can I use Infinity-Instruct commercially?

Yes — Infinity-Instruct is released under Apache 2.0, a permissive license that allows commercial use, including training models you ship in a product. Check the dataset card for attribution requirements before release.

How much data does Infinity-Instruct contain, and do I need all of it?

Infinity-Instruct contains 7.5M Instructions. You rarely need all of it: for style and format fine-tuning, a few hundred to a few thousand examples are enough — load a slice (e.g. split="train[:1000]") and scale up only if quality plateaus.

What is Infinity-Instruct best used for?

Large-scale general SFT when you need millions of samples. It belongs to the Instruction / SFT section of our dataset hub, where you'll find alternatives and complementary sets.