The boltuix/bert-mobile model is a mobile-optimized BERT variant designed for natural language processing tasks requiring efficient performance on resource-constrained devices like mobile phones and edge hardware. Pretrained on English text using masked language modeling (MLM) and next sentence prediction (NSP) objectives, it is optimized for fine-tuning on a range of NLP tasks, including sequence classification, token classification, and question answering. With a size of ~140 MB, it can be quantized to ~25 MB with no major loss in performance, making it ideal for mobile and edge applications needing strong performance with minimal resource usage.
The boltuix/bert-mobile model is a PyTorch-based transformer model derived from TensorFlow checkpoints in the Google BERT repository. It builds on research from On the Importance of Pre-training Compact Models (arXiv) and Generalization in NLI: Ways (Not) To Go Beyond Simple Heuristics (arXiv). Ported to Hugging Face, this uncased model (~140 MB) is engineered for mobile-optimized NLP applications, such as sentiment analysis, named entity recognition, and natural language inference, making it suitable for developers and researchers targeting efficient deployment on mobile and edge devices.
en)BoltUIX offers a range of BERT-based models tailored to different performance and resource requirements. The boltuix/bert-mobile model is optimized for mobile and edge devices, offering strong performance with the ability to quantize to ~25 MB without significant loss. Below is a summary of available models:
| Tier | Model ID | Size (MB) | Notes |
|---|---|---|---|
| Micro | boltuix/bert-micro | ~15 MB | Smallest, blazing-fast, moderate accuracy |
| Mini | boltuix/bert-mini | ~17 MB | Ultra-compact, fast, slightly better accuracy |
| Tinyplus | boltuix/bert-tinyplus | ~20 MB | Slightly bigger, better capacity |
| Small | boltuix/bert-small | ~45 MB | Good compact/accuracy balance |
| Mid | boltuix/bert-mid | ~50 MB | Well-rounded mid-tier performance |
| Medium | boltuix/bert-medium | ~160 MB | Strong general-purpose model |
| Large | boltuix/bert-large | ~365 MB | Top performer below full-BERT |
| Pro | boltuix/bert-pro | ~420 MB | Use only if max accuracy is mandatory |
| Mobile | boltuix/bert-mobile | ~140 MB | Mobile-optimized; quantize to ~25 MB with no major loss |
For more details on each variant, visit the BoltUIX Model Hub.
The model can be used directly for masked language modeling or next sentence prediction tasks, such as predicting missing words in sentences or determining sentence coherence, delivering strong accuracy for mobile applications.
The model is designed for fine-tuning on a variety of downstream NLP tasks optimized for mobile and edge devices, including:
The model is not suitable for:
boltuix/bert-large or boltuix/bert-pro instead).The model may inherit biases from its training data (BookCorpus and English Wikipedia), potentially reinforcing stereotypes, such as gender or occupational biases. For example:
from transformers import pipeline
unmasker = pipeline('fill-mask', model='boltuix/bert-mobile')
unmasker("The man worked as a [MASK].")
Output:
[
{'sequence': '[CLS] the man worked as a engineer. [SEP]', 'token_str': 'engineer'},
{'sequence': '[CLS] the man worked as a doctor. [SEP]', 'token_str': 'doctor'},
...
]
unmasker("The woman worked as a [MASK].")
Output:
[
{'sequence': '[CLS] the woman worked as a teacher. [SEP]', 'token_str': 'teacher'},
{'sequence': '[CLS] the woman worked as a nurse. [SEP]', 'token_str': 'nurse'},
...
]
These biases may propagate to downstream tasks. While the model’s size (~140 MB, quantizable to ~25 MB) makes it suitable for mobile devices, its performance may be limited for complex tasks compared to larger variants.
Users should:
Use the code below to get started with the model.
from transformers import pipeline, BertTokenizer, BertModel
# Masked Language Modeling
unmasker = pipeline('fill-mask', model='boltuix/bert-mobile')
result = unmasker("Hello I'm a [MASK] model.")
print(result)
# Feature Extraction (PyTorch)
tokenizer = BertTokenizer.from_pretrained('boltuix/bert-mobile')
model = BertModel.from_pretrained('boltuix/bert-mobile')
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='pt')
output = model(**encoded_input)
The model was pretrained on:
See the BoltUIX Dataset Card for more details.
[CLS] Sentence A [SEP] Sentence B [SEP].[MASK].Evaluated on the GLUE benchmark, including tasks like MNLI, QQP, QNLI, SST-2, CoLA, STS-B, MRPC, and RTE.
GLUE test results (fine-tuned):
| Task | MNLI-(m/mm) | QQP | QNLI | SST-2 | CoLA | STS-B | MRPC | RTE | Average |
|---|---|---|---|---|---|---|---|---|---|
| Score | 83.9/82.7 | 71.5 | 89.9 | 92.7 | 51.8 | 85.0 | 88.0 | 66.2 | 79.0 |
The model delivers strong performance across GLUE tasks for a mobile-optimized model, with notable results in SST-2 and QNLI. It outperforms smaller variants like boltuix/bert-mid in tasks such as RTE and CoLA, making it a robust choice for mobile applications.
The model’s attention mechanisms were analyzed to ensure effective contextual understanding optimized for mobile deployment, with no significant overfitting observed during pretraining. Ablation studies validated the training configuration for efficient performance.
Carbon emissions estimated using the Machine Learning Impact calculator from Lacoste et al. (2019).
BibTeX:
@article{DBLP:journals/corr/abs-1810-04805,
author = {Jacob Devlin and Ming{-}Wei Chang and Kenton Lee and Kristina Toutanova},
title = {{BERT:} Pre-training of Deep Bidirectional Transformers for Language Understanding},
journal = {CoRR},
volume = {abs/1810.04805},
year = {2018},
url = {http://arxiv.org/abs/1810.04805},
archivePrefix = {arXiv},
eprint = {1810.04805}
}
APA: Devlin, J., Chang, M.-W., Lee, K., & Toutanova, K. (2018). BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. CoRR, abs/1810.04805. http://arxiv.org/abs/1810.04805
For questions, please contact [email protected] or open an issue on the model repository.