--- license: apache-2.0 base_model: Qwen/Qwen2.5-1.5B-Instruct pipeline_tag: text-generation tags: - chat --- # litert-community/Qwen2.5-1.5B-Instruct This model provides a few variants of [Qwen/Qwen2.5-1.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-1.5B-Instruct) that are ready for deployment on Android using the [LiteRT (fka TFLite) stack](https://ai.google.dev/edge/litert) and [MediaPipe LLM Inference API](https://ai.google.dev/edge/mediapipe/solutions/genai/llm_inference). ## Use the models ### Colab *Disclaimer: The target deployment surface for the LiteRT models is Android/iOS/Web and the stack has been optimized for performance on these targets. Trying out the system in Colab is an easier way to familiarize yourself with the LiteRT stack, with the caveat that the performance (memory and latency) on Colab could be much worse than on a local device.* [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/#fileId=https://huggingface.co/litert-community/Qwen2.5-1.5B-Instruct/blob/main/notebook.ipynb) ### Android * Download and install [the apk](https://github.com/google-ai-edge/gallery/releases/latest/download/ai-edge-gallery.apk). * Follow the instructions in the app. To build the demo app from source, please follow the [instructions](https://github.com/google-ai-edge/gallery/blob/main/README.md) from the GitHub repository. ### iOS * Clone the [MediaPipe samples](https://github.com/google-ai-edge/mediapipe-samples) repository and follow the [instructions](https://github.com/google-ai-edge/mediapipe-samples/tree/main/examples/llm_inference/ios/README.md) to build the LLM Inference iOS Sample App using XCode. * Run the app via the iOS simulator or deploy to an iOS device. ## Performance ### Android Note that all benchmark stats are from a Samsung S24 Ultra and multiple prefill signatures enabled.
Backend Quantization scheme Context length Prefill (tokens/sec) Decode (tokens/sec) Time-to-first-token (sec) CPU Memory (RSS in MB) GPU Memory (RSS in MB) Model size (MB)

CPU

fp32 (baseline)

1280

27 tk/s

6 tk/s

9.88 s

6,144 MB

5,895 MB

🔗

dynamic_int8

1280

106 tk/s

23 tk/s

2.74 s

1,820 MB

1,523 MB

🔗

4096

63 tk/s

20 tk/s

4.40 s

2,042 MB

1,523 MB

🔗

GPU

1280

706 tk/s

24 tk/s

6.94 s

3,175 MB

1,504 MB

1,523 MB

🔗

4096

417 tk/s

22 tk/s

7.93 s

3,176 MB

1,875 MB

1,523 MB

🔗

* For the list of supported quantization schemes see [supported-schemes](https://github.com/google-ai-edge/ai-edge-torch/tree/main/ai_edge_torch/generative/quantize#supported-schemes). For these models, we are using prefill signature lengths of 32, 128, 512 and 1280. * Model Size: measured by the size of the .tflite flatbuffer (serialization format for LiteRT models) * Memory: indicator of peak RAM usage * The inference on CPU is accelerated via the LiteRT [XNNPACK](https://github.com/google/XNNPACK) delegate with 4 threads * Benchmark is run with cache enabled and initialized. During the first run, the time to first token may differ.