Prescription Text Classifier (DistilBERT)

A fine-tuned DistilBERT model that normalizes noisy prescription text (brand names, typos, doses, frequencies) to a standard generic medicine name.

Example: tab nappa 500mg 1+0+1 5 days → paracetamol

Model Details

  • Developed by: Rajeemanju
  • Model type: Transformer (DistilBERT) for sequence classification
  • Language: English
  • Base model: distilbert-base-uncased
  • Task: Medicine name normalization (multi-class text classification)

Intended Use

For research and learning on medical text normalization, for example as a step in a prescription-processing pipeline.

Out-of-Scope Use

Not for real clinical or medical decisions. It has not been validated on real patient prescriptions.

Training Data

Custom dataset created by the author: [ ] samples, [ ] medicine classes, columns text and label. Text includes medicine name, dose, frequency, duration, and random typos. Split: 70% train, 15% validation, 15% test.

Training Procedure

  1. Stage 1 (baseline): encoder frozen, only the classification head trained (4 epochs, learning rate 1e-3).
  2. Stage 2 (fine-tuning): all layers unfrozen (6 epochs, learning rate 3e-5, weight decay 0.01, warmup 10%).
  • Framework: Hugging Face Transformers (PyTorch), trained on Google Colab (T4 GPU)
  • Max sequence length: 32

Results

Stage Test Accuracy
Before fine-tuning (frozen encoder) [ ]%
After fine-tuning ~98%

How to Use

from transformers import pipeline

clf = pipeline("text-classification", model="Rajeemanju/prescription-text-classifier")
print(clf("tab nappa 500mg 1+0+1 5 days"))

Limitations and Bias

  • Covers only the medicines present in the training dataset.
  • Trained on [synthetic / self-created] data, so performance on real-world or handwritten prescriptions may be lower.
  • Text only. No handwriting or OCR.

Future Work

Larger real-world dataset, OCR for handwritten prescriptions, sequence-to-sequence normalization, more medicines.

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

Model tree for Rajeemanju/prescription-text-classifier

Finetuned
(12764)
this model