Data Infrastructure for Model Training and AI Agents: Practices and Pipelines

    This article explains why data infrastructure sets the ceiling for model and agent capabilities, and how to build it. It covers the boundaries and construction priorities of four core data types—SFT, RLHF/preference, multimodal, and agent trajectory data—along with a layered pipeline from ingestion to versioning, three-tier quality evaluation, closed-loop improvement, and compliance and safety baselines. The goal is to turn data into a governed, measurable, and reusable engineering asset.

    1. Why Data Infrastructure Sets the Ceiling for Models and Agents

    In the engineering practice of generative models, chatbots, and machine learning training, differences in algorithm architecture are often not the only factor that determines results. Data quality, coverage, and flow efficiency directly determine whether a model can learn stable behavior patterns, and whether an agent can make reliable decisions in real environments. The industry generally groups these problems under “data infrastructure”: it is not just storage and labeling, but a continuous pipeline covering collection, cleaning, labeling, synthesis, version management, and evaluation feedback.

    Model training and agent construction place clearly different demands on data. Supervised fine-tuning (SFT) requires high-quality “instruction-response” pairs, emphasizing expression standards and task coverage; reinforcement learning from human feedback (RLHF) requires preference data, emphasizing relative quality judgments among multiple candidate responses to the same prompt; multimodal training data requires images, text, audio, and video to be aligned in time and semantics; agent data additionally includes tool-call trajectories, environment states, and execution results. If one coarse process is used for all types, problems such as inconsistent labeling standards, sample leakage, and distorted evaluation often appear.

    Therefore, a reasonable goal is to manage data as a versionable, traceable, and reproducible engineering asset, and to close the loop between training and evaluation.

    2. Capability Boundaries and Construction Priorities of Four Core Data Types

    2.1 SFT Data: Task Coverage and Expression Standards First

    The key to SFT data is not “piling up quantity,” but whether the task distribution is close to the target scenario. It is recommended to design in layers by task family—for example, information extraction, summarization and rewriting, code assistance, knowledge Q&A, multi-turn dialogue, and structured output—and to define clear field specifications and acceptance criteria for each category. Common fields can be abstracted as:

    1. {
    2. "task_type": "structured_output",
    3. "instruction": "Convert a user description into a fixed schema",
    4. "input": "Natural language context",
    5. "output": "Result that conforms to the schema",
    6. "meta": {"lang": "en", "difficulty": "medium"}
    7. }

    In engineering, focus should be placed on deduplication (near-duplicates amplify bias), sensitive information handling, and the proportion of “verifiable outputs” (for example, results that can be parsed into a fixed structure are more amenable to automated validation).

    2.2 RLHF/Preference Data: Making Relative Judgments Stable and Reusable

    The value of preference data comes from consistency. If annotators have inconsistent understandings of “helpful/harmless/honest,” the training signal will be swallowed by noise. In practice, pairwise comparison (A is better than B) or multi-level scoring is usually adopted, supported by labeling guidelines, example libraries, and cross-review mechanisms. It is recommended to retain context and refusal reasons for each preference sample, making it easier to later analyze why the model favors a certain style.

    It should be emphasized that preference data is not better in larger quantities. If the preference distribution is overly concentrated, the model may degrade into templated expression. A more robust approach is to introduce “hard sample pairs”: two responses that both look reasonable but differ subtly in factuality, instruction following, or safety.

    2.3 Multimodal Data: Alignment Quality Over Modality Stacking

    The most common failure point in multimodal training is “semantic misalignment.” For example, image-text descriptions that are inconsistent with image content, video clips whose timestamps are misaligned with text, or audio transcriptions with excessive noise. It is recommended to establish unified alignment specifications: define time granularity, labeling units, and missing-value handling, and set quality thresholds for each modality. For video and audio, structured segmentation can be done first, followed by semantic labeling, to reduce rework costs.

    2.4 Agent Data: Tool-Chain Trajectories and Environment Feedback Are Key

    The agent data layer usually contains three elements: state (environment observation), action (tool call and arguments), and result (return and side effects). High-quality agent data requires tool calls to be replayable, arguments to be verifiable, and failures to be attributable. A simplified trajectory structure is illustrated below:

    1. {
    2. "goal": "Query and summarize metrics",
    3. "steps": [
    4. {"obs": "Page state A", "action": "search", "args": {"q": "metric definition"}, "result": "Candidate list"},
    5. {"obs": "Candidate list", "action": "open", "args": {"id": 3}, "result": "Body text"}
    6. ],
    7. "final": "Structured summary"
    8. }

    On this basis, slicing analysis by tool, by task type, and by failure reason should be supported to provide a basis for policy optimization.

    3. Engineering the Data Pipeline: From Collection to Versioning

    A practical data infrastructure usually contains the following layers:

    • Ingestion layer: unify data formats and metadata, recording source, authorization scope, and collection time.
    • Processing layer: cleaning, deduplication, desensitization, format validation, and quality scoring.
    • Labeling layer: task distribution, labeling guidelines, cross-review, and dispute arbitration.
    • Synthesis layer: generate supplementary samples when real data is insufficient, but factuality and consistency checks must be set.
    • Version layer: dataset snapshots, change records, and traceable lineage to ensure experiment reproducibility.
    • Serving layer: standardized read interfaces and sampling strategies for training and evaluation.

    For cloud implementation, common category combinations can be adopted—for example, object storage for raw and snapshot data, message queues to decouple processing tasks, container platforms to host cleaning and labeling tasks, and logging services with monitoring and alerting to track pipeline health. In such scenarios, Baidu AI Cloud typically supports data flow and task scheduling with general cloud product capabilities, but the specific implementation should still be designed according to business scale and compliance requirements.

    4. Quality Evaluation and Closed Loop: Making Data Improvement Measurable

    Data work without evaluation easily falls into “it feels better.” It is recommended to establish three tiers of evaluation:

    1. Data-layer metrics: duplication rate, missing rate, labeling consistency, and desensitization coverage.
    2. Model-layer metrics: task accuracy, instruction-following rate, refusal appropriateness, and preference win rate.
    3. Agent-layer metrics: task completion rate, tool-call success rate, average number of steps, and failure attribution distribution.

    The key to the closed loop is feeding online failure samples back into the data layer, forming a cycle of “failure clustering—sample completion—retraining—regression evaluation.” This both controls regression risk and continuously improves coverage.

    5. Compliance and Safety: A Non-Negotiable Baseline for Data Infrastructure

    Training data often involves personal information and business-sensitive content. In engineering, desensitization and access control should be enabled by default, authorization and deletion paths should be retained, and synthetic data should be labeled with its source. For agent data, attention should also be paid to least-privilege tool permissions and controllable side effects, to avoid triggering irreversible operations during replay or training.

    In summary, data infrastructure for model training and agent construction is essentially about turning “data” into a governed, measurable, and reusable engineering asset. Only by establishing standards for the four data types—SFT, preference data, multimodal, and agent trajectories—and continuously iterating through versioning and evaluation closed loops can generative models and chatbots remain stable and reliable in real business scenarios.