liveBook · Manning

Grounding

As explained in Building LLM Applications with DSPy

A method of preparing a language model with substantial information about a task so its responses and instructions reflect that task.

Grounding prepares a prompt language model to generate task-specific instructions by giving it substantial information about the task. In MIPROv2, that information includes the module’s source code and a dataset description with training examples, helping candidate instructions reflect what the task model must do. section 6.2.1

MIPROv2 uses grounding as part of its instruction-generation step:

  • Summarize the dataset and source code; these summaries require language-model calls. section 6.2.1
  • Use the summaries to prompt for alternative instructions. Tips can guide summary and candidate-generation calls, and can be toggled with tip_aware_proposer. section 6.2.1
  • Evaluate candidate instructions efficiently: grounding aims to improve their quality when testing each candidate is costly. section 6.2.1
figure
The dataset reveals a strong focus on flight bookings, with users consistently seeking specific routes, departure times, and additional travel logistics such as fare details and airport information. This focus highlights significant demand for travel assistance applications that provide efficient booking processes along with comprehensive travel-planning insights. Overall, the observations suggest a user preference for quick, clear communications and tailored solutions that encompass the entire travel experience.

A generated dataset summary describes flight routes, departure times, fares, and other travel-planning needs, illustrating the task context available to the instruction proposer. section 6.2.1

How Building LLM Applications with DSPy covers it

How deep it goes
Describes task inputs and summary-then-generation steps, but does not specify how the summaries are constructed.
Examples
Uses flight-booking intent classification and a travel dataset summary mentioning routes, times, fares, and airport information.
What you can do after
Apply grounding through MIPROv2 to generate task-specific candidate instructions from source code and dataset summaries.
How it connects
Links MIPROv2 grounding with instruction optimization, few-shot demonstrations, BootstrapFewShot, COPRO, SIMBA, and GEPA.

Also explained in

Compare how 8 books explain grounding →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Building LLM Applications with DSPy. The section links point to the parts of the book it draws on.