Designing Data Processing for Grounding and Training
This lesson explains the pipelines that prepare data for grounding and for model training.
Learning outcomes
After completing this lesson, you will be able to:
- Describe the stages of a grounding pipeline.
- Explain design decisions that affect retrieval quality.
- Distinguish grounding pipelines from training pipelines.
Processing for grounding
Before content can ground an agent effectively, it passes through a pipeline. The typical stages are ingestion (collecting content from its sources), extraction (turning PDFs, scans and images into text and structure), cleaning (removing duplicates, boilerplate and obsolete versions), chunking (splitting documents into passages that fit the model's context and carry one idea each), enrichment (adding metadata such as product, region and effective date), embedding (converting chunks into vectors for semantic search) and indexing. Azure AI Search provides indexes that combine keyword and vector search (hybrid search) with semantic ranking, which usually gives the best retrieval quality.
For many Copilot Studio and Microsoft 365 Copilot scenarios, the platform performs these stages automatically: SharePoint content is indexed for Copilot, and Copilot Studio processes uploaded files. A custom pipeline is justified when content is large, complex or in unsupported formats, when retrieval quality must be tuned, or when a Foundry agent needs a custom index.
Design decisions in the pipeline
Several design decisions strongly influence answer quality.
- Chunk size and overlap: chunks that are too large dilute relevance; chunks that are too small lose context. Splitting on headings keeps passages coherent.
- Metadata for filtering: metadata lets the agent restrict search to the right product, region or date, which prevents answers from the wrong policy version.
- Security trimming: the index must carry permissions, so that search returns only passages the user may see.
- Refresh: the pipeline must run as often as content changes, with deletions propagated so that withdrawn documents disappear from answers.
- Personal data: detect and remove or mask personal data that the agent does not need, for example with Language PII detection.
Processing for model training and tuning
Data for training or fine-tuning a model needs a different pipeline. Examples must be collected, labelled consistently, cleaned of errors and personal data, and formatted in the structure the training method requires, such as prompt and response pairs for supervised fine-tuning or preferred and rejected responses for preference fine-tuning. The data is split into training, validation and test sets, and the test set is kept separate so that evaluation is honest. The following table contrasts the two pipelines.
| Aspect | Grounding pipeline | Training pipeline |
|---|---|---|
| Output | Searchable index of passages | Labelled examples in a training format |
| Refresh | Continuous, as content changes | Per training run, versioned |
| Quality focus | Accuracy, currency, permissions | Label consistency, representativeness, balance |
| Personal data | Trim by permission; mask what is not needed | Remove or anonymize before training |
Both pipelines need lineage: a record of which sources and versions were used, which supports troubleshooting, audits and the ALM process for data.
Grounding on product manuals
A machinery maker wants a Foundry agent to answer technicians' questions from 20,000 scanned product manuals in several languages. Manuals are revised regularly, and answers must come from the revision that matches the machine's serial number range. What should the data processing design include?
The pipeline ingests manuals from their repository, uses Document Intelligence to extract text and tables from the scans, and cleans out superseded revisions. It chunks by section heading, enriches each chunk with model, serial number range, language and revision, and embeds and indexes the chunks in Azure AI Search for hybrid search with semantic ranking. The agent filters on the machine's serial number range so that answers come from the correct revision, and the pipeline runs whenever a manual is revised, removing withdrawn versions from the index.
Why must a grounding pipeline propagate deletions?
Show answer
So that withdrawn or superseded documents disappear from the index and the agent stops quoting them.
Exam Tips
Remember for the exam
- Grounding pipelines ingest, extract, clean, chunk, enrich, embed and index content.
- Hybrid search with semantic ranking in Azure AI Search usually gives the best retrieval.
- Metadata filtering and security trimming keep answers relevant and permitted.
- Training data is labelled, cleaned, formatted, split and versioned with lineage.