Run this model with HF Jobs

Run litert-community/EdgeCoder-Multilingual-61M on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/litert-community/EdgeCoder-Multilingual-61M. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/litert-community/EdgeCoder-Multilingual-61M on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
mlboydaisuke's picture
Add the EdgeCoder-Multilingual-61M LiteRT graph, example script and card
c4546e0 verified
|
Raw History Blame Contribute Delete
5.32 kB
---
license: apache-2.0
language:
- multilingual
- en
- ru
- zh
- es
- de
- fr
- ja
- it
- pt
- pl
- nl
- vi
- id
- ar
- cs
- tr
- hu
- sv
- ro
- uk
- ko
- el
- "no"
- da
- fi
- sk
- bg
- hi
- hr
- bs
- lt
- sl
- he
- bn
- sr
- lv
- et
- ms
- ur
- mk
- la
- be
- mt
- sw
- ga
- yi
pipeline_tag: feature-extraction
base_model: knowledgator/EdgeCoder-Multilingual-61M
base_model_relation: quantized
library_name: litert
tags:
- litert
- tflite
- on-device
- feature-extraction
- multilingual
---
# EdgeCoder-Multilingual-61M for LiteRT
This repository holds [knowledgator/EdgeCoder-Multilingual-61M](https://huggingface.co/knowledgator/EdgeCoder-Multilingual-61M), the author's multilingual text encoder for 46 languages, converted without quantization to one float32 LiteRT graph for the CPU. The graph takes 128 tokens and returns a feature vector of 384 values for each of them. On a Pixel 8a CPU with LiteRT 2.2.0 set to 4 threads, one run of the graph took 193.4 ms (median of 20 runs, 2026-12-05). Speed still being tuned (updates follow).
Run it with Python on a computer (we ran `example.py` on an arm64 Mac):
```bash
pip install ai-edge-litert==2.2.0 transformers numpy huggingface_hub
hf download litert-community/EdgeCoder-Multilingual-61M --local-dir EdgeCoder-Multilingual-61M
cd EdgeCoder-Multilingual-61M
python example.py 'EdgeCoder — компактний багатомовний енкодер.' '小さなモデルで多言語の文章を処理する。'
```
In an Android app, give the graph the inputs listed under [The graph](#the-graph).
On a Pixel 8a, LiteRT 2.2.0 could not compile the graph for the GPU (2026-12-05). Its log lists `GATHER_ND` among the operations the GPU delegate does not support. Run the graph on the CPU. The input is fixed at 128 tokens (the author's model takes up to 8192 tokens): shorter text is padded and longer text is cut. As the author's card says, the model is a backbone that needs fine-tuning for classification, token classification, retrieval or embedding tasks.
## Example output
`example.py` loads the author's tokenizer from the author's repository, knowledgator/EdgeCoder-Multilingual-61M, at revision `d2b4066c768e16b763c0693f6ad474c520ce64e3`. `--tokenizer <folder>` loads a local copy instead. The script runs the graph on the CPU with ai-edge-litert and averages the features of each text's real tokens into one vector.
On 2026-12-05, in a new Python 3.12.13 environment on an arm64 Mac, where the `pip install` line above installed ai-edge-litert 2.2.0, transformers 5.26.0, numpy 2.5.5 and huggingface_hub 2.6.0, the `example.py` command above printed this:
```text
text 1 per-token features shape: (1, 128, 384)
text 1 mean-pooled first 6: [0.344991, 0.238103, -0.290134, 0.122885, 0.141884, -0.251515]
text 1 mean-pooled L2 norm: 4.802272
text 2 per-token features shape: (1, 128, 384)
text 2 mean-pooled first 6: [0.346773, 0.213815, -0.305823, 0.085307, 0.165460, -0.211308]
text 2 mean-pooled L2 norm: 4.899470
cosine similarity: 0.954984
```
## The graph
`edgecoder_encode_128_fp32.tflite` (264,419,180 bytes) has the signature `encode_128`:
| | name | type | size | meaning |
|---|---|---|---|---|
| input | `input_ids` | int32 | [1, 128] | token ids from the author's tokenizer, padded or cut to 128 |
| input | `attention_mask` | int32 | [1, 128] | 1 for a real token, 0 for padding |
| output | `last_hidden_state` | float32 | [1, 128, 384] | a feature vector of 384 values for each token |
## Accuracy
On 2026-12-05, the graph's features for all 217 real tokens of eight test inputs matched the author's model on an arm64 Mac CPU (ai-edge-litert 2.2.0) and on a Pixel 8a CPU (LiteRT 2.2.0), both set to 1 thread. Every feature value met `|LiteRT − reference| ≤ 2e-4 + 1e-4 × |reference|`.
The reference is the author's model, run in float32 on an arm64 Mac CPU with PyTorch 2.7.1 and transformers 4.52.4. The eight inputs of 128 tokens are the example sentence of the author's card, a Japanese sentence, an Arabic sentence, a text that mixes scripts with whitespace and code, an empty text, a text of special-token strings, a Spanish–Korean text pair, and a long text cut to 128 tokens.
## Speed
The 193.4 ms median at the top comes from an Android app that ran the graph with LiteRT 2.2.0's `CompiledModel` API on a Pixel 8a CPU on 2026-12-05. We set the runtime to 4 threads and did not read back how many it used. After 5 warm-up runs, the 20 timed runs on the example sentence of the author's card took between 165.3 and 278.4 ms each. The times exclude writing the inputs and reading the output.
## How it was made
We converted the author's checkpoint at revision `d2b4066c768e16b763c0693f6ad474c520ce64e3` to LiteRT with litert-torch 0.9.4, PyTorch 2.13.0 and transformers 5.14.1.
## License
The files in this repository are under the Apache License 2.0, the license that [the author's card](https://huggingface.co/knowledgator/EdgeCoder-Multilingual-61M) declares for the model. [`LICENSE`](https://huggingface.co/litert-community/EdgeCoder-Multilingual-61M/blob/main/LICENSE) is the Apache License 2.0 text. The tokenizer is not in this repository: it comes from the author's repository. Credit for the model goes to Knowledgator Engineering, and the author's card gives the citation of their paper.