Gestura FLUX.2 Klein 4B LiteRT/TFLite Android Runtime Integration Contract
Gestura on-device performance
The fastest measured generation times for this model package in Gestura are:
Device
Memory
Text-to-image
Two-image composition
Samsung Galaxy S26
12 GB
9 seconds
12 seconds
Samsung Galaxy S22
8 GB
1 minute 20 seconds
1 minute 57 seconds
These are the fastest measurements observed in Gestura on the specified
devices. They do not guarantee performance in other applications, runtimes, or
devices.
This model repository does not contain the Gestura application source code
or instructions for building or invoking Gestura. This document defines only
the contract that third-party applications must follow to execute this model
package.
1. Model identity
Item
Value
Model repository
ZawShiShawn/gestura-flux2-klein-4b-litert-tflite
Runtime payload baseline revision
77978ac251ca6e34504b9f6638fd3e0314970071
Upstream base model
black-forest-labs/FLUX.2-klein-4B
Upstream conversion revision
e7b7dc27f91deacad38e78976d1f2b499d76a294
Qwen text-encoder source
text_encoder/ and tokenizer/ in the pinned FLUX revision above
Qwen architecture and attribution
Qwen3-4B; Qwen/Alibaba Cloud
Upstream license
Apache License 2.0
77978ac251ca6e34504b9f6638fd3e0314970071 is the baseline commit at which
all 43 runtime payload files were first published together. Later commits only
add or revise documentation such as README.md, LICENSE, and NOTICE.
Applications must still validate the size and SHA-256 identity of every runtime
file from the revision they download.
This public package did not fetch a separate Qwen repository or Qwen revision.
The Qwen3-4B text-encoder weights and tokenizer assets come from the fixed files
inside
black-forest-labs/FLUX.2-klein-4B@e7b7dc27f91deacad38e78976d1f2b499d76a294.
The public ke_enc*.tflite files are not the separate
Qwen/Qwen3-4B-AWQ sidecar conversion variant.
This is a derivative LiteRT/TFLite Android runtime package for FLUX.2 [klein]
4B. It is not the original PyTorch/Diffusers checkpoint, a single directly
invocable .tflite model, or an SDK.
Third-party applications must implement tokenization, tensor layout, image
preprocessing and postprocessing, the four-step flow schedule, and orchestration
across all graphs. Running only one graph cannot produce a complete image.
The model graphs use the LiteRT/TFLite format. Execution is not restricted to
Google's official LiteRT API, but the runtime must fully implement the contract
in Section 4, including SignatureDef, the required operations and data types,
and external-weight resolution. A runtime that does not implement this contract
cannot execute the package.
"Gestura" identifies this model package and its associated product. It does not
mean that the application source code is included in the model repository.
1.1 Quantization formats
The public package converts the DiT weights directly from the official BF16
transformer checkpoint at the pinned revision. The Qwen text encoder and VAE
are packaged under their respective conversion contracts. Components use the
following storage formats:
Component
Public package format
DiT transformer
Mixed W4/INT8/FP16 weight profile
DiT W4 matrices
7 matrices; activation-block Hessian GPTQ, signed INT4, input-column group size 128, FP16 scales, no zero-point
69 tensors; converted directly from official BF16 weights to FP16 storage and converted to FLOAT32 at runtime
Qwen text encoder
Three graphs with embedded channelwise dynamic-range INT8 weights; public signature inputs and outputs are FLOAT32, not an AWQ4 sidecar structure
Token embedding
Little-endian FP16
Time/guidance lookup
BF16
VAE encoder/decoder
Channelwise dynamic-range INT8 weights; public signature inputs and outputs are FLOAT32 and do not use the DiT W4 profile
W4A16 is the name of the DiT quantization profile. Only seven selected matrices
are stored in 4-bit form. Activations use FP16 or FP32 paths according to the
device runtime. W4A16 does not mean that every tensor in the package is INT4.
The DiT W4, INT8, and FP16 payloads all come directly from the same official
BF16 numerical source; earlier INT8 or INT2 intermediate artifacts were not
used as the numerical source. Third parties must not requantize or rewrite any
graph or sidecar, because doing so invalidates the file identities and numerical
contract of the revision.
The three ke_enc*.tflite files contain embedded INT8 Qwen weights. The public
package has no separate Qwen AWQ weight sidecar. qwen_embed_fp16.bin contains
only the FP16 token-embedding table and does not contain encoder-layer weights.
1.2 Quantization quality boundaries
The DiT W4 conversion first applies stage-candidate thresholds, then uses a DiT
trajectory with no W4 matrices, where all other heavy matrices are quantized
directly from BF16 to INT8, as the final relative baseline:
Item
Fixed threshold
Stage-candidate direct-trajectory NRMSE
No greater than 0.06
Stage-boundary NRMSE
No greater than 0.08
Final W4 trajectory cosine similarity relative to the direct-BF16 INT8 baseline
At least 0.995
Final W4 trajectory NRMSE relative to the direct-BF16 INT8 baseline
No greater than 0.05
Final W4 trajectory signal ratio relative to the direct-BF16 INT8 baseline
0.90..1.10
The final gate also requires the W4-to-BF16 NRMSE to be no greater than the
direct-BF16-INT8-to-BF16 baseline NRMSE multiplied by 1.15, plus 0.01.
Cosine similarity must be no lower than that baseline's BF16-relative value
minus 0.01. The public package passed candidate selection and the final
tensor-space gate.
These values do not mean that the absolute W4-to-BF16 NRMSE must be below
0.05, and they do not prove perceptual image quality or complete runtime
validation. Final packaging records keep device image-quality comparisons
separate from full runtime validation. They also do not imply pixel-identical
output for every prompt. Actual output remains affected by the seed, scheduler,
runtime numerical path, and image preprocessing and postprocessing.
1.3 Public-package deduplication
Deduplication applies only to assets with identical content identity in the
public package:
kc_*, kce_*, and kce2_* retain their family-specific graphs.
Identical stages across the three families share one weights/dit_* sidecar,
so 24 denoising graphs require only eight external-weight files.
All three families share one text encoder, tokenizer, VAE, and set of host
lookup assets.
Shared identity is determined by revision, relative path, file size, and
SHA-256 together.
Graphs or weights with different content identities must not be merged merely
because their filenames are similar.
2. Workflows
The model package contains three graph families:
Workflow
Conditioning images
Graph family
Text-to-image
0
kc_*
Single-image editing
1
kce_*
Two-image editing
2
kce2_*
Required rules:
Each request must select exactly one family.
Graphs from different families must not be chained or interchanged.
Single-image editing accepts only image 1.
Two-image editing distinguishes its conditioning images only as image 1 and
image 2.
Image numbers are tensor-binding identities. They do not indicate reception
or upload order, and they do not imply primary or reference roles.
Two-image editing must provide both image 1 and image 2.
weights/*.bin files are required external-weight sidecars used while
executing the graphs; they are not standalone models.
Identical stages across the three families share the corresponding dit_*
sidecar.
Graphs, sidecars, tokenizer files, and host assets must come from the same
revision.
Files and directories must not be renamed or flattened.
Applications must validate the fixed relative path, file size, and SHA-256 of
every file.
Comparing file size alone is not a complete integrity check.
4. LiteRT/TFLite runtime contract
The runtime must support:
Loading TFLite/LiteRT graphs.
Enumerating and invoking SignatureDef entries by name.
Reading the name, shape, and data type of every input and output tensor.
Resolving graph external-buffer and external-weight references.
Binding the correct regions of weights/*.bin to each graph.
Executing all data types and operations used by the model.
Passing complete tensors between stages.
Stopping generation and reporting an error when shape, type, weight binding,
or execution fails.
A general org.tensorflow.lite.Interpreter without an external-weight resolver
cannot directly execute this package. The runtime must provide
SetWeightLoader, SetExternalWeightScopedFile, or equivalent functionality.
Exact API names depend on the LiteRT build.
The external-weight resolver must locate sidecar data using the logical name,
offset, and length stored in graph metadata. It must not use fuzzy filename
searches or assume that an entire sidecar belongs to one tensor.
5. Geometry and tensor contract
5.1 Output geometry
The package currently contains the following output sizes:
Width and height must each be between 256 and 512 pixels and divisible by 32.
The application must confirm that all required graphs expose a signature for
the requested geometry.
Denoising-graph signature names use this format:
geometry_{WIDTH}x{HEIGHT}_text_512
Applications must still enumerate the actual SignatureDef entries and must
not rely only on constructing the expected signature name.
5.2 Primary shapes
For output dimensions W × H:
Data
Shape/rule
Text sequence length
512 model tokens
Text hidden width
2,560
Prompt-conditioning width
7,680
VAE latent
[1, 32, H/8, W/8]
Packed transformer latent token count
(H/16) × (W/16)
Packed transformer latent width
128
Transformer hidden width
3,072
Denoising steps
4
Before passing any tensor to a graph, the application must validate its element
count, shape, data type, and finite state. It must not hide incompatible tensors
by truncating or zero-padding them.
Prompts longer than 512 model tokens must be truncated. Shorter prompts must be
padded with a correct attention mask. Character count must not be used as token
count.
Image temporal positions are fixed: noisy/output = 0, image 1 = 10, and
image 2 = 20. Image numbers must not be inferred from file ordering or arrival
order.
7.2 Initial latent
Text-to-image must initialize the noisy latent with Gaussian noise derived
from the seed.
Image editing must construct the initial latent according to the FLUX.2 Klein
flow scheduler and initStrength.
initStrength must be within 0.0..1.0.
Reproducing a seed requires the same RNG, Gaussian transform, floating-point
types, and complete input conditions.
7.3 VAE decoding
After four denoising steps:
Unpack the width-128 latent into the VAE latent layout.
Apply the model-required latent normalization or denormalization.
Invoke kv_vae.tflite.
Map the [-1, 1] output to the RGB pixel range.
Reject output containing NaN or Infinity.
Convert the valid RGB buffer to the application's image format.
8. Four-step denoising contract
Each family contains eight stages in a fixed order:
This package is distributed under the Apache License 2.0. A separate personal
license from the converter is not required. The converter may add a copyright
notice, but it must not replace upstream licensing or attribution.
The model repository contains:
Root LICENSE: the complete, unmodified English text of the Apache License
2.0.
Root NOTICE: applicable Black Forest Labs and Qwen/Alibaba Cloud
attribution, conversion details, and trademark statements. The pinned FLUX
upstream revision does not itself contain a separate NOTICE file; this
file preserves applicable attribution and trademark information from the
upstream model card and documents changes made for this derivative package.
A statement that this is a derivative LiteRT/TFLite Android runtime package,
not an official Black Forest Labs Android release.
A record that the upstream model was converted into LiteRT/TFLite graphs,
external-weight sidecars, and supporting runtime assets.
No use of Black Forest Labs or FLUX trademarks that implies sponsorship,
certification, or partnership.
A clear distinction between the model assets and the Gestura application
source code, which is not included in this repository.
Attribution statement:
text
1Based on FLUX.2 [klein] 4B by Black Forest Labs, licensed under the
2Apache License 2.0. This repository contains a converted LiteRT/TFLite
3Android runtime package associated with Gestura and is not an official
4Black Forest Labs Android release. Its text encoder uses the Qwen3-4B
5architecture and tokenizer assets by Qwen/Alibaba Cloud as distributed inside
6the pinned FLUX upstream revision; no separate Qwen repository or revision was
7fetched for this public package. Gestura application source code is not included.