0
0
Prompt Engineering / GenAIml~12 mins

Instruction formatting in Prompt Engineering / GenAI - Model Pipeline Trace

Choose your learning style9 modes available
Model Pipeline - Instruction formatting

This pipeline shows how instructions are formatted and processed in a generative AI system. It starts with raw text input, formats it for the model, runs the model to generate output, and then formats the output for the user.

Data Flow - 4 Stages
1Raw Input
1 instruction stringReceive user instruction as plain text1 instruction string
"Write a short poem about spring."
2Instruction Formatting
1 instruction stringAdd special tokens and structure to prepare for model input1 formatted instruction string
"<INSTR> Write a short poem about spring. <END>"
3Model Processing
1 formatted instruction stringRun the generative AI model to produce output text1 generated text string
"Spring whispers softly, blooms awake..."
4Output Formatting
1 generated text stringClean and format model output for user display1 user-ready text string
"Spring whispers softly, blooms awake..."
Training Trace - Epoch by Epoch
Loss
2.3 |****
1.8 |***
1.2 |**
0.8 |*
0.5 |
EpochLoss ↓Accuracy ↑Observation
12.30.15Initial training with high loss and low accuracy as model learns basic instruction patterns.
21.80.35Loss decreases and accuracy improves as model better understands instruction formatting.
31.20.55Model starts generating more coherent formatted instructions.
40.80.70Further improvement in formatting and output quality.
50.50.85Model converges with low loss and high accuracy on instruction formatting.
Prediction Trace - 4 Layers
Layer 1: Receive raw instruction
Layer 2: Instruction Formatting
Layer 3: Model Processing
Layer 4: Output Formatting
Model Quiz - 3 Questions
Test your understanding
What is the purpose of adding special tokens during instruction formatting?
ATo increase the length of the input text
BTo help the model recognize instruction boundaries
CTo confuse the model for better training
DTo remove punctuation from the instruction
Key Insight
Instruction formatting helps the model understand where instructions start and end, improving its ability to generate relevant and clear responses. Training shows steady improvement as the model learns these patterns, and proper output formatting ensures the user receives clean, readable results.