Model Card for bert-base-uncased-finetuned-mrpc

This model is bert-base-uncased fine-tuned on the MRPC (Microsoft Research Paraphrase Corpus) subset of GLUE. Given two sentences, it predicts whether they have the same meaning (equivalent) or not (not_equivalent).

Model Details

Model Description

This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.

  • Developed by: GoingDeep
  • Funded by [optional]: [More Information Needed]
  • Shared by [optional]: [More Information Needed]
  • Model type: BERT with a sequence-classification head (2 labels)
  • Language(s) (NLP): English
  • License: apache-2.0
  • Finetuned from model [optional]: bert-base-uncased

Model Sources [optional]

Uses

Direct Use

Given two sentences, predicts whether they're paraphrases (equivalent / not_equivalent)

[More Information Needed]

Downstream Use [optional]

[More Information Needed]

Out-of-Scope Use

[More Information Needed]

Bias, Risks, and Limitations

English only, trained on one small news-sentence dataset, so it may not generalize to other kinds of text

Recommendations

Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.

How to Get Started with the Model

import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification

repo = "GoingDeep/bert-base-uncased-finetuned-mrpc"
tokenizer = AutoTokenizer.from_pretrained(repo)
model = AutoModelForSequenceClassification.from_pretrained(repo)

id2label = {0: "not_equivalent", 1: "equivalent"}

pairs = [
    ("This cup of coffee was quite tasty!", "The coffee in this cup tasted pretty good!"),
    ("The company reported a sharp rise in quarterly profits.", "The city council approved a new budget for road repairs."),
]

for sentence1, sentence2 in pairs:
    inputs = tokenizer(sentence1, sentence2, return_tensors="pt")
    with torch.inference_mode():
        outputs = model(**inputs)
    pred_id = torch.argmax(outputs.logits, dim=-1).item()
    print(f"{sentence1} | {sentence2} -> {id2label[pred_id]}")

Training Details

Training Data

GLUE MRPC train split (3,668 sentence pairs)

[More Information Needed]

Training Procedure

Preprocessing [optional]

[More Information Needed]

Training Hyperparameters

  • Training regime: 3 epochs, batch size 16, learning rate 0.00005, evaluated and saved every epoch, best checkpoint loaded at end

Speeds, Sizes, Times [optional]

Training took about 3.5 minutes (690 steps)

Evaluation

Testing Data, Factors & Metrics

Testing Data

GLUE MRPC validation split (408 pairs)

Factors

[More Information Needed]

Metrics

Accuracy 85.5%, F1 0.897, from the epoch 1 checkpoint

Results

Accuracy F1
Before fine-tuning (random classifier head, seed 42) 68.4% 0.812
After fine-tuning (epoch 1 checkpoint) 85.5% 0.897

Note: always predicting "equivalent" also scores 68.4% / 0.812 on the validation set, so the baseline here is no better than the majority class. Scores are on the MRPC validation split, which was also used to select the best checkpoint.

Baseline (pretrained bert-base-uncased, untrained head, seed 42, validation): acc 0.684, F1 0.812, loss 0.634. Equals the majority-class score.

Summary

fine-tuning improved accuracy from 68.4% to 85.5% over the majority-class baseline

Model Examination [optional]

[More Information Needed]

Environmental Impact

Carbon emissions can be estimated using the Machine Learning Impact calculator presented in Lacoste et al. (2019).

  • Hardware Type: [More Information Needed]
  • Hours used: [More Information Needed]
  • Cloud Provider: [More Information Needed]
  • Compute Region: [More Information Needed]
  • Carbon Emitted: [More Information Needed]

Technical Specifications [optional]

Model Architecture and Objective

[More Information Needed]

Compute Infrastructure

[More Information Needed]

Hardware

[More Information Needed]

Software

[More Information Needed]

Citation [optional]

BibTeX:

[More Information Needed]

APA:

[More Information Needed]

Glossary [optional]

[More Information Needed]

More Information [optional]

[More Information Needed]

Model Card Authors [optional]

[More Information Needed]

Model Card Contact

[More Information Needed]

Downloads last month
59
Safetensors
Model size
0.1B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for GoingDeep/bert-base-uncased-finetuned-mrpc

Finetuned
(7013)
this model

Dataset used to train GoingDeep/bert-base-uncased-finetuned-mrpc

Paper for GoingDeep/bert-base-uncased-finetuned-mrpc