Reproducing DistilRoBERTa

I’ve been trying to retrain DistilRoBERTa from the information given here along with the example code/documentation here.

I’m a bit unclear on the exact configuration used to train the DistilRoBERTa model. I have been assuming it uses the same configuration as the DistilBERT model with minor changes, though some things, such as the loss coefficients are still a bit ambiguous.

Would it be possible to share the exact command/configuration to train DistilRoBERTa?

I’ve been able to replicate DistilRoBERTa to similar evaluation MLM perplexity but there still seems to be a small but statistically significant difference, I can share the full config if it’s helpful.

Thank you!

@VictorSanh it was mentioned that you might be the best person to ask about this.

Hi @DavidHarrison ,
Here’s the exact configuration I used for DistilRoBERTa:

{
    "force": true,
    "dump_path": "serialization_dir/distilroberta-base",
    "data_file": "data/dump_openwebtext.roberta-base.pickle",
    "student_type": "roberta",
    "student_config": "training_configs/roberta-base.json",
    "student_pretrained_weights": "serialization_dir/tf_roberta-base_0247911.pth",
    "teacher_type": "roberta",
    "teacher_name": "roberta-base",
    "temperature": 2.0,
    "alpha_ce": 5.0,
    "alpha_mlm": 2.0,
    "alpha_clm": 0.0,
    "alpha_mse": 0.0,
    "alpha_cos": 1.0,
    "mlm": true,
    "mlm_mask_prop": 0.15,
    "word_mask": 0.8,
    "word_keep": 0.1,
    "word_rand": 0.1,
    "mlm_smoothing": 0.7,
    "token_counts": "data/token_counts_openwebtext.roberta-base.pickle",
    "restrict_ce_to_mask": false,
    "freeze_pos_embs": true,
    "freeze_token_type_embds": true,
    "n_epoch": 4,
    "batch_size": 5,
    "group_by_size": true,
    "gradient_accumulation_steps": 100,
    "warmup_prop": 0.05,
    "weight_decay": 0.0,
    "learning_rate": 0.00025,
    "adam_epsilon": 1e-06,
    "max_grad_norm": 5.0,
    "initializer_range": 0.02,
    "fp16": false,
    "fp16_opt_level": "O1",
    "n_gpu": 8,
    "local_rank": 0,
    "seed": 56,
    "log_interval": 400,
    "checkpoint_interval": 20000,
    "world_size": 8,
    "n_gpu_per_node": 8,
    "global_rank": 0,
    "n_nodes": 1,
    "node_id": 0,
    "multi_gpu": true,
    "is_master": true,
    "multi_node": false
} 

Victor

1 Like

Thank you @VictorSanh!

Hi @VictorSanh ,

For DistillGPT2, I know both the CLM loss and the distillation loss are used. Can you clarify whether the MSE loss is also used? Or the Cosine distance loss?

Hey @theyorubayesian !
Very much the same as distilroberta. we used the cosine loss, no mse loss!
Victor

1 Like