TinySD optimized for Arm-based mobile CPUs with SME2
An Arm-optimized ExecuTorch build of TinySD (segmind/tiny-sd) for text-to-image generation, targeting Mobile CPU systems.
Summary
This repository contains an Arm-optimized version of segmind/tiny-sd for text-to-image generation. The model is provided as a single multimethod ExecuTorch .pte file with three named methods (text_encoder, unet, vae_decoder), targeting Mobile CPU systems.
This version is intended to demonstrate efficient inference on Arm-based platforms while preserving the original model's intended behavior. The UNet is quantized to INT8 dynamic per-channel symmetric weights, with activations computed dynamically at runtime; the text encoder and VAE decoder remain FP32. Arm has evaluated this model on a 1500-sample proxy subset of MS-COCO val2014 and measured performance on a representative evaluation target.
Key results
| Area | Result |
|---|---|
| Model format | ExecuTorch .pte (multimethod: text_encoder, unet, vae_decoder) |
| Target device class | Mobile CPU |
| Reference device | vivo X300 (C1-Ultra, C1-Premium, C1-Pro, Android 16 / OriginOS 6) |
| Primary performance result | Total generation time 159.41 s (159.41 s p50 latency), 0.169 steps/second |
| Accuracy result | FID 58.48, CLIP score 26.65 |
| Size / memory result | Model size 968.77 MB, peak memory 4166.75 MB |
Original model
| Field | Value |
|---|---|
| Original model | segmind/tiny-sd |
| Original source | Hugging Face |
| Original developer | Segmind |
| Original model card | segmind/tiny-sd |
| Original license | CreativeML Open RAIL-M |
Model files
| File | Description |
|---|---|
tiny-sd_vivo-x300_executorch_optimized.pte |
Arm-optimized model for deployment |
example.py |
Minimal inference example |
pyproject.toml |
Pinned runtime dependencies for example.py, resolved with uv |
uv.lock |
Locked dependency resolution for pyproject.toml |
config.yaml |
Model I/O contract used by the example |
benchmarks/ |
FP32 baseline and Arm-optimized benchmark records |
Performance
Performance was measured on the reference configuration below. Results are intended to make the optimization reproducible but do not guarantee identical performance on every Arm-based system.
Reference configuration
| Field | Value |
|---|---|
| Device / platform | vivo X300 |
| CPU / accelerator | C1-Ultra, C1-Premium, C1-Pro (8 cores), CPU execution |
| OS | Android 16 / OriginOS 6 |
| Runtime | ExecuTorch 1.1.0 |
| Backend / delegate | XNNPACK, KleidiAI |
| Batch size | 1 |
| Precision | UNet quantized to INT8 dynamic per-channel symmetric weights (activations computed dynamically at runtime); text encoder and VAE decoder remain FP32 |
| Runs | 3 warmup + 5 measured |
Performance results
| Metric | Original / baseline | Arm-optimized | Improvement |
|---|---|---|---|
| p50 latency (ms) | 187141.63 | 159413.99 | 1.17 x faster |
| Total generation time (s) | 187.14 | 159.41 | 1.17 x faster |
| Steps per second | 0.143 | 0.169 | 1.18 x |
| Images per second | 0.01 | 0.01 | 1.00 x |
| Model size (MB) | 1892.74 | 968.77 | 1.95 x smaller |
| Peak memory (MB) | 5028.90 | 4166.75 | 1.21 x less |
| Average memory (MB) | 4528.33 | 3608.25 | 1.25 x less |
Accuracy
Accuracy was evaluated using the same preprocessing, input resolution, and evaluation protocol described below. Where possible, the optimized model is compared against the original model under the same evaluation conditions.
Evaluation setup
| Field | Value |
|---|---|
| Dataset | MS-COCO val2014 |
| Split | validation (1500-sample proxy) |
| Number of samples | 1500 |
| Metric(s) | FID (Fréchet Inception Distance), CLIP Score |
| Evaluation runtime | ExecuTorch |
Accuracy results
| Metric | Original / baseline | Arm-optimized | Change |
|---|---|---|---|
| FID | 57.27 | 58.48 | +1.21 (lower FID is better, so this is a regression) |
| CLIP score | 26.68 | 26.65 | -0.03 |
Accuracy was measured using the evaluation setup described above. Users should re-evaluate the model on their own data before production use.
Arm optimization approach
Arm optimized this model for efficient inference on Arm-based platforms using a hardware-aware conversion and validation flow.
For this release, Arm used:
| Optimization area | Applied? | Notes |
|---|---|---|
| Model conversion | Yes | Exported as three separate ExportedPrograms (text_encoder, UNet, VAE decoder) via torch.export, compiled into a single multimethod ExecuTorch .pte |
| Quantization | Yes | Dynamic INT8 symmetric quantization applied only to the unet component — per-channel weight granularity, activation scales computed at runtime, no calibration needed. text_encoder and vae_decoder remain FP32 to preserve accuracy. |
| Runtime/backend selection | Yes | ExecuTorch runtime with XNNPACK and KleidiAI backend |
| Graph/runtime compatibility updates | Yes | Performed as part of the ExecuTorch export pipeline |
| Accuracy validation | Yes | Compared against the original model or published baseline |
| Performance validation | Yes | Measured on the reference Arm platform |
The goal of this process is to improve deployment characteristics such as latency, memory use, model size, and runtime compatibility while preserving the model's intended behavior. Detailed conversion scripts, calibration configuration, or backend-specific implementation details may be provided separately where appropriate.
Using this model
Note: The Python/uv example runs on AWS Graviton (Ubuntu arm64) to confirm runtime compatibility only, and is intended as a guideline for building an equivalent run script on Mobile CPU systems. Every performance and accuracy figure on this page was measured on the vivo X300; none of them was re-measured on the proxy, and a run on the proxy is not evidence about the phone.
Install dependencies
Dependencies are declared in pyproject.toml. Resolve and install them into a local virtual environment with uv:
uv python install
uv sync --frozen
Run the example
uv run example.py
This model's exported program is a single ExecuTorch multimethod file containing three named methods — text_encoder, unet, and vae_decoder — loaded together and called in sequence inside a DPM-Solver++(2M) denoising loop (25 steps, guidance scale 7.5). The per-step DPM-Solver++(2M) constants are precomputed at export time and stored in the schedule_data.json sidecar file; no Python scheduler object is needed at inference time. Both schedule_data.json and the tokenizer/ directory must be present alongside the weight file for the example to run.
A fixed random seed (42) is used for the initial noise latents, so generated_image.png and generation_results.json are reproducible byte-for-byte across runs on the same environment.
Expected input and output
text_encoder
Expected input
| Property | Value |
|---|---|
| Input shape | [1, 77] |
| Input type | int64 |
| Input range | N/A |
| Preprocessing | Tokenized and padded prompt (CLIP tokenizer, max 77 tokens) |
Expected output
| Property | Value |
|---|---|
| Output shape | [1, 77, 768] |
| Output type | float32 |
| Postprocessing | Per-token text embeddings (CLIP ViT-L/14 text model), fed directly into the unet method |
unet
Expected input
| Property | Value |
|---|---|
| Input shape | latent [1, 4, 64, 64], timestep [1], encoder hidden states [2, 77, 768] |
| Input type | float32 (latent and encoder hidden states), and the timestep scalar |
| Input range | N/A |
| Preprocessing | Noisy latent plus timestep plus concatenated conditional/unconditional text embeddings; the batch dimension is 2 when classifier-free guidance is applied (unconditional and conditional stacked together) |
Expected output
| Property | Value |
|---|---|
| Output shape | [2, 4, 64, 64] |
| Output type | float32 |
| Postprocessing | Predicted noise (epsilon) for the current timestep. When classifier-free guidance is used, split the 2-item batch and apply guidance before the DPM-Solver++(2M) update step |
vae_decoder
Expected input
| Property | Value |
|---|---|
| Input shape | [1, 4, 64, 64] |
| Input type | float32 |
| Input range | N/A |
| Preprocessing | Denoised latent. Scaling by 1/0.18215 and the [-1, 1] to [0, 1] denormalization are baked into the exported wrapper, so the raw output of the denoising loop can be passed directly |
Expected output
| Property | Value |
|---|---|
| Output shape | [1, 3, 512, 512] |
| Output type | float32 |
| Postprocessing | Decoded image in [0.0, 1.0]. Multiply by 255 and cast to uint8 for display or saving as PNG/JPEG |
Intended use
This model is intended for developers evaluating text-to-image generation workloads on Arm-based platforms. It is suitable as a reference implementation for benchmarking, prototyping, and integration exploration.
Limitations
- Performance depends on the target device, runtime version, backend/delegate support, memory configuration, and system load.
- Accuracy was evaluated on a 1500-sample proxy subset of MS-COCO val2014 and may not generalize to all domains; the original TinySD paper reports FID at 30,000 samples, and FID computed at 1500 samples is known to run substantially higher than the full-scale evaluation.
- Output resolution is fixed at 512x512, and the denoising schedule is fixed at 25 steps (DPM-Solver++(2M) constants are pre-computed at export time).
- Generation time on a representative evaluation target is on the order of 160 seconds per image, suitable for offline use rather than real-time interaction.
- This release preserves the original model's intended task and behavior, but users should validate it for their own application, data, and deployment environment.
- This repository is not a replacement for the original model documentation.
Additional notes
- Quantization scope: only the unet method is quantized, to dynamic INT8. The text_encoder and vae_decoder methods are deliberately kept at FP32 to preserve accuracy.
- Proxy FID: the FID figures above are a 1,500-sample proxy evaluation.
- Sidecar files required:
schedule_data.json(precomputed DPM-Solver++(2M) constants) and thetokenizer/directory must both be present alongside the weight file at inference time. - Batch size 1 only: the current export uses batch size 1 for all three methods; batched generation would require re-export.
About this version
Original Model: segmind/tiny-sd by Segmind - Repository
Optimization/conversion: Arm-Optimized version for execution on Arm-based platforms.
Converted/optimized by: Arm
License: The Original Model and the Optimized Model are subject to CreativeML Open RAIL-M.
This repository contains a converted or optimized version of the Original Model (the “Optimized Model”). The Original Model has been converted or optimized as described above for execution on Arm-based platforms.
No retraining or fine-tuning of the Original Model was performed as part of the conversion or optimization. The conversion or optimization was not intended to change the Original Model’s behavior or intended use.
Original Model and Documentation
For information about the Original Model, including its development, training data, intended uses, limitations and other relevant information, please refer to the Original Model repository. Information in that repository was provided by the original developer or other third parties and, unless expressly stated otherwise, has not been independently verified by Arm.
Licenses and Third-Party Terms
Use of the Original Model and the Optimized Model is subject to the applicable licenses, usage restrictions and other terms identified above and in the relevant repositories. Publication of the Optimized Model does not grant any rights beyond those provided under the applicable license terms.
You are responsible for reviewing those terms and ensuring that your use of the Original Model and the Optimized Model is permitted.
Purpose of this Release
The Optimized Model is provided as a reference implementation to demonstrate and evaluate execution and performance on Arm-based systems. It is not a production-ready or supported solution.
Arm’s publication of the Optimized Model does not constitute an endorsement or certification of the Original Model or a representation that the Optimized Model is suitable for production use or any particular purpose.
To the fullest extent permitted by applicable law (i) the Optimized Model is provided “as is.” Arm makes no representations or warranties that the Original Model, the Optimized Model or their outputs are accurate, safe, secure, non-infringing, legally compliant, suitable for production use or fit for any particular purpose; and (ii) Arm will not be liable for any loss or damage arising from or in connection with the Optimized Model, its use or its outputs.
You are responsible for independently evaluating the Optimized Model, its outputs and its suitability for your intended use, including compliance with applicable legal, regulatory, safety and security requirements.
Arm does not commit to provide ongoing support, maintenance or updates for the Optimized Model. Any use of or reliance on the Optimized Model or its outputs is at your own risk.
- Downloads last month
- 20