Skip to main content

Workshop 4: Training & Fine-Tuning

Duration: 60 minutes | Level: Intermediate | Prerequisites: Workshops 1-3

What You’ll Master

Transform your expert from generic to specialized by training it with your own data and knowledge.
1

Understanding Training

Learn the different types of training available
2

Document Upload

Add knowledge through documents and files
3

QA Pair Creation

Create question-answer pairs for precise training
4

Model Fine-Tuning

Fine-tune a base model with your data
5

Training Evaluation

Test and evaluate your training results

Types of Training

B-Bot offers multiple training approaches:
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    TRAINING METHODS                            β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”‚
β”‚   β”‚   Document   β”‚   β”‚     QA       β”‚   β”‚    Fine-     β”‚      β”‚
β”‚   β”‚   Retrieval  β”‚   β”‚    Pairs     β”‚   β”‚   Tuning     β”‚      β”‚
β”‚   β”‚   (RAG)      β”‚   β”‚              β”‚   β”‚              β”‚      β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β”‚
β”‚         β”‚                  β”‚                  β”‚               β”‚
β”‚         β–Ό                  β–Ό                  β–Ό               β”‚
β”‚   Add searchable     Exact Q&A          Train custom         β”‚
β”‚   knowledge base     matching           model weights        β”‚
β”‚                                                                β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Document Retrieval (RAG)

Best for: Large knowledge bases, manuals, documentationYour expert searches documents to find relevant information.

QA Pairs

Best for: Specific questions, exact answers, brand voiceDirect question-answer mappings for precise responses.

Fine-Tuning

Best for: Unique behavior, consistent style, specialized tasksTrain a custom model with your data.

Document Training (RAG)

How RAG Works

User Question: "What's the warranty on SmartHub?"
           β”‚
           β–Ό
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚ Vector Search   β”‚ ──► Finds relevant chunks
   β”‚ in Documents    β”‚     from your uploaded docs
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚
           β–Ό
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚  LLM Generates  β”‚ ──► Creates answer using
   β”‚  Response       β”‚     retrieved context
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚
           β–Ό
"The SmartHub has a 2-year warranty covering..."

Uploading Documents

  1. Navigate to Training in the sidebar
  2. Click Documents tab
  3. Click Upload Documents
Training Documents

Supported Formats

FormatBest ForNotes
PDFManuals, reportsExtracts text and structure
DOCXWord documentsPreserves formatting
TXTPlain textSimplest format
MDMarkdown docsGreat for technical docs
CSVStructured dataCreates searchable rows
JSONAPI docs, structuredMaintains hierarchy

🎯 Exercise: Document Upload

Create a simple product manual for training:
1

Create Document

Create a file called product_manual.md:
# SmartHub Pro User Manual

## Quick Start Guide

1. Plug in your SmartHub Pro
2. Wait for the blue LED to blink
3. Open the TechGadgets app
4. Follow the on-screen setup

## Troubleshooting

### Device won't connect
- Ensure WiFi is 2.4GHz
- Move closer to router
- Restart the device

### LED is red
- Check power connection
- Try different outlet
- Contact support if persists

## Warranty

Your SmartHub Pro includes a 2-year warranty 
covering manufacturing defects. Does not cover
physical damage or water exposure.
2

Upload to B-Bot

Upload this document to your TechSupport AI expert
3

Test Retrieval

Ask: β€œWhat should I do if the LED is red?”

Document Processing Options

How documents are split for search:
  • Paragraph: Best for structured documents
  • Sentence: Best for FAQs
  • Token-based: Best for long documents
How text is converted to vectors:
  • OpenAI ada-002: High quality, standard
  • Cohere: Good for multilingual
  • Local: Privacy-focused
How much context is shared between chunks:
  • Higher overlap = better context preservation
  • Lower overlap = faster search

QA Pair Training

When to Use QA Pairs

βœ… Great For

  • Brand-specific terminology
  • Exact pricing/policies
  • Consistent answers to common questions
  • Company voice and tone

⚠️ Less Effective For

  • Open-ended questions
  • Complex reasoning
  • Large knowledge bases
  • Frequently changing info

Creating QA Pairs

Navigate to Training β†’ QA Pairs: QA Pairs

🎯 Exercise: Create QA Pairs

Create these QA pairs for your TechSupport AI:
Question:
What are your support hours?
Answer:
Our support team is available Monday through Friday, 
9 AM to 6 PM EST. For urgent issues outside these hours,
please email [email protected] and we'll respond 
within 4 hours.

QA Pair Best Practices

Use questions as real users would ask them:
  • ❌ β€œProvide information about shipping policies”
  • βœ… β€œHow long does shipping take?”
Add multiple phrasings for the same question:
  • β€œWhat’s the warranty?”
  • β€œHow long is my product covered?”
  • β€œIs this under warranty?”
Provide full, helpful answers:
  • Include all relevant details
  • Add next steps or links
  • Use your brand voice

Fine-Tuning

What is Fine-Tuning?

Fine-tuning trains the model’s neural network weights with your data, creating a specialized version of the base model.
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    FINE-TUNING PROCESS                   β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                         β”‚
β”‚   Base Model (GPT-4o-mini)                             β”‚
β”‚        β”‚                                                β”‚
β”‚        β–Ό                                                β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                             β”‚
β”‚   β”‚  Your Training Data  β”‚                             β”‚
β”‚   β”‚  - QA pairs          β”‚                             β”‚
β”‚   β”‚  - Conversations     β”‚                             β”‚
β”‚   β”‚  - Examples          β”‚                             β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                             β”‚
β”‚        β”‚                                                β”‚
β”‚        β–Ό                                                β”‚
β”‚   Your Custom Model                                     β”‚
β”‚   (Specialized behavior, your brand voice)              β”‚
β”‚                                                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Starting a Fine-Tune Job

Fine-Tuning
1

Prepare Data

Collect at least 50-100 high-quality training examples
2

Navigate to Fine-Tuning

Go to Training β†’ Fine-Tuning
3

Select Base Model

Choose the model to fine-tune (e.g., GPT-4o-mini)
4

Upload Training Data

Upload your prepared dataset
5

Start Training

Begin the fine-tuning job and monitor progress

Training Data Format

Fine-tuning uses JSONL format:
{"messages": [{"role": "system", "content": "You are TechSupport AI..."}, {"role": "user", "content": "My device won't turn on"}, {"role": "assistant", "content": "I'm sorry to hear that! Let's troubleshoot together..."}]}
{"messages": [{"role": "system", "content": "You are TechSupport AI..."}, {"role": "user", "content": "How do I update firmware?"}, {"role": "assistant", "content": "Great question! Here's how to update..."}]}

Fine-Tuning Tips

Data Quality

Quality over quantity. 50 excellent examples beat 500 mediocre ones.

Diverse Examples

Include various topics, question types, and edge cases.

Consistent Format

Maintain consistent response style across all examples.

Iterate

Fine-tune in rounds, testing and improving each time.

Model Distillation

What is Distillation?

Distillation transfers knowledge from a powerful model (teacher) to a smaller, faster model (student).
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   MODEL DISTILLATION                     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                         β”‚
β”‚   Teacher Model (GPT-4o)                               β”‚
β”‚   - Powerful but expensive                              β”‚
β”‚   - Generates training examples                         β”‚
β”‚        β”‚                                                β”‚
β”‚        β–Ό                                                β”‚
β”‚   Student Model (GPT-4o-mini)                          β”‚
β”‚   - Learns from teacher's outputs                       β”‚
β”‚   - Faster and cheaper                                  β”‚
β”‚   - Similar quality for your use case                   β”‚
β”‚                                                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Benefits

AspectBefore DistillationAfter Distillation
Cost$$$$ (GPT-4o)$$ (fine-tuned mini)
Speed~3s per response~1s per response
QualityExcellentVery Good (for your domain)

Evaluating Training Results

Testing Your Trained Expert

1

Create Test Set

Prepare 10-20 questions your expert should answer well
2

Run Tests

Ask each question and record the response
3

Evaluate

Score responses for accuracy, tone, and completeness
4

Iterate

Add more training data where gaps exist

Evaluation Criteria

CriterionWhat to Check
AccuracyIs the information correct?
CompletenessIs the answer thorough?
ToneDoes it match your brand voice?
RelevanceDoes it answer the actual question?
HelpfulnessWould a real user be satisfied?

🎯 Challenge: Complete Training Pipeline

1

Upload 3 Documents

Add product manuals, FAQs, and policy documents
2

Create 10 QA Pairs

Cover common questions with perfect answers
3

Test with 5 Questions

Verify the expert uses the training data
4

Refine

Improve based on test results

Best Practices Summary

Start with RAG

Document retrieval is fastest to implement and easiest to update

Add QA for Precision

Use QA pairs for questions that must have exact answers

Fine-Tune Last

Only fine-tune when you have enough data and clear improvement goals

Test Continuously

Regular testing catches regressions early

Next Steps