Fine-tuning a small, high-quality dataset can give image generation the control needed for specific layouts, attributes, and aspect ratios.
2
A production vision pipeline can improve image quality with an upscaling and image-to-image loop that restores details lost during generation.
3
Fusing LoRAs, compiling models, quantizing where possible, and batching or parallelizing pipeline stages can reduce latency and improve throughput.
Summary
Biswaroop Bhattacharjee explains how to move a constrained image-generation system from experimentation toward production. His example generates realistic planet images with fixed composition, configurable visual attributes, and an ultrawide 21:9 aspect ratio. He recommends building an ordered prompt strategy and curating a small dataset with enough variation, then fine-tuning a suitable model. For Stable Diffusion XL, he chooses dimensions close to the aspect ratios used during training. Image quality can be improved with a custom upscaling pipeline: upscale the image, resize it, run an image-to-image step to restore detail, then upscale and resize again. For serving, he recommends fusing LoRAs, compiling models, using quantized variants where possible, and applying micro-batching and model multiplexing. He is also direct that custom upscaling remains an open, creative area with no single correct workflow.
Production generation needs explicit visual constraints
Bhattacharjee frames the problem as generating millions of realistic planet images while enforcing composition and style rules. The planet must stay within a defined region, leave space at the sides and top, and use a 21:9 ultrawide aspect ratio. Other attributes need to remain controllable, including planet colour, moons, rings, nebulae, sky, and atmosphere. A plain text-to-image prompt does not provide enough consistency or control for this use case.
A small, well-curated dataset can support fine-tuning
He proposes an ordered prompt creation strategy rather than random descriptions. Prompts can begin with the planet colour, then describe atmospheric features, moons, and the surrounding sky. The team can create a small, high-quality image set with tools such as Photoshop or Midjourney, as long as it covers useful variation in the attributes that the prompts will control. The model choice depends partly on the available GPU resources.
Model dimensions should stay close to the training aspect ratios
The fine-tuned results follow the desired planet shape and composition more closely than the untuned outputs. For the 21:9 target, Bhattacharjee uses Stable Diffusion XL and chooses dimensions of 1536 by 640. He explains that this is close to an aspect ratio used in Stable Diffusion XL training, which he expects to produce higher-quality output than choosing an unrelated size.
An upscaling loop can restore details after generation
Bhattacharjee describes a custom upscaling pattern for adding missing detail. The pipeline first upscales the generated image, resizes it to the required size, and passes it through an image-to-image pipeline. It then upscales and resizes the result again. In his examples, this produces more defined magma rings and a more distinct nebula than a normal, smudged-looking upscale. He points to Comfy workflows as a public source of related approaches.
Inference optimisations should target the whole pipeline
For parameter-efficient fine-tuning, he recommends fusing LoRAs into the model when possible because this can improve latency. He also recommends using compilation and quantized models where they work for the chosen setup. Stable Fast packages several of these optimisations, especially for Hugging Face Diffusers, although Bhattacharjee notes that there are caveats and that other integrations may require additional work.
Batching and multiplexing can improve service throughput
Bhattacharjee describes Ray as a serving framework that can provide micro-batching and multiple-model multiplexing. These capabilities matter because a deployed vision service usually contains a pipeline rather than one isolated model. He argues that stages should be parallelized and batched wherever possible, since the pipeline has more opportunities for throughput and latency improvements than a single-model endpoint.
His closing advice is to focus on the quality of both images and prompts even when the dataset is small. He recommends taking the available low-effort performance improvements, then optimizing the complete pipeline rather than stopping at model inference. Custom upscaling deserves experimentation because it can materially change the visual result. Prem AI also announced a grant program offering free fine-tuning jobs, model deployments, and ad hoc machine learning support.