AjitKumar-Bio's picture
Initialize Cosmopedia v2 digested dataset card
4749a3d verified
|
Raw History Blame Contribute Delete
2.56 kB
---
license: odc-by
task_categories:
- text-generation
- question-answering
language:
- en
tags:
- cosmopedia-v2
- cerebro-spheroid
- teacher-digestion
- qwen2.5
- dynamic-loss-weighting
- information-density
- pretraining
size_categories:
- 10M<n<100M
configs:
- config_name: default
data_files:
- split: train
path: "data/train-*.parquet"
---
# Cosmopedia v2 Teacher-Digested Pretraining Corpus
This dataset is a teacher-digested transformation of [HuggingFaceTB/smollm-corpus](https://huggingface.co/datasets/HuggingFaceTB/smollm-corpus) (Cosmopedia v2 split, 39.13M documents, ~30 Billion tokens).
Each document is digested by **Qwen2.5 Teacher LM** to compute dynamic per-token information-density loss weights, losslessly projected onto **CerebroSpheroid's 32,000 vocabulary**.
## Dataset Schema
Each row contains:
- `id` (*string*): Unique sample identifier (`cosmo2_{shard:05d}_{row:07d}`).
- `prompt` (*string*): Original stimulus/topic prompt that generated the document.
- `audience` (*string*): Target pedagogical audience (e.g. `college_students`, `general`).
- `format` (*string*): Pedagogical format (e.g. `textbook`, `webpage`, `educational_article`).
- `tokens` (*list<int32>*): CerebroSpheroid SentencePiece token IDs (vocab size 32,000).
- `target_weights` (*list<float16>*): Dynamic next-token loss weights $w_t \in [0.2, 4.0]$ ($E[w_t] = 1.0$).
- `seq_len` (*int32*): Number of tokens in the sequence.
- `mean_weight` (*float32*): Sequence average loss weight.
- `max_weight` (*float32*): Peak information-density weight in the document.
- `min_weight` (*float32*): Minimum floor weight in the document.
## Information-Density Mathematical Formulation
For each sequence with teacher causal language model $Q$:
$$\\mathcal{L}_{Q, t} = -\\log P_Q(x_t \\mid x_{<t})$$
$$\\mathcal{H}_{Q, t} = -\\sum_{v \\in \\mathcal{V}_Q} P_Q(v \\mid x_{<t}) \\log P_Q(v \\mid x_{<t})$$
$$D_t = \\mathcal{L}_{Q, t} + \\beta \\mathcal{H}_{Q, t}$$
$$z_t = \\frac{D_t - \\mu_D}{\\sigma_D}$$
$$w_t = \\text{clip}\\left(1 + \\alpha \\tanh(z_t), w_{\\min}, w_{\\max}\\right)$$
Normalized so that $\\frac{1}{T}\\sum_{t=1}^T w_t = 1.0$.
## Streaming Usage with PyTorch & CerebroSpheroid
```python
from datasets import load_dataset
# Stream directly with zero Qwen runtime overhead:
dataset = load_dataset(
"AjitKumar-Bio/cosmopedia-v2-digested",
split="train",
streaming=True
)
for sample in dataset:
tokens = sample["tokens"]
weights = sample["target_weights"]
# Feed directly into CerebroSpheroid pretraining loss
```