Dataset Viewer
Auto-converted to Parquet Duplicate
n_shards
int64
shard_paths
list
total_tokens
int64
samples
list
100
[ "mix_000000.bin", "mix_000001.bin", "mix_000002.bin", "mix_000003.bin", "mix_000004.bin", "mix_000005.bin", "mix_000006.bin", "mix_000007.bin", "mix_000008.bin", "mix_000009.bin", "mix_000010.bin", "mix_000011.bin", "mix_000012.bin", "mix_000013.bin", "mix_000014.bin", "mix_000015.bin"...
10,000,000,000
[ { "shard": "mix_000000.bin", "n_tokens": 100000000, "n_eot": 125151, "doc_density": 0.00125151, "text_excerpt": " soldiers were guarding each gate. In the Muslim quarter, we found snack shops and graffiti. The streets were narrow, paved with stone and the buildings were so old! Wires and lines w...

Mixed Pretraining 10B (GPT-2 BPE)

A 10-billion-token pretraining dataset, GPT-2 BPE tokenized, assembled as a diverse mix of web text, books, Wikipedia, code, academic papers, Q&A and instruction-formatted conversations.

Built to train a ~500M parameter from-scratch GPT-2-style transformer (see juliannunezb/transformer-lm-500m).

Mix

Source Mix % Tokens Notes
fineweb 40.4% 4,039,999,700 reused from kjj0/fineweb10B-gpt2
fineweb_edu 15.2% 1,514,999,900 reused from karpathy/fineweb-edu-100B-gpt2-token-shards
openwebtext 10.1% 1,009,999,900 reused from chanind/openwebtext-gpt2
pg19 10.1% 1,009,999,900 tokenized from manu/project_gutenberg (en) — Project Gutenberg books
wikipedia 7.6% 757,499,900 tokenized from wikimedia/wikipedia config 20231101.en
github 7.6% 757,499,900 tokenized from codeparrot/github-code-clean (Python/JavaScript/Go)
stackexchange 5.1% 505,000,000 tokenized from HuggingFaceH4/stack-exchange-preferences (Q + top-scoring A)
instruct 4.0% 405,000,000 tokenized from teknium/OpenHermes-2.5 + databricks/databricks-dolly-15k
Total 100.0% 9,999,999,200

Format

Each .bin file is an llm.c-compatible shard:

[ header: 256 × int32 ]
  offset  0: magic    = 20240520
  offset  4: version  = 1
  offset  8: n_tokens = N
  offset 12..1023: reserved (zeros)
[ body: N × uint16  token IDs, each < 50257 ]
  • Tokenizer: GPT-2 BPE via tiktoken.get_encoding("gpt2") (vocab size 50257).
  • <|endoftext|> (id 50256) separates documents within a shard and also marks the boundary between sources inside a mixed shard.
  • Each shard is exactly 100,000,000 tokens (100M), except possibly the last.
  • Total shards: 100 → 10,000,000,000 tokens.

Loading

import numpy as np
from huggingface_hub import hf_hub_download

def load_shard(shard_idx: int) -> np.ndarray:
    path = hf_hub_download(
        repo_id="juliannunezb/mixed-pretrain-10b-gpt2",
        filename=f"mix_{shard_idx:06d}.bin",
        repo_type="dataset",
    )
    with open(path, "rb") as f:
        header = np.frombuffer(f.read(1024), dtype=np.int32)
        assert header[0] == 20240520 and header[1] == 1
        n = int(header[2])
        tokens = np.frombuffer(f.read(n * 2), dtype=np.uint16)
    return tokens

shard = load_shard(0)     # first shard: ~100M uint16 token IDs
print(shard[:20])         # e.g. array([ 464,  368, 2321, ...], dtype=uint16)

Decode back to text with tiktoken:

import tiktoken
enc = tiktoken.get_encoding("gpt2")
print(enc.decode(shard[:200].tolist()))

Reproducibility

Built with tokenize_and_mix.py on 2026-04-21 20:24:01 UTC. Tokenization ran against the HEAD of each source at that time.

  • Pre-tokenized shards copied (no re-encoding) from:
    • kjj0/fineweb10B-gpt2
    • karpathy/fineweb-edu-100B-gpt2-token-shards
    • chanind/openwebtext-gpt2
  • Fresh tokenized from:
    • manu/project_gutenberg (split en) — Project Gutenberg books
    • wikimedia/wikipedia (config 20231101.en)
    • codeparrot/github-code-clean (configs Python-all, JavaScript-all, Go-all)
    • HuggingFaceH4/stack-exchange-preferences — Q + top-scoring answer text
    • teknium/OpenHermes-2.5
    • databricks/databricks-dolly-15k

Formatting notes

  • Documents within each source are separated by <|endoftext|> (50256).
  • Code documents are prefixed with # Path: <repo_path>\n to provide structural context and are restricted to .py, .js, .ts, .go.
  • Instruction documents follow a simple chat template:
    User: <instruction>
    Assistant: <response>
    
    Dolly entries that include a context field embed it between the user turn and the assistant turn (see the pipeline script for exact formatting).
  • Within each mixed shard, sources appear in the fixed order: fineweb → fineweb_edu → openwebtext → pg19 → wikipedia → github → arxiv → stackexchange → instruct, separated by <|endoftext|> at each boundary.

Sanity checks run before upload

  • 0 ≤ token_id < 50257 on every shard (asserts in writer).
  • EOT counts sampled on first/middle/last shard — see sanity.json.
  • Random 500-token decodes from 3 shards — see sanity.json for excerpts.

License

This dataset is a derivative of multiple sources. The most restrictive upstream license governs each subset:

Source License
FineWeb / FineWeb-Edu ODC-By 1.0
OpenWebText CC0
PG-19 Apache 2.0 (pre-1919 public-domain books)
Wikipedia CC-BY-SA 3.0 / 4.0
RedPajama github permissive licenses (MIT/BSD/Apache) upstream
RedPajama arxiv arXiv terms of use
RedPajama stackexchange CC-BY-SA 4.0
OpenHermes 2.5 varies per upstream (see dataset card)
Databricks Dolly 15k CC-BY-SA 3.0

Redistribute accordingly. This dataset is intended for research and pretraining of open language models.

Known limitations

  • English-dominant. Some minority coverage in code/arxiv, but this is not a multilingual corpus.
  • No PII scrubbing or toxicity filtering beyond what upstream sources applied.
  • Upstream deduplication is assumed; no cross-source MinHash dedup is performed here.
Downloads last month
610

Collection including juliannunezb/mixed-pretrain-10b-gpt2