0
0
Prompt Engineering / GenAIml~12 mins

Model selection (GPT-4, GPT-3.5) in Prompt Engineering / GenAI - Model Pipeline Trace

Choose your learning style9 modes available
Model Pipeline - Model selection (GPT-4, GPT-3.5)

This pipeline compares two language models, GPT-4 and GPT-3.5, to select the best one for a text generation task. It processes input prompts, runs them through both models, evaluates outputs, and chooses the model with better performance.

Data Flow - 5 Stages
1Input prompt
1000 prompts x 1 text columnReceive user text prompts for generation1000 prompts x 1 text column
"Explain photosynthesis in simple terms."
2Preprocessing
1000 prompts x 1 text columnTokenize text into model-readable tokens1000 prompts x variable token length
"Explain photosynthesis" -> [101, 2345, 6789, ...]
3Model inference GPT-3.5
1000 prompts x variable token lengthGenerate text outputs using GPT-3.51000 prompts x generated text
"Photosynthesis is the process plants use to make food."
4Model inference GPT-4
1000 prompts x variable token lengthGenerate text outputs using GPT-41000 prompts x generated text
"Photosynthesis allows plants to convert sunlight into energy."
5Evaluation
1000 prompts x 2 generated textsScore outputs by relevance, correctness, and fluency1000 prompts x 1 best model label
"GPT-4" chosen for prompt 1, "GPT-3.5" for prompt 2
Training Trace - Epoch by Epoch
Loss
0.5 |****
0.4 |******
0.3 |********
0.2 |**********
0.1 |************
     1 2 3 4 5 Epochs
EpochLoss ↓Accuracy ↑Observation
10.450.7Initial training with moderate loss and accuracy
20.350.78Loss decreased, accuracy improved
30.280.83Model converging well with steady improvement
40.220.87Further loss reduction and accuracy gain
50.180.9Training nearing optimal performance
Prediction Trace - 4 Layers
Layer 1: Tokenization
Layer 2: GPT-3.5 inference
Layer 3: GPT-4 inference
Layer 4: Evaluation
Model Quiz - 3 Questions
Test your understanding
Which model showed better accuracy during training?
ABoth equal
BGPT-3.5
CGPT-4
DNot enough information
Key Insight
Model selection compares outputs from different models on the same input to pick the best one. Training metrics like loss and accuracy help understand model quality, while evaluation of generated text ensures the chosen model meets task needs.