Skip to main content
Bonsai Image 4B is a family of compact text-to-image models designed to run locally on phones, laptops, and NVIDIA GPUs. It is based on FLUX.2 Klein 4B. The diffusion transformer is available with either 1-bit binary or ternary weights. A small number of precision-sensitive layers remain at higher precision, while the text encoder and VAE are compressed separately as part of the complete deployment pipeline.

Specifications

Parameters4B
Base modelFLUX.2 Klein 4B
TaskText-to-image generation
Default resolution512 × 512
Supported platformsApple Silicon, iPhone, and NVIDIA GPUs
LicenseApache 2.0

Variants

FamilyWeight formatTransformer sizeComplete MLX payloadRecommended for
Ternary Bonsai Image 4BTernary weights with FP16 group scales1.21 GB3.88 GBHigher image quality and prompt fidelity
1-bit Bonsai Image 4BBinary weights with FP16 group scales0.93 GB3.42 GBMinimum memory footprint
The Ternary model is the recommended default. It preserves more of the original model’s visual quality while reducing the diffusion transformer to 1.21 GB. The 1-bit model brings the diffusion transformer below 1 GB and is optimized for devices where memory capacity and bandwidth are the primary constraints.

Artifacts

All model repositories are available in the Bonsai Image collection on Hugging Face.
FamilyRuntimeRepositoryTransformer size
TernaryMLXprism-ml/bonsai-image-ternary-4B-mlx-2bit1.21 GB
TernaryGemlite / CUDAprism-ml/bonsai-image-ternary-4B-gemlite-2bit1.21 GB
1-bitMLXprism-ml/bonsai-image-binary-4B-mlx-1bit0.93 GB
1-bitGemlite / CUDAprism-ml/bonsai-image-binary-4B-gemlite-1bit0.93 GB
The MLX repositories are intended for Apple Silicon. The Gemlite repositories use low-bit CUDA kernels for NVIDIA GPUs.

How to run it

Clone the Bonsai Image demo repository:
git clone https://github.com/PrismML-Eng/Bonsai-Image-Demo.git
cd Bonsai-Image-Demo
Install the required dependencies and download the default ternary model:
./setup.sh
The setup script detects your platform and selects the appropriate runtime:
  • MLX on Apple Silicon - Gemlite on Linux with an NVIDIA GPU
To install the smaller 1-bit model instead:
BONSAI_VARIANT=binary ./setup.sh

Generate an image

Run a single generation from the command line:
./scripts/generate.sh \
  --prompt "An icy bonsai tree in a rainy forest, with snowy mountains in the background, photorealistic."
You can also configure the image size, seed, and output path:
./scripts/generate.sh \
  --prompt "A hand-drawn map of a floating island, intricate ink illustration." \
  --size 1024x1024 \
  --seed 42 \
  --output outputs/floating-island.png \
  --open

Launch the local studio

Start the generation API and browser interface:
./scripts/serve.sh
This launches:
ServiceAddress
Bonsai Image Studiohttp://localhost:3000
Generation APIhttp://localhost:8000
Send a generation request from another terminal:
./scripts/send_request.sh \
  --prompt "A compact futuristic city built into a desert canyon at sunset." \
  --size 1024x1024 \
  --seed 42

Performance

For a 512 × 512 image, Bonsai Image 4B generates in approximately:
HardwareGeneration time
iPhone 17 Pro Max9.4 seconds
MacBook Pro with M4 ProApproximately 6 seconds
On an M4 Pro, Bonsai Image 4B is up to 5.6× faster than the full-precision MFLUX pipeline. Mean active memory during 512 × 512 generation is approximately:
ModelActive memory
1-bit Bonsai Image 4B1.50 GB
Ternary Bonsai Image 4B1.96 GB
Full-precision FLUX.2 Klein 4B11.74 GB

Run on iPhone

Bonsai Image 4B is also available through Bonsai Studio for iPhone. The app runs the ternary model directly on the device. Prompts and generated images remain local, and image generation does not require an internet connection. For the best experience, use an iPhone 15 Pro or newer with at least 8 GB of unified memory.