liveBook · Manning

Prompt-completion paradigm

As explained in Building Reliable AI Systems

A fine-tuning data pattern in which each example pairs an input prompt with an expected output completion.

A prompt-completion pair is one fine-tuning example: the prompt supplies an input, and the completion supplies the expected output. A user question can map to an expert answer; an empty prompt can instead pair with domain text for generation. section 5.3.1

Prepare pairs that reflect the behavior needed in production. Include recurring questions often enough to teach their pattern, but cover different problem types. Put necessary context and role labels in the prompt, and make each completion demonstrate the intended answer. section 5.3.1

{"prompt": "User: How do I file an eviction notice in California?\nAI:", "completion": " If you are a landlord in California seeking to file an eviction, you must first...<detailed legal answer>..."}

A JSONL-style record pairs a role-labeled user question with its intended answer; each line of a fine-tuning file is a separate JSON object. section 5.3.1

Keep each pair within the model’s context limit, preferably well below it. Follow the chosen platform’s formatting requirements, including a leading completion space or an end-of-answer marker when required. The learned format makes responses more predictable; it does not by itself establish that an answer is correct. section 5.3.1

How Building Reliable AI Systems covers it

How deep it goes
Explains pair construction and formatting constraints, but does not detail the training algorithm.
Examples
Shows a role-labeled legal question paired with a detailed answer and sketches a customer-support resolution pair.
What it assumes
Assumes raw or annotated data and explains how to format it for fine-tuning.
What you can do after
Apply it via OpenAI-style JSONL preparation to assemble prompt-completion examples within context limits.
How it connects
Connects fine-tuning, JSONL, role indicators, stop sequences, and context limits.

This explainer was generated by Manning's knowledge graph from the text of Building Reliable AI Systems. The section links point to the parts of the book it draws on.