Large Model Training Data Infrastructure: A Five-Layer Reference Architecture
As high-quality public text becomes saturated, training data is shifting from a byproduct of business systems to a core production line. This article explains why public corpora are running dry and proposes a five-layer reference architecture for training data infrastructure, covering ingestion, cleaning, quality and deduplication, mixing and scheduling, and evaluation feedback. It includes a minimal Python processing skeleton, guidance on data mixing and curriculum training, a three-tier evaluation loop, compliance and cost considerations, and a phased rollout roadmap.
1. The Shift: Data Goes From a Byproduct to a Main Production Line
Over the past two years, the industry’s view of data has quietly but fundamentally changed. Early model development often treated data as exhaust from business systems: search click logs, recommendation impression records, archived customer service conversations. A quick cleanup was usually enough to make it usable. But as high-quality text that can be crawled from the public internet approaches saturation, this easy path has quickly hit a ceiling.
One notable organizational signal is that several platforms have recently separated data leaders from engineering teams, creating specialized roles such as pre-training data, data ecosystem, evaluation data, and embodied data. At the same time, valuations of external specialist data providers are rising fast. Frequent internal reorganizations and surging external valuations point to the same thing: scarcity is shifting from the quantity of data to verifiable quality and compliant sources.
For developers, this changes the required capability model. Competition used to center on training frameworks and compute scheduling. Now it also requires an auditable, reproducible, and continuously replenished data pipeline.
2. Why Public Corpora Are Running Dry
The supply contraction can be understood across four dimensions:
- The high-quality range is consumed first. Web-scale text keeps growing, but the share that is clearly structured, factually dense, and free of obvious noise is very small. The effective tokens usable for training are far fewer than the raw crawl volume.
- Noise and contamination are rising together. Large volumes of machine-generated content flow back into the public web, creating a cycle of factual errors and stylistic homogenization. Filtering by length or keywords alone is no longer enough to ensure quality.
- Compliance boundaries are tightening. Personal information, copyrighted content, robots protocols, and the scope of authorization can turn data that is technically crawlable into data that is unusable in engineering practice.
- Timeliness decays. World knowledge changes over time, and static snapshots cannot cover newly emerging entities, interfaces, and specifications. An incremental replenishment mechanism is required.
3. Treating Data as Infrastructure: A Five-Layer Reference Architecture
Split the training data system into five layers, each with clear inputs, outputs, and acceptance criteria.
- Ingestion and access layer: Unify sources and record source identifiers, authorization scope, crawl time, and content hashes so that any training sample can be traced back.
- Cleaning and governance layer: Unify encoding, extract main text, identify language, strip templates and ads, and redact sensitive information.
- Quality and deduplication layer: Combine rule-based filtering, model scoring, and multi-granularity deduplication to output data versions with quality scores.
- Mixing and scheduling layer: Set sampling weights by domain, language, time, and task type, supporting curriculum-style training and stage transitions.
- Evaluation and feedback layer: Use fixed evaluation sets and online feedback to locate data gaps, then feed the conclusions back as collection requirements for the next round.
The key design principle across these five layers is versioning. Data, code, and configuration together determine a training result. Experiments become reproducible only when data also has an immutable version number.
4. Engineering Implementation: From Raw Text to Trainable Samples
The following illustrative code shows a minimal processing skeleton. The focus is on structure and auditability, not implementation details.
from dataclasses import dataclass, asdictimport hashlib, re, json@dataclassclass Doc:source: str # Source identifier, without identifiable third-party nameslicense_scope: str # Authorization scope: public / licensed / internallang: strtext: strquality: float = 0.0def normalize(doc: Doc) -> Doc:doc.text = doc.text.replace(" ", " ")doc.text = re.sub(r"\n{3,}", "\n\n", doc.text)doc.text = re.sub(r"[ \t]{2,}", " ", doc.text).strip()return docdef fingerprint(doc: Doc) -> str:h = hashlib.sha256()h.update(doc.text.encode("utf-8"))return h.hexdigest()def pipeline(raw_docs):seen, out = set(), []for d in raw_docs:if d.license_scope not in {"public", "licensed", "internal"}:continue # Compliance gate: discard unknown sourcesd = normalize(d)fp = fingerprint(d)if fp in seen:continue # Exact deduplicationseen.add(fp)d.quality = rule_score(d) # Rule scoring: length, symbol ratio, repeated linesif d.quality < 0.35:continueout.append({**asdict(d), "fp": fp})return out
Three additional engineering practices are needed. First, move deduplication from the file level down to the paragraph level, using approximate hashing (such as locality-sensitive hashing ideas) to identify rewrites and reposts. Second, make the quality scoring model and rules replaceable plugins so that one round of tuning does not affect the entire dataset. Third, write all intermediate artifacts to object storage and retain manifest files for auditing and rollback.
5. Mixing and Curriculum: Different Capabilities From the Same Data
With the same total data volume, different mixing produces clearly different model capability structures. In practice, sampling is usually controlled across four dimensions:
- Domain: general text, code, math and reasoning, multiple languages, and industry documents.
- Time: weight recent content to ensure coverage of timely knowledge.
- Length: long documents support long-context capability, while short text maintains language fluency.
- Task: the proportion of instruction and dialogue samples determines usability, but too high a proportion squeezes out core language capability.
Curriculum training follows a broad-to-specialized approach. Early stages use high-coverage, low-difficulty corpora to build a foundation of language and common sense. The middle stage increases the proportion of reasoning and code. The later stage uses high-quality instruction data to shape capabilities. Every stage transition should record the data version and weight configuration.
6. The Evaluation Loop: Data Gaps Are Found Through Measurement
Without evaluation, data work degrades into endless cleaning. Build a three-tier evaluation system:
- Data-layer metrics: deduplication rate, language distribution, quality score distribution, and source concentration, used to detect structural bias.
- Model-layer metrics: performance on fixed benchmark sets for language, reasoning, code, and long text, used to compare different data versions.
- Online-layer metrics: task success rate, human adoption rate, and complaint and correction rates, used to validate real gains.
The key to the loop is attribution. When a capability declines, it should be possible to trace it to a specific data slice rather than simply increasing the total volume. Maintain a mapping table between data slices and metrics, and change only a few variables at a time.
7. Compliance and Cost: Two Budgets You Cannot Skip
For compliance, the minimum requirements are provable sources, verifiable authorization, removable sensitive information, and executable deletion requests. Carry the authorization scope as a field that travels with each sample so that any downstream task can automatically filter by scope.
For cost, the compute overhead of data pipelines is often underestimated. Three approaches can help: use tiered storage to move cold data to infrequently accessed tiers; materialize repeated computation results as intermediate datasets; and use message queues and container platforms for elastic batch processing that scales automatically with queue depth, combined with logging services and monitoring alerts to locate long-tail tasks. In these scenarios, Baidu AI Cloud typically relies on combinations of general categories such as object storage, container platforms, and logging and monitoring. Specific choices should be decided after load testing against your own scale.
8. Implementation Roadmap
- Phase 1 (2–4 weeks): Unify access and metadata standards, and establish data version numbers and manifests.
- Phase 2 (1–2 months): Apply rule-based cleaning plus exact and approximate deduplication to produce the first trainable dataset.
- Phase 3 (2–3 months): Introduce quality scoring models and mixing experiments, and establish an evaluation baseline.
- Phase 4 (ongoing): Make incremental replenishment and compliance auditing routine, and review data ROI quarterly.
Conclusion
The essence of data infrastructure is turning text that happened to be available into a production factor that can be designed, verified, and reused. As the dividend from public corpora fades, team differentiation will come from the engineering maturity of data governance: whether sources are auditable, whether quality is measurable, whether mixing is explainable, and whether gaps can be located. Doing these four things well is what truly puts the ceiling of model capability in your own hands.
