This repository hosts the quantized version of the Roberta-base model for Paraphrase Detection. The model is designed to determine whether two sentences convey the same meaning. If they are similar, the model outputs "duplicate" with a confidence score; otherwise, it outputs "not duplicate" with a confidence score. The model has been optimized for efficient deployment while maintaining reasonable accuracy, making it suitable for real-time applications.
🏗 Model Details
Model Architecture:
Roberta-base
Task:
Paraphrase Detection
Dataset:
Hugging Face's
quora-question-pairs
Quantization:
Float16 (FP16) for optimized inference
defpredict_paraphrase(sentence1, sentence2, threshold=0.96):
inputs = tokenizer(sentence1, sentence2, return_tensors="pt", padding=True, truncation=True).to(device)
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits
probabilities = torch.nn.functional.softmax(logits, dim=-1)
predicted_class = torch.argmax(probabilities, dim=-1).item()
confidence = probabilities[0][predicted_class].item()
label_map = {0: "Not Duplicate", 1: "Duplicate"}
# Apply a slightly less strict thresholdif predicted_class == 1and confidence < threshold:
return {"sentence1": sentence1, "sentence2": sentence2, "predicted_label": "Not Duplicate", "confidence": confidence}
else:
return {"sentence1": sentence1, "sentence2": sentence2, "predicted_label": label_map[predicted_class], "confidence": confidence}
# 🔍 Test Example
test_cases = [
("The sun rises in the east.", "The east is where the sun rises."), # Duplicate
("She enjoys playing the piano.", "She loves playing musical instruments."), # Duplicate
("I had a great time at the party.", "The event was really fun."), # Duplicate
("The sky is blue.", "Bananas are yellow."), # Not Duplicate
("The capital of France is Paris.", "Berlin is the capital of Germany."), # Not Duplicate
("I like reading books.", "She is going for a run."), # Not Duplicate
]
for sent1, sent2 in test_cases:
result = predict_paraphrase(sent1, sent2)
print(result)
📊 Quantized Model Evaluation Results
🔥 Evaluation Metrics 🔥
✅
Accuracy:
0.7515
✅
Precision:
0.6697
✅
Recall:
0.5840
✅
F1-score:
0.6022
⚡ Quantization Details
Post-training quantization was applied using PyTorch's built-in quantization framework. The model was quantized to Float16 (FP16) to reduce model size and improve inference efficiency while balancing accuracy.
📂 Repository Structure
.
├── model/ # Contains the quantized model files
├── tokenizer_config/ # Tokenizer configuration and vocabulary files
├── model.safetensors/ # Quantized Model
├── README.md # Model documentation
⚠️ Limitations
The model may struggle with highly nuanced paraphrases.
Quantization may lead to slight degradation in accuracy compared to full-precision models.
Performance may vary across different domains and sentence structures.
🤝 Contributing
Contributions are welcome! Feel free to open an issue or submit a pull request if you have suggestions or improvements.
Runs of AventIQ-AI roberta-paraphrase-detection on huggingface.co
16
Total runs
0
24-hour runs
7
3-day runs
5
7-day runs
13
30-day runs
More Information About roberta-paraphrase-detection huggingface.co Model
roberta-paraphrase-detection huggingface.co
roberta-paraphrase-detection huggingface.co is an AI model on huggingface.co that provides roberta-paraphrase-detection's model effect (), which can be used instantly with this AventIQ-AI roberta-paraphrase-detection model. huggingface.co supports a free trial of the roberta-paraphrase-detection model, and also provides paid use of the roberta-paraphrase-detection. Support call roberta-paraphrase-detection model through api, including Node.js, Python, http.
roberta-paraphrase-detection huggingface.co is an online trial and call api platform, which integrates roberta-paraphrase-detection's modeling effects, including api services, and provides a free online trial of roberta-paraphrase-detection, you can try roberta-paraphrase-detection online for free by clicking the link below.
AventIQ-AI roberta-paraphrase-detection online free url in huggingface.co:
roberta-paraphrase-detection is an open source model from GitHub that offers a free installation service, and any user can find roberta-paraphrase-detection on GitHub to install. At the same time, huggingface.co provides the effect of roberta-paraphrase-detection install, users can directly use roberta-paraphrase-detection installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
roberta-paraphrase-detection install url in huggingface.co: