Fine-Tuning Platform Architecture: The Missing Middle Layer Between Training and Inference

    This article explains why fine-tuning is a systems engineering problem rather than an algorithm problem, and how a standardized middle layer connects data, training, evaluation, serving, and governance into a repeatable, observable, and portable pipeline. It covers versioning datasets as first-class assets, consolidating configuration and scheduling on the training side, splitting evaluation into pre-training, in-training, and post-training stages, exposing a unified inference interface, and reducing migration and compute costs through adapter layers and reusable infrastructure. A staged adoption roadmap is included.

    1. The Problem: Fine-Tuning Is Systems Engineering, Not an Algorithm Problem

    Industry narratives often compress fine-tuning into three steps: prepare data, tune a few parameters, run one training job. Real projects get stuck somewhere else entirely:

    • Dataset versions and training runs do not line up.
    • Failed training jobs cannot be reproduced.
    • No feedback is visible mid-run, so evaluation only happens after everything finishes.
    • Training artifacts are hard to expose as a live service.
    • Switching model families or training frameworks means rewriting nearly the entire configuration.
    • GPUs sit idle or wait in a queue for long stretches, inflating costs.

    Abstract these symptoms and they point to a single gap: there is no standardized middle layer between the ability to train a model and the ability to use one. The goal of this layer is not to train a stronger model. It is to chain data, training, evaluation, serving, and governance into a pipeline that is repeatable, observable, and portable. The five layers below form the minimum complete set.

    2. Data Layer: Make Samples Versioned Assets

    Data sets the ceiling on fine-tuning quality, yet most teams still manage data as “one directory plus a handful of files.” Treat data as a first-class asset and add at least three capabilities.

    1. Versioning: bind every training run to an immutable dataset version number and record that version in the training configuration, so results stay reproducible.
    2. Validation and statistics: before ingestion, run format checks, length distribution statistics, duplicate and near-duplicate detection, and label distribution checks, so dirty samples do not dilute the training signal.
    3. Minimal sample design: for capability-injection tasks (for example, teaching a vision-language model to recognize newly appearing categories), massive sample counts are often unnecessary. A small set of high-quality samples covering the key discriminative features can produce a clear effect.

    Illustrative sample organization (kept in a generic format, not tied to any specific tool):

    1. {
    2. "dataset_version": "2024-xx-xx.1",
    3. "samples": [
    4. {
    5. "id": "s-0001",
    6. "image_ref": "object://bucket/new-species/001.png",
    7. "instruction": "Identify whether the organism in the image is a newly recorded species and provide the discriminative basis",
    8. "output": {"label": "candidate_new_species", "evidence": ["serrated leaf margin", "umbel inflorescence"]}
    9. }
    10. ]
    11. }

    3. Training Layer: Consolidate Tuning, Scheduling, and Monitoring

    The pain point in training is fragmentation: parameters live in scripts, scheduling lives in the command line, and monitoring lives on another screen. The key to platformizing this stage is declarative configuration + unified scheduling + real-time metrics.

    • Declarative configuration: one config file describes the model, dataset version, hyperparameters, resource spec, and parallelism strategy, which prevents script drift.
    • Unified scheduling: the scheduler owns queuing, priority, timeouts, and retry on failure; developers only submit configuration.
    • In-process observability: metrics such as loss curves, learning rate, gradient norm, and GPU memory usage are reported in real time to the logging and alerting stack, and anomalies trigger automatic pauses to cut wasted compute.
    1. job:
    2. base_model: "vision-language-base"
    3. dataset: "2024-xx-xx.1"
    4. resources: {accelerator: "gpu", count: 8}
    5. parallel: {strategy: "sharded_data", degree: 8}
    6. hyperparams: {lr: 1.0e-5, epochs: 3, batch_size: 16}
    7. observability: {metrics_sink: "log-service", alert_on: ["loss_nan", "oom"]}

    4. Evaluation Layer: Fix the “Evaluate Only After Training” Defect

    “Evaluate after training” means the feedback loop is measured in hours or even days. The fix is to split evaluation into three stages:

    1. Pre-training baseline: run the same evaluation set on the base model first to get a reference score, so existing model capability is not mistaken for a fine-tuning gain.
    2. Sampled evaluation during training: evaluate on a small held-out set every fixed number of steps and output trend curves; terminate early if metrics keep degrading.
    3. Post-training systematic evaluation: cover accuracy, format compliance, refusal and safety behavior, and long-text stability, producing a comparable report.

    The evaluation set itself must also be versioned. Together with the dataset version and training configuration, it forms a complete snapshot of one experiment. Only then can you answer how much better the deployed model actually is compared with a specific prior version.

    5. Serving Layer: One Inference Interface, Training Artifacts Ready to Use

    Training artifacts are hard to ship usually because the output format of the training framework does not match the online serving protocol. The middle layer should provide a unified inference abstraction: one calling protocol works across different base models and different fine-tuned artifacts, while the serving side handles batching, concurrency control, timeouts, and fallback. Illustrative call:

    1. resp = client.chat(
    2. model="finetuned-vlm@2024-xx-xx.1",
    3. messages=[{"role": "user", "content": "Determine whether this sample is a newly recorded species"}],
    4. image_refs=["object://bucket/new-species/001.png"],
    5. temperature=0.2,
    6. )

    Combined with a container platform and object storage, model artifacts, images, and sample references can form a consistent release unit, which also makes canary rollout and rollback controllable.

    6. Migration and Cost: The Middle Layer Compounds Through Reuse

    High migration cost across models and frameworks comes from hardcoding model-specific knowledge into business code. If the middle layer confines those differences to an adapter layer, switching the base model requires only a configuration change. Costs benefit the same way: fine-grained resource quotas, task preemption and low-priority queues, and checkpoint resume all raise compute utilization substantially. General-purpose capabilities such as the container platform, object storage, logging service, and monitoring and alerting offered by Baidu AI Cloud can serve as the foundation for this kind of middle layer, while the implementation itself should stay interface-neutral and avoid tight coupling to any single framework.

    7. Suggested Adoption Roadmap

    1. Start with data and experiment versioning to solve reproducibility.
    2. Add in-training evaluation and alerting to shorten the feedback loop.
    3. Unify the inference protocol to connect the path to production.
    4. Finish with the adapter layer and scheduling optimization to lower migration and compute costs.

    Following this order turns fine-tuning from a craft practiced by a few teams into reusable engineering capability for most teams.