--- 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 | 21.1784 | 25.4629 | 98.182 | 12.292 | 4060086272.0 | 71468255805440.0 | | 2500 | 0.0404 | 764.0 | 5376.0 | 2.3601 | 25.4683 | 98.161 | 12.29 | 470.0 | 2080.0 | | 5000 | 0.0808 | 312.0 | 1344.0 | 1.6575 | 25.5021 | 98.031 | 12.274 | 232.0 | 241.0 | | 7500 | 0.1212 | 210.0 | 744.0 | 1.3794 | 25.4757 | 98.133 | 12.286 | 171.0 | 154.0 | | 10000 | 0.1616 | 158.0 | 560.0 | 1.1833 | 25.5064 | 98.015 | 12.271 | 129.0 | 155.0 | | 12500 | 0.2020 | 117.0 | 456.0 | 0.9690 | 25.4693 | 98.157 | 12.289 | 98.5 | 140.0 | | 15000 | 0.2424 | 103.5 | 420.0 | 0.8624 | 25.4707 | 98.152 | 12.289 | 84.0 | 110.5 | | 17500 | 0.2828 | 91.5 | 338.0 | 0.7747 | 25.4792 | 98.119 | 12.285 | 74.5 | 108.0 | | 20000 | 0.3232 | 78.0 | 292.0 | 0.7217 | 25.5053 | 98.019 | 12.272 | 64.5 | 173.0 | | 22500 | 0.3636 | 70.0 | 240.0 | 0.6259 | 25.4943 | 98.061 | 12.277 | 57.0 | 84.0 | | 25000 | 0.4040 | 68.0 | 201.0 | 0.5935 | 25.4853 | 98.096 | 12.282 | 53.25 | 143.0 | | 27500 | 0.4444 | 66.0 | 205.0 | 0.5698 | 25.4724 | 98.146 | 12.288 | 48.75 | 141.0 | | 30000 | 0.4848 | 65.5 | 231.0 | 0.5773 | 25.4348 | 98.29 | 12.306 | 50.0 | 76.0 | | 32500 | 0.5253 | 65.5 | 194.0 | 0.5631 | 25.4793 | 98.119 | 12.284 | 48.25 | 70.0 | | 35000 | 0.5657 | 61.0 | 192.0 | 0.5233 | 25.4774 | 98.126 | 12.285 | 42.5 | 91.5 | | 37500 | 0.6061 | 61.5 | 174.0 | 0.5094 | 25.4635 | 98.18 | 12.292 | 45.5 | 87.0 | | 40000 | 0.6465 | 60.0 | 188.0 | 0.4995 | 25.4422 | 98.262 | 12.302 | 41.75 | 105.5 | | 42500 | 0.6869 | 59.0 | 173.0 | 0.4839 | 25.5034 | 98.026 | 12.273 | 42.0 | 189.0 | | 45000 | 0.7273 | 54.5 | 153.0 | 0.4090 | 25.504 | 98.024 | 12.273 | 35.5 | 58.25 | | 47500 | 0.7677 | 53.75 | 137.0 | 0.3895 | 25.5041 | 98.023 | 12.273 | 35.0 | 42.5 | | 50000 | 0.8081 | 53.25 | 139.0 | 0.3769 | 25.4755 | 98.133 | 12.286 | 33.75 | 41.25 | | 52500 | 0.8485 | 51.25 | 131.0 | 0.3691 | 25.4887 | 98.083 | 12.28 | 33.75 | 46.25 | | 55000 | 0.8889 | 50.75 | 126.5 | 0.3558 | 25.4369 | 98.282 | 12.305 | 32.75 | 38.25 | | 57500 | 0.9293 | 50.0 | 126.5 | 0.3515 | 25.4349 | 98.29 | 12.306 | 32.25 | 35.5 | | 60000 | 0.9697 | 50.0 | 126.0 | 0.3490 | 25.4964 | 98.053 | 12.276 | 32.0 | 35.25 | | 61875 | 1.0 | 49.75 | 126.0 | 0.3487 | 25.4844 | 98.099 | 12.282 | 32.0 | 35.5 | # Resource Usage Comparison - VRAM Use: 7.7851 GB # Distillation (Teacher -> Student) Architecture Difference: - **Architecture**: `GPT2LMHeadModel` -> `GPT2LMHeadModel` - **Total Parameters**: 124,439,808 -> 124,439,808 - **Data Type (dtype)**: torch.bfloat16 -> 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=kl, 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=kl, 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.1 - Pytorch 2.5.0.dev20240821+cu121 - Datasets 2.21.0