File size: 2,557 Bytes
3ae5d0b
 
 
 
 
 
 
 
 
 
 
4749a3d
3ae5d0b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4749a3d
3ae5d0b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2156241
 
 
 
 
3ae5d0b
2156241
3ae5d0b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---
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
```