Executive Overview
In the fast-evolving landscape of generative artificial intelligence, the spotlight almost always falls on towering parameter counts, breakthrough architectural topologies, and the breathtaking fidelity of output generations. Yet, behind every state-of-the-art text-to-image model lies an unheralded, gritty foundation: the data pipeline.
As part of the ongoing technical series detailing the creation of PRX—a state-of-the-art 7-billion-parameter text-to-image foundation model developed by Photoroom—engineers have pulled back the curtain on Part 4: the data ingestion, curation, and streaming infrastructure. While previous installments dissected model architectures, training design, and a high-octane 24-hour speedrun, this chapter focuses squarely on the information diet that shaped PRX’s understanding of the visual world.
Building an effective pre-training corpus for a 7B model is rarely about per-image perfection; it is an exercise in scale, diversity, and pragmatic engineering. The Photoroom team assembled a massive corpus by fusing public and internal datasets, re-captioning billions of images using advanced Vision-Language Models (VLMs), and engineering a dual-format data architecture. By balancing the exploratory flexibility of the Lance columnar format with the ultra-fast streaming capabilities of Mosaic Data Shards (MDS), the team established a blueprint for modern visual dataset curation.

This report dives deep into the architectural decisions, hard-learned lessons, and empirical metrics that defined the PRX data engine.
Detailed Chronology of the PRX Data Pipeline
The journey from raw, uncurated data dumps to a streamable, high-performance training corpus involved a meticulously choreographed multi-step pipeline. The engineering lifecycle of the PRX dataset can be broken down into six sequential, highly optimized phases.
Phase 1: Ingestion and Storage in Lance
Raw data arrived from a disparate array of sources, bringing varying metadata schemas, resolutions, and baseline formats. To interactively query, filter, and profile hundreds of millions of rows, the team rejected traditional static table formats in favor of Lance, an open-source columnar data format built for AI. Using Ray Data, the team executed parallelized data ingestion across a distributed cluster, fragmenting the massive tables for rapid access.

However, the team learned fragment management the hard way. Early ingestion targets of 100,000 rows per fragment resulted in thousands of tiny, fragmented files, causing simple filter and full-text queries to crawl. By compacting the tables up to roughly a million rows per fragment—reducing the fragment count significantly—query speeds soared, proving that fragment hygiene is critical when managing massive vector-search enabled datasets.
Phase 2: Exploratory Profiling and Resolution Bucketing
Once queryable inside Lance, the data underwent rigorous profiling. The team established strict resolution cutoffs: any image falling below a 384²-pixel floor or possessing an aspect ratio outside the [0.5, 2.0] range was discarded.
To maintain spatial integrity without wasting compute on padding or distorting portraits and landscapes through arbitrary square cropping, the team deployed aspect-ratio bucketing. Images were sorted into resolution tiers (512px, 1024px, and high-res 2048px/4096px variants) and snapped to 13 predefined patch-aligned shapes. This kept the token budget roughly constant at ~256 patches per image, ensuring flat per-image compute costs across diverse aspect ratios.

Phase 3: VLM-Driven Dense Re-Captioning
Rather than trusting the erratic, sparse captions shipped with various public and private datasets, Photoroom made the bold decision to re-caption every single image from scratch. Using a rigorous system prompt, they commanded a Vision-Language Model to output a single, flowing paragraph (100–200 words) describing only what was visually present: subjects, materials, lighting, spatial relationships, and exact transcriptions of visible text.
Through rigorous ablation studies, the team proved that long, densely detailed VLM captions dramatically outperform short, simplistic tags. A diffusion model trained on rich captions achieved vastly superior perceptual metrics compared to baseline models trained on brief annotations. Ultimately, Qwen3-VL-8B was selected as the engine’s workhorse captioner, delivering a blistering 20 images per second per H200 GPU while generating rich, visually grounded prose.
Phase 4: Data Filtering via Text-Only Classification
Rather than deploying heavy, expensive pixel-level classifiers to scrub out text-heavy artifacts (such as screenshots, documents, and infographics) or NSFW content, the team engineered a remarkably cost-effective alternative. They passed the rich VLM-generated captions—never the raw pixels—through a text-only instance of Qwen3-8B.

Answering a simple heuristic—"Would you look at this image, or read it?"—the model successfully flagged and categorized text-heavy and inappropriate samples at a rate of 200 captions per second per GPU.
Phase 5: Non-Destructive Filtering via Skip Lists
To handle the items flagged by the text classifier and deduplication sweeps, the engineering team avoided the computationally wasteful trap of rewriting terabytes of stored dataset files. Instead, they implemented a lightweight skip-list sidecar mechanism within the data loader.
A small metadata file per shard specifies sample indices to bypass at training time. This non-destructive architecture enabled instant filtering, easy ablation testing, and streamlined compliance for user opt-outs, all without modifying the underlying storage shards.

Phase 6: Compression and Conversion to Mosaic Data Shards (MDS)
For the final leg of the journey, the cleaned, bucketed, and captioned data was packed into ~128MB Mosaic Data Shards (MDS). Paired with Mosaic Composer, MDS enabled seamless, distributed streaming directly from object storage or shared local filesystems to the training nodes, completing the loop from raw multi-source chaos to a high-performance training stream.
Supporting Context & Metrics
The development of the PRX data pipeline was guided by empirical testing rather than unverified assumptions. The engineering team published granular metrics validating key decisions regarding image encoding, captioning models, and downstream generative quality.
The JPEG vs. PNG Encoding Debate
A common anxiety in generative model training is whether lossy image compression introduces cumulative artifacts that degrade model outputs. The Photoroom team tested whether storing images as high-quality JPEGs (Quality 92) versus lossless PNGs affected final model performance.

Evaluating PSNR (Peak Signal-to-Noise Ratio) and LPIPS (Learned Perceptual Image Patch Similarity) across multiple decode/encode cycles revealed that the first re-encode at Quality 92 is virtually imperceptible to the human eye, with subsequent cycles plateauing rapidly.
| Image Resolution | PSNR after 1× (dB) ↑ | LPIPS after 1× ↓ | PSNR after 10× (dB) ↑ | LPIPS after 10× ↓ |
|---|---|---|---|---|
| 1–2 MP | 48.7 | 0.004 | 45.4 | 0.008 |
| 0.25–0.5 MP | 45.1 | 0.005 | 42.2 | 0.010 |
Furthermore, when two identical PRX models were trained on 1024px images stored respectively as PNGs and JPEGs (Quality 92), their generative outputs were indistinguishable. Quantization analysis showed matching detection rates (~11–12%), proving that high-quality JPEG storage imposes no measurable penalty on large-scale text-to-image pre-training.
Captioner Performance Metrics
To determine which VLM produced the optimal training signal, the team evaluated multiple captioning candidates by training a small diffusion model for 100,000 steps on each dataset variant and scoring the generations using Fréchet Inception Distance (FID), CLIP Maximum Mean Discrepancy (CMMD), and DINO-MMD (lower scores indicate superior quality).

| Captioner Variant | FID ↓ | CMMD ↓ | DINO-MMD ↓ |
|---|---|---|---|
| Qwen2.5-VL-7B-Captioner-Relaxed | 13.95 | 0.306 | 0.185 |
| Qwen3-VL-8B (Photoroom Pick) | 10.98 | 0.351 | 0.182 |
| Qwen3.5-9B | 10.51 | 0.278 | 0.162 |
| Qwen2.5-VL-7B (Reference) | 15.86 | 0.393 | 0.285 |
| Gemini 1.5 Flash (Reference) | 13.46 | 0.316 | 0.234 |
While Qwen3.5-9B achieved the absolute best raw metrics, its slower throughput (~6.5 images/sec) and unstable dependency requirements at the time led Photoroom to select Qwen3-VL-8B, which struck an ideal balance of lightning-fast inference (20 images/sec on an H200) and top-tier generative alignment.
Official Statements and Architectural Philosophy
Photoroom’s engineering disclosures emphasize a pragmatic, results-oriented philosophy regarding pre-training data. Several core tenets guided their decision-making process:
- Pre-training is for Breadth; Fine-Tuning is for Taste: "Over-filtering for aesthetics at this stage would actually hurt, narrowing the distribution and costing the model concepts and compositional variety it cannot recover later. Making generations look polished is a separate, later concern, which we leave to fine-tuning and preference alignment on small, ruthlessly curated sets."
- The Power of Faithful Captioning: "If captioning is faithful, we don’t need to worry about the occasional screenshot, advertisement, logo, or bit of text in an image, because those things get described in the caption too, so the model learns them as conditioned, controllable attributes rather than reproducing them unconditionally."
- Format Synergy: Summarizing the interplay between their data tools, the team noted: "Lance to build, MDS to stream." Lance provides the heavy-lift columnar capabilities, vector indexing, and predicate pushdown required for massive dataset exploration, while Mosaic Data Shards provide the lightweight, low-maintenance streaming mechanics required for distributed GPU training loops.
Future Outlook & Community Impact
With the pre-training corpus successfully established and the PRX-7B model brought to life, Photoroom is already looking toward the next frontier of generative AI research.

While pre-training demands raw volume and broad world coverage, the upcoming phases of model refinement—Supervised Fine-Tuning (SFT) and preference alignment—flip the paradigm entirely. In these phases, quality reigns supreme over quantity. The engineering team is actively constructing advanced curation tooling, including richer explorers powered by structured VLM attribute-tagging, designed to isolate high-signal subsets from the vast pre-training corpus.
For developers, researchers, and AI practitioners eager to inspect the work, the PRX project is fully open-source under the Apache 2.0 license. The model code is available on the official Photoroom GitHub repository, integrated natively into the Hugging Face diffusers library, and accessible via the interactive PRX Pixel Hugging Face Space for live experimentation. As the community continues to dissect the mechanics of modern visual foundation models, transparency initiatives like the PRX data pipeline series offer an invaluable roadmap for building efficient, high-performance AI systems from the ground up.
