GitHunt
JA

Reference implementation: run any huggingface tokenizer in Android (rust).

HuggingFace Tokenizers on Android (HFTA)

Reference implementation using HuggingFace's (HF) tokenizers in Android.

Demo Video

UI to show text to tokens via the tokenizers library in real-time on Android at demo/demo.mp4:

demo.mp4

Try a Tokenizer

  1. Find a model you want to test on HF, e.g., Google's gemma-3-4b-it
  2. Download and add the tokenizer.json to app/src/main/assets named gemma-3-4b-it.json
  3. Modify SELECTED_TOKENIZER in app/build.gradle.kts

Features

Implementation Details

Run any HF's tokenizer on Android using the associated tokenizers.json from huggingface.co. To achieve that, the HF library is built via rust into a shared library and uses Java Native Interface (JNI) to load the library.

Thanks to

Languages

Kotlin83.8%Rust14.8%Shell1.3%

Contributors

Created November 15, 2025
Updated March 5, 2026
jawrainey/hfta | GitHunt