Local Diffusion

July 21, 2025 Β· View on GitHub

License Flutter Badge Android Badge Ko-fi Badge
Latest Release


Run the latest diffusion models directly on your mobile device.


App Icon


Local Diffusion is a Flutter application that brings Diffusion models to Android, powered by the amazing stable-diffusion.cpp

Download

Download and install the latest .apk from the GitHub Releases page:

Latest Release

✨ Key Features

  • πŸ“± Truly Local Inference: Generate images entirely on your Android device.

  • πŸš€ Broad Model Compatibility:

    • Supports a wide range of architectures: SD1.x, SD2.x, SDXL, SD3/SD3.5, Flux/Flux-schnell, SD-Turbo, SDXL-Turbo, and more.

    • Load models directly from popular sources like Hugging Face and Civitai.

    • Works with common model formats: .safetensors and .ckpt.

  • ⚑ On-the-Fly Quantization: Automatically quantize full-precision models during loading to save memory and potentially increase speed. Supported formats: q8_0, q6_k, q5_0, q5_1, q5_1k, q4_0, q4_1, q4_k, q3_k, q2_k.

  • 🏎️ Performance Optimizations:

    • Flash Attention: Reduces memory usage during inference

    • TAESD: Significantly speeds up the image decoding process.

    • VAE Tiling: Reduces memory consumption during the VAE decoding stage, crucial for larger images on memory-constrained devices.

  • 🎨 Advanced Generation Capabilities:

    • ControlNet: Guide image generation with precise control (includes Scribble-to-Image).

    • PhotoMaker: Generate custom portraits from reference images.

    • Img2Img: Generate images based on an initial input image.

    • Inpainting/Outpainting: Modify specific parts of an image or expand its canvas.

    • LoRA Support: Apply Low-Rank Adaptations to customize model outputs.

    • Negative Prompts: Specify what you don't want to see in the image.

    • Token Weighting: Emphasize or de-emphasize specific parts of your prompt.

    • Multiple Sampling Methods: Euler A, Euler, Heun, DPM2, DPM++ 2M, DPM++ 2M v2, DPM++ 2S a, LCM, TCD, DDIM

  • πŸ’» GPU Acceleration (Experimental):

    • Vulkan: Currently performs ~2x slower than CPU. Performance improvements are planned.

    • OpenCL: Only supports Adreno 7xx GPUs for now. Optimized for Q4_0 quantization; also supports Q8_0 and FP16. Operations or devices outside these specifics may fall back to CPU execution.

πŸ“Š Memory Usage

Peak Memory Usage in MB

Benchmark settings: TAE + Flash Attention + VAE Tiling + only Clip_L Q8_0 for DiT/MMDiT architecture (Clip_G and T5_XXL were skipped)

ModelResolutionQ2_K (MB)Q4_0 (MB)Q8_0 (MB)fp16 (MB)
SD 1.5256x2561431146116481997
512x5121870190020872436
768x7684001403142184567
SDXL256x2561868245038896586
512x5122228281042496946
768x7682228281042496946
1024x10242228281042496946
SD 2.1256x2561510159318922452
512x5121870195322522812
768x7681870195322522812
SD3.5 Medium256x2561790231534335420
512x5122150267537935780
768x7682289281439325919
1024x10243437396250807067
SD3.5 Large256x256463050278848-
512x512499053879208-
768x768499053879208-
1024x10247271766811489-
FLUX.1256x2564168681312456-
512x5124528717312816-
768x7684551719612839-
1024x10244889753413177-

πŸ—ΊοΈ Roadmap

  • iOS Support

  • Performance Improvements

πŸ› οΈ Building

Ensure you have the Flutter SDK and Android development environment set up.

Run in Debug/Release Mode

flutter run

Release

flutter run --release

Build Release APK

  `flutter build apk --release`

The output APK will be located at build/app/outputs/flutter-apk/app-release.apk.

Credits