CONCEPT Cited by 2 sources
Few-shot prompt template¶
Definition¶
A few-shot prompt template is a reusable prompt structure that bundles:
- A template prompt with placeholder slots for per-request content, and
- A small number ("few") of exemplar outputs — literal demonstrations of the desired output shape — that the template injects into the prompt as the model sees it.
The model is shown "here are examples of good outputs; now produce one for this new input" — the few-shot demonstrations do the work of defining style, tone, length, structure, and constraint semantics without requiring elaborate natural- language instruction.
Image-generation application¶
For image generation specifically, few-shot templates encode style characteristics: lighting, background, framing, camera angle, composition — by showing the image-generation model example images that exhibit the target style.
From Instacart PIXEL:
"Prompt templates define characteristics about lighting, backgrounds, and the image context are injected as few shot examples for each application." "Here are example images with the original prompt and the new prompt which was rewritten using our few shot prompting technique for the final image. The rewritten prompt adds focus to the overall style and presentation of the picture."
(Source: sources/2025-07-17-instacart-introducing-pixel-instacarts-unified-image-generation-platform)
Why templates + few-shot beat per-caller prompt engineering¶
- Non-expert users get working defaults. Anyone at the company can pick a template and generate usable output without understanding prompt engineering.
- Style consistency at org scale. All images generated for a given application share the template's style characteristics — no per-team drift.
- Iteration is centralised. When a better template lands, all callers pick it up at once rather than each caller needing to update their own prompt.
- Templates compose with model-swap portability. A template is a text + exemplar bundle — it is portable across models as long as the parameter protocol handles the image-conditioning plumbing.
Templates vs. instructions vs. constraints¶
Templates are defaults with editable overrides — not hard-coded. PIXEL explicitly allows teams to override defaults: "strong defaults for prompts for both generating and evaluating images with the added ability for teams to modify those defaults as needed." This is what separates [[concepts/self-serve- generative-ai|self-serve]] prompt templates from organisationally-enforced prompt constraints.
See also patterns/instruction-library-prompt-composition — a more constrained, risk-calibrated sibling pattern where a library of single-line instruction bullets is maintained + an optimiser selects/composes bullets rather than rewriting the whole prompt.
Seen in¶
-
sources/2025-07-17-instacart-introducing-pixel-instacarts-unified-image-generation-platform — canonical wiki instance at the image-generation layer. PIXEL ships per-application templates with few-shot exemplars that inject lighting / background / composition defaults. Teams retain edit access to modify defaults per project.
-
sources/2025-08-01-instacart-scaling-catalog-attribute-extraction-with-multi-modal-llms — structured-extraction application. Instacart PARSE exposes few-shot examples as a first-class configuration field in its Platform UI — teams add exemplars per attribute "to help LLM follow the instructions in the prompt". Same defaults-with-overrides shape (per-attribute template + per-attribute exemplars + versioned config) applied to structured output rather than images.
Related¶
- concepts/self-serve-generative-ai — the UX shape few-shot templates enable
- concepts/model-agnostic-ml-platform — the platform stance the template library lives inside
- patterns/prompt-template-library — the defaults-with-editable-overrides pattern
- patterns/instruction-library-prompt-composition — constrained sibling pattern (DSPy-era)
- systems/instacart-pixel — canonical production instance
- systems/instacart-parse — structured-extraction sibling; few-shot-examples are a per-attribute config field
- companies/instacart