Seven Weeks, 38 Models: A Complete Guide to AI Factory-Style Development

    This article breaks down how a small team delivered 38 models in seven weeks by treating model production as an industrialized workflow rather than a series of one-off experiments. It maps model development into seven standardized stations, shows how configuration-driven pipelines and hard quality gates keep batch output reliable, and explains how stable packaging contracts turn downloads into real integrations. You will also find common anti-patterns and a six-week rollout roadmap for building predictable model supply capacity.

    1. The Shift: From Artisanal Workshop to AI Factory

    Delivering dozens of models in a short cycle, accumulating tens of thousands of downloads, and being integrated into hundreds of open-source projects is not the result of a single algorithmic breakthrough. It is a victory of how production is organized. Framed as an engineering problem, it comes down to three things: how requirements are standardized, how production is automated, and how delivery is made reusable.

    In the traditional model, moving from an idea to a usable model involves a serial chain: data collection, labeling, training, evaluation, packaging, documentation, and release. A blockage in any one stage stretches the entire cycle. The factory-style approach breaks these stages into parallel workstations connected by unified contracts, so that “quantity” no longer consumes human effort linearly.

    The point of quantity is not the number itself but coverage. When the model portfolio is broad enough, integrators can select what they need instead of forcing one general-purpose model to fit every scenario. A combination of smaller models is also often easier to embed in an existing engineering stack than a single large model.

    2. Value Stream: Breaking Model Production into Seven Workstations

    1. Requirement intake and classification: Map vague requests to explicit task types (classification, extraction, detection, ranking, etc.) and define the input/output contract.
    2. Data engineering: Collect, clean, deduplicate, anonymize, and split data; freeze the data version to ensure reproducibility.
    3. Features and baseline: Run the simplest baseline first to confirm the task is learnable before investing in complex structures.
    4. Training and tuning: Drive experiments with configuration, recording random seeds, hyperparameters, and dependency versions.
    5. Evaluation and gating: Include offline metrics, robustness tests, latency, and resource usage.
    6. Packaging and documentation: Standardize directory structure, model cards, sample code, and license notes.
    7. Release and operations: Distribute with versioning, and feed download and integration feedback back into the requirement pool.

    The seven workstations are connected by “contracts”: upstream deliverables must satisfy the fields and formats agreed upon by downstream stages, or the pipeline fails immediately. This hard constraint is the key to keeping batch production from collapsing.

    3. Pipeline Architecture: Configuration as Production

    Factory-style development recommends “everything as configuration.” The directory can look like this:

    1. model-factory/
    2. ├── configs/ # one declarative config per model
    3. ├── data/ # data versions and split manifests
    4. ├── pipelines/ # data, training, evaluation, packaging stages
    5. ├── registry/ # model version index and checksums
    6. ├── artifacts/ # weights and dependency manifests
    7. └── reports/ # evaluation reports and gate results

    A minimal configuration example:

    1. name: prompt-injection-detector
    2. task: text_classification
    3. data:
    4. version: 2026-08-20
    5. split: {train: 0.8, valid: 0.1, test: 0.1}
    6. model:
    7. backbone: compact_encoder
    8. max_length: 512
    9. train:
    10. epochs: 5
    11. batch_size: 32
    12. seed: 42
    13. gate:
    14. min_f1: 0.90
    15. max_latency_ms: 80

    The benefit of configuration is auditability: any delivery can be traced back to its data version, hyperparameters, and gate conclusions, avoiding a black-box state where something “runs but cannot be explained.”

    4. Quality Gates: The Safety Valve for Batch Production

    The biggest risk of batch output is that “low-quality models get distributed at scale.” Four gates are recommended:

    • Correctness gate: Core metrics must not fall below the baseline, and confidence intervals must not overlap with the degradation range.
    • Robustness gate: Adversarial samples, boundary inputs, empty inputs, and overly long inputs must all have defined behavior.
    • Performance gate: Latency, memory, and throughput must meet targets within the target hardware tier.
    • Compliance gate: Data sources must be traceable, sensitive information must be anonymized, and licenses and declarations must be complete.

    Take prompt injection detection as an example. The goal is not to “guess the user’s intent” but to identify fragments in the input that attempt to override system instructions, leak context, or induce unauthorized operations. Evaluation should build a separate adversarial set covering instruction override, role spoofing, encoding obfuscation, and multilingual bypass, and should track the false positive rate. A high false positive rate will cause the business side to turn the protection off, so precision and recall must both have thresholds.

    5. Delivery and Reuse: Turning Downloads into Integrations

    A unified packaging standard significantly lowers integration costs:

    1. <model-name>/<version>/
    2. ├── model.* # weights
    3. ├── manifest.json # input/output contract, dependencies, checksum
    4. ├── model_card.md # use cases, limitations, evaluation conclusions
    5. └── examples/ # minimal runnable example

    manifest.json should specify field types, value ranges, and default values, for example:

    1. {
    2. "input": {"text": "string", "max_len": 512},
    3. "output": {"label": "enum[benign, injection]", "score": "float"},
    4. "runtime": {"framework": "generic", "version": ">=1.0"}
    5. }

    When the contract is stable, integrators can plug in without reading training details. A version index with checksums avoids “it runs on my machine” caused by dependency drift.

    6. Engineering Support: Running the Pipeline on General Cloud Capabilities

    On platforms such as Baidu AI Cloud, the whole system can be assembled from general-purpose capabilities: object storage holds data and artifacts, a container platform runs training and inference tasks, a message queue decouples workstations and smooths peaks, logging and monitoring provide observability, and key management handles credential custody. The key is environment consistency and least privilege: training and inference use the same image baseline, the pipeline assigns least privilege per workstation, and artifacts are written to a read-only bucket with versioning enabled.

    7. Common Anti-Patterns and Improvements

    • Chasing quantity without gates: The more you deliver, the heavier the maintenance debt. Build gates before expanding the portfolio.
    • Configuration scattered across scripts: Hard to reproduce; move to declarative configuration with a unified entry point.
    • Evaluation set from the same source as training data: Metrics look inflated; introduce an independent adversarial set and real traffic sampling.
    • Documentation lagging behind artifacts: Model cards and contracts should be mandatory pipeline outputs.
    • Ignoring the cost of false positives: Protection models must have acceptable thresholds agreed with the business side.

    8. Rollout Roadmap (Six-Week Reference)

    Week 1: unify contracts and directory structure. Week 2: connect data and baseline. Week 3: automate training and evaluation. Week 4: integrate gates and reports. Week 5: complete packaging and documentation. Week 6: run a canary release and collect integration feedback. At this pace, a small team can build a stable model supply capability within a quarter, turning “occasional inspiration” into “predictable capacity.”