Spaces:
Running
Running
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,10 +1,80 @@
|
|
| 1 |
---
|
| 2 |
title: README
|
| 3 |
-
emoji:
|
| 4 |
colorFrom: yellow
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
title: README
|
| 3 |
+
emoji: π±
|
| 4 |
colorFrom: yellow
|
| 5 |
+
colorTo: blue
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
---
|
| 9 |
|
| 10 |
+

|
| 11 |
+
|
| 12 |
+
# MobileTransformers
|
| 13 |
+
|
| 14 |
+
**Export a Hugging Face model, pull it onto a phone, then chat with it, retrieve over your own
|
| 15 |
+
documents, classify text, fine-tune it, merge the adapter into the weights, and let it call tools β
|
| 16 |
+
entirely on the device.** No server, no inference API, no data leaving the phone.
|
| 17 |
+
|
| 18 |
+
Built on **ONNX Runtime**, with hardware-accelerated execution providers (XNNPACK, NNAPI, QNN) for
|
| 19 |
+
both inference *and* training on Android.
|
| 20 |
+
|
| 21 |
+
π **[github.com/martinkorelic/mobiletransformers](https://github.com/martinkorelic/mobiletransformers)**
|
| 22 |
+
|
| 23 |
+
## The packages here are not plain models
|
| 24 |
+
|
| 25 |
+
Every repo in this organization holds an **exported MobileTransformers package**: a manifest, ONNX
|
| 26 |
+
stages per variant, and a weight-handoff map that lets a trained adapter be merged into the inference
|
| 27 |
+
weights *on the phone*. `transformers`, `optimum` and plain `onnxruntime` cannot load them β the
|
| 28 |
+
Android SDK is what reads them.
|
| 29 |
+
|
| 30 |
+
```kotlin
|
| 31 |
+
val model = MobileTransformers.fromPretrained(
|
| 32 |
+
context = context,
|
| 33 |
+
repoId = "mobiletransformers/SmolLM2-135M-Instruct",
|
| 34 |
+
)
|
| 35 |
+
```
|
| 36 |
+
|
| 37 |
+
Every package ships **both an inference and a training stage**, because on-device fine-tuning is the
|
| 38 |
+
point of the project β a package you cannot train demonstrates half of it.
|
| 39 |
+
|
| 40 |
+
## The shelf
|
| 41 |
+
|
| 42 |
+
| model | task | download | fine-tuning | good for |
|
| 43 |
+
| --- | --- | --- | --- | --- |
|
| 44 |
+
| [SmolLM2-135M-Instruct](https://huggingface.co/mobiletransformers/SmolLM2-135M-Instruct) | text-generation | 663 MB | LoRA | **start here** β fastest to pull and to train |
|
| 45 |
+
| [gemma-3-270m-it](https://huggingface.co/mobiletransformers/gemma-3-270m-it) | text-generation | 1814 MB | **MARS** | the shared-adapter method this project researches |
|
| 46 |
+
| [functiongemma-270m-it](https://huggingface.co/mobiletransformers/functiongemma-270m-it) | text-generation | 3557 MB | LoRA | tool / function calling |
|
| 47 |
+
| [Qwen2.5-0.5B-Instruct](https://huggingface.co/mobiletransformers/Qwen2.5-0.5B-Instruct) | text-generation | 2554 MB | LoRA | chat quality, and the memory ceiling |
|
| 48 |
+
| [all-MiniLM-L6-v2](https://huggingface.co/mobiletransformers/all-MiniLM-L6-v2) | text-classification | 94 MB | LoRA | retrieval, and the smallest training run |
|
| 49 |
+
| [distilbert-sst2-english](https://huggingface.co/mobiletransformers/distilbert-sst2-english) | text-classification | 270 MB | LoRA | classification with real trained labels |
|
| 50 |
+
|
| 51 |
+
Sizes are the **inference group** β what a plain install downloads β measured from each package's
|
| 52 |
+
manifest. Asking for the training or retrieval group adds to it.
|
| 53 |
+
|
| 54 |
+
> Some repos are currently private while the project is being prepared for release. Set an `HF_TOKEN`
|
| 55 |
+
> with access, or start with the public ones.
|
| 56 |
+
|
| 57 |
+
## MARS
|
| 58 |
+
|
| 59 |
+
**Multi-Adapter Rank Sharing** is this organization's own fine-tuning method. Instead of every layer
|
| 60 |
+
carrying its own low-rank adapter, layers share a down-projection β so the trainable parameter count
|
| 61 |
+
grows with *rank* rather than with *depth*. On
|
| 62 |
+
[gemma-3-270m-it](https://huggingface.co/mobiletransformers/gemma-3-270m-it) that is **279,936
|
| 63 |
+
trainable parameters against a 268M backbone**, small enough to train in a phone's memory budget.
|
| 64 |
+
|
| 65 |
+
The research behind it, including the on-device training methodology and the experimental results, is
|
| 66 |
+
in the thesis: [*Parameter-Efficient Tuning of Large Language Models on Mobile
|
| 67 |
+
Devices*](https://repozitorij.uni-lj.si/IzpisGradiva.php?lang=eng&id=175561).
|
| 68 |
+
|
| 69 |
+
## Citation
|
| 70 |
+
|
| 71 |
+
If you are using this framework for your own work, please cite:
|
| 72 |
+
|
| 73 |
+
```bibtex
|
| 74 |
+
@misc{mobiletransformers2025,
|
| 75 |
+
author = {Koreli\v{c}, Martin and Pejovi{\'c}, Veljko},
|
| 76 |
+
title = {MobileTransformers: An On-Device LLM PEFT Framework for Fine-Tuning and Inference},
|
| 77 |
+
year = {2025},
|
| 78 |
+
howpublished = {\url{https://gitlab.fri.uni-lj.si/lrk/mobiletransformers}}
|
| 79 |
+
}
|
| 80 |
+
```
|