--- license: apache-2.0 tags: - generated_from_trainer model-index: - name: distilbert-base-uncased-gradient-clinic results: [] --- # distilbert-base-uncased-gradient-clinic This model is a fine-tuned version of [distilbert-base-uncased](https://huggingface.co/distilbert-base-uncased) on an unknown dataset. It achieves the following results on the evaluation set: - Loss: 0.1092 - Exact match: 97.22 - F1 score: 98.61 ## Model description ### Pretrained model: DistilBERT DistilBERT is a transformers model, smaller and faster than BERT, which was pretrained on the same corpus in a self-supervised fashion, using the BERT base model as a teacher. This means it was pretrained on the raw texts only, with no humans labelling them in any way (which is why it can use lots of publicly available data) with an automatic process to generate inputs and labels from those texts using the BERT base model. More precisely, it was pretrained with three objectives: * _Distillation loss_: the model was trained to return the same probabilities as the BERT base model. * _Masked language modeling (MLM)_: this is part of the original training loss of the BERT base model. When taking a sentence, the model randomly masks 15% of the words in the input then run the entire masked sentence through the model and has to predict the masked words. This is different from traditional recurrent neural networks (RNNs) that usually see the words one after the other, or from autoregressive models like GPT which internally mask the future tokens. It allows the model to learn a bidirectional representation of the sentence. * _Cosine embedding loss_: the model was also trained to generate hidden states as close as possible as the BERT base model. This way, the model learns the same inner representation of the English language than its teacher model, while being faster for inference or downstream tasks. ### Question-answering model We adapt the DistilBERT model by using a span classification head on top for extractive question-answering tasks like SQuAD (a linear layers on top of the hidden-states output to compute span start logits and span end logits). This model is a PyTorch `torch.nn.Module` sub-class. ## Intended uses & limitations Note that because of the fine-tuning, the model will not perform as well on general question answering tasks. However, this is because we have trained the model specifically to answer two types of questions: * What is the drug used on the left/right eye? * What is the visual acuity of this patient? For instance, using the standard `distilbert-base-cased-distilled-squad` on the following question and context gives the answer `Eylea` with 96% confidence: ```python context = "4/52 rev + l) eylea hn $95" question = "What drug was used on the left eye?" ``` However, with our new, fine-tuned model we get 98% confidence. ## Training and evaluation data The training and evaluation data comes from a small sample of clinic free text. These are short sentences which record patient attributes such as visual acuity, left eye drug injection, and right eye drug injection. ## Training procedure ### Training hyperparameters The following hyperparameters were used during training: - learning_rate: 2e-05 - train_batch_size: 36 - eval_batch_size: 36 - seed: 42 - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08 - lr_scheduler_type: linear - num_epochs: 10 ### Training results | Training Loss | Epoch | Step | Validation Loss | |:-------------:|:-----:|:----:|:---------------:| | No log | 1.0 | 4 | 2.3099 | | No log | 2.0 | 8 | 1.5130 | | No log | 3.0 | 12 | 0.9013 | | No log | 4.0 | 16 | 0.5299 | | No log | 5.0 | 20 | 0.3518 | | No log | 6.0 | 24 | 0.2624 | | No log | 7.0 | 28 | 0.1967 | | No log | 8.0 | 32 | 0.1472 | | No log | 9.0 | 36 | 0.1198 | | No log | 10.0 | 40 | 0.1092 | ### Framework versions - Transformers 4.17.0 - Pytorch 1.10.2+cu102 - Datasets 2.1.0 - Tokenizers 0.11.6