--- base_model: gpt2 datasets: - wikimedia/wikipedia library_name: Distily license: mit tags: - bitnet - 1.58b - generated_from_trainer model-index: - name: distily_multi_experiment results: [] --- # Summary Distilled with [Distily](https://github.com/lapp0/distily) library using teacher model [gpt2](https://huggingface.co/gpt2) on dataset [wikimedia/wikipedia](https://huggingface.co/datasets/wikimedia/wikipedia). # Model Architecture: - **Architecture**: `GPT2LMHeadModel` - **Total Parameters**: 124,439,808 - **Data Type (dtype)**: torch.bfloat16 - **Model Size**: 0.24 GB # Evaluation Metrics Comparison | step | epoch | enwikippl | frwikippl | loss | runtime | samples_per_second | steps_per_second | tinystoriesppl | zhwikippl | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | **teacher eval** | | 43.25 | 61.25 | | | | | 11.6875 | 19.125 | | 0 | 0 | 2473901162496.0 | 170424302305280.0 | 25.7744 | 30.269 | 82.593 | 10.341 | 4060086272.0 | 71468255805440.0 | | 2500 | 0.0404 | 952.0 | 8032.0 | 6.1202 | 30.2377 | 82.678 | 10.351 | 652.0 | 6432.0 | | 5000 | 0.0808 | 378.0 | 1880.0 | 5.0293 | 30.3345 | 82.414 | 10.318 | 270.0 | 288.0 | | 7500 | 0.1212 | 230.0 | 820.0 | 4.5127 | 30.2749 | 82.577 | 10.339 | 201.0 | 174.0 | | 10000 | 0.1616 | 173.0 | 628.0 | 4.2288 | 30.3713 | 82.315 | 10.306 | 152.0 | 172.0 | | 12500 | 0.2020 | 127.5 | 482.0 | 3.8554 | 30.4218 | 82.178 | 10.289 | 106.5 | 157.0 | | 15000 | 0.2424 | 109.0 | 436.0 | 3.6684 | 30.2501 | 82.644 | 10.347 | 87.5 | 148.0 | | 17500 | 0.2828 | 93.5 | 350.0 | 3.5226 | 30.2559 | 82.628 | 10.345 | 73.5 | 119.5 | | 20000 | 0.3232 | 75.5 | 282.0 | 3.3351 | 30.5792 | 81.755 | 10.236 | 64.5 | 114.5 | | 22500 | 0.3636 | 67.5 | 213.0 | 3.1522 | 30.4457 | 82.113 | 10.281 | 53.25 | 80.5 | | 25000 | 0.4040 | 64.0 | 197.0 | 3.0806 | 30.4623 | 82.069 | 10.275 | 45.0 | 95.5 | | 27500 | 0.4444 | 58.25 | 203.0 | 3.0308 | 30.2865 | 82.545 | 10.335 | 40.75 | 93.0 | | 30000 | 0.4848 | 59.5 | 195.0 | 3.0207 | 30.2442 | 82.66 | 10.349 | 43.25 | 61.5 | | 32500 | 0.5253 | 58.5 | 172.0 | 3.0015 | 30.3473 | 82.38 | 10.314 | 41.75 | 60.75 | | 35000 | 0.5657 | 57.25 | 171.0 | 2.9425 | 30.2295 | 82.701 | 10.354 | 38.0 | 51.5 | | 37500 | 0.6061 | 57.25 | 157.0 | 2.9166 | 31.0953 | 80.398 | 10.066 | 38.0 | 55.0 | | 40000 | 0.6465 | 54.75 | 160.0 | 2.8987 | 30.9607 | 80.747 | 10.11 | 35.5 | 58.75 | | 42500 | 0.6869 | 53.75 | 153.0 | 2.8783 | 30.2174 | 82.734 | 10.358 | 35.75 | 67.0 | | 45000 | 0.7273 | 50.25 | 136.0 | 2.7764 | 30.1636 | 82.881 | 10.377 | 30.375 | 41.25 | | 47500 | 0.7677 | 50.25 | 126.5 | 2.7509 | 30.252 | 82.639 | 10.346 | 29.375 | 38.0 | | 50000 | 0.8081 | 49.0 | 127.5 | 2.7362 | 30.1988 | 82.785 | 10.365 | 28.75 | 40.0 | | 52500 | 0.8485 | 48.5 | 121.0 | 2.7263 | 30.2772 | 82.57 | 10.338 | 29.0 | 35.5 | | 55000 | 0.8889 | 48.0 | 119.0 | 2.7102 | 30.1534 | 82.909 | 10.38 | 28.0 | 34.0 | | 57500 | 0.9293 | 47.5 | 118.5 | 2.7043 | 30.181 | 82.834 | 10.371 | 27.875 | 32.5 | | 60000 | 0.9697 | 47.5 | 118.0 | 2.7013 | 30.3322 | 82.421 | 10.319 | 27.75 | 32.25 | | 61875 | 1.0 | 47.5 | 118.0 | 2.7006 | 30.5306 | 81.885 | 10.252 | 27.625 | 32.25 | # Resource Usage Comparison - VRAM Use: 7.7830 GB `# Distillation (Teacher -> Student) Architecture Difference: - **Architecture**: `GPT2LMHeadModel` -> `GPT2LMHeadModel` - **Total Parameters**: 124,439,808 -> 124,439,808 - **Data Type (dtype)**: 124439808 -> torch.bfloat16 - **Model Size**: 0.24 GB -> 0.24 GB
Module Diff Details ```diff ```

# Train Dataset Trained on 145,744,973 tokens from the [wikimedia/wikipedia](https://huggingface.co/datasets/wikimedia/wikipedia) dataset. - Num Samples: `247,500` - Subset: `20231101.en` - Split: `train` # Training Objective ``` DistillationObjective(logits_loss_component=LossComponent(label=logits, weight=1, loss_fn=kl), attn_loss_component=LossComponent(label=attn, weight=5, loss_fn=cos, layer_mapper=layer-2)) ``` # Hyperparameters The following hyperparameters were used during training:
Expand - learning_rate: `0.0001` - train_batch_size: `4` - eval_batch_size: `8` - seed: `42` - optimizer: `Adam with betas=(0.9,0.999) and epsilon=1e-08` - lr_scheduler_type: `linear` - lr_scheduler_warmup_ratio: `0.5` - num_epochs: `1.0` - distillation_objective: `DistillationObjective(logits_loss_component=LossComponent(label=logits, weight=1, loss_fn=kl), attn_loss_component=LossComponent(label=attn, weight=5, loss_fn=cos, layer_mapper=layer-2))` - train_embeddings: `True` - lr_scheduler: `` - student_model_name_or_path: `None` - student_config_name_or_path: `None` - student_model_config: `None` - reinitialize_weights: `None` - copy_teacher_modules: `[('lm_head', False)]` - student_model_as_bitnet: `True` - student_model_compile: `False` - dropout: `None` - teacher_model_name_or_path: `gpt2` - teacher_load_in_8bit: `False` - teacher_load_in_4bit: `False` - teacher_model_compile: `False` - dataset_uri: `wikimedia/wikipedia` - dataset_subset: `20231101.en` - dataset_split: `train` - dataset_column_name: `text` - dataset_sample_size: `250000` - dataset_test_size: `0.01` - gradient_accumulation_steps: `1` - weight_decay: `0.0` - max_grad_norm: `1.0` - warmup_ratio: `0.5` - warmup_steps: `0` - gradient_checkpointing: `True`

# Framework Versions - Distily 0.2.0 - Transformers 4.44.0 - Pytorch 2.3.0 - Datasets 2.21.0