> ## Documentation Index
> Fetch the complete documentation index at: https://docs.monostate.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Training Tasks

> What you can train models to do

# Types of Training Tasks

AI Training supports many different tasks. Each task is optimized for specific types of problems you want to solve.

## Text Tasks

### Text Classification

**What it does**: Sorts text into categories you define.

**Real-world examples**:

* Email spam detection
* Customer feedback sentiment (happy/unhappy)
* Support ticket routing
* Content moderation
* Language detection

**What you need**:

* Text samples
* Category labels for each sample
* At least 50 examples per category (more is better)

**Example data format**:

```csv theme={null}
text,label
"Great product, highly recommend!",positive
"Terrible experience, waste of money",negative
"The item arrived damaged",negative
"Excellent customer service",positive
```

### Token Classification (NER)

**What it does**: Labels specific words or phrases in text.

**Real-world examples**:

* Extract names, dates, locations from documents
* Identify product mentions in reviews
* Find medical terms in clinical notes
* Highlight important contract clauses
* Tag parts of speech

**What you need**:

* Text with marked entities
* BIO format (Beginning, Inside, Outside) labels
* Hundreds of annotated examples

**Example data format**:

```
John B-PERSON
Smith I-PERSON
visited O
New B-LOCATION
York I-LOCATION
yesterday B-DATE
```

### Sequence to Sequence

**What it does**: Transforms one text into another.

**Real-world examples**:

* Language translation
* Text summarization
* Question answering
* Text correction
* Paraphrasing

**What you need**:

* Input text
* Desired output text
* Pairs of input-output examples

**Example data format**:

```csv theme={null}
input_text,target_text
"The quick brown fox jumps over the lazy dog","Le renard brun rapide saute par-dessus le chien paresseux"
"Hello, how are you?","Bonjour, comment allez-vous?"
```

### Text Generation (LLM Fine-tuning)

**What it does**: Teaches language models new knowledge or behaviors.

**Real-world examples**:

* Custom chatbots
* Domain-specific assistants
* Code generation
* Creative writing
* Technical documentation

**What you need**:

* Conversation examples or instruction-response pairs
* Optional: Preference data for RLHF
* Can work with as few as 100 examples

**Example conversation format**:

```json theme={null}
{
  "messages": [
    {"role": "user", "content": "What is photosynthesis?"},
    {"role": "assistant", "content": "Photosynthesis is the process plants use to convert sunlight into energy..."}
  ]
}
```

## Image Tasks

### Image Classification

**What it does**: Identifies what's in an image.

**Real-world examples**:

* Product quality inspection
* Medical image diagnosis
* Wildlife identification
* Document type classification
* Facial expression recognition

**What you need**:

* Images (JPG, PNG)
* Category label for each image
* At least 100 images per category

**Folder structure**:

```
data/
  cats/
    cat1.jpg
    cat2.jpg
  dogs/
    dog1.jpg
    dog2.jpg
```

### Object Detection

**What it does**: Finds and locates multiple objects in images.

**Real-world examples**:

* Inventory counting
* Security monitoring
* Autonomous driving
* Defect detection
* People counting

**What you need**:

* Images with bounding boxes
* Labels for each box
* COCO or YOLO format annotations

## Structured Data Tasks

### Tabular Classification

**What it does**: Predicts categories from spreadsheet-like data.

**Real-world examples**:

* Customer churn prediction
* Fraud detection
* Disease diagnosis
* Credit approval
* Equipment failure prediction

**What you need**:

* CSV with features and labels
* Numerical and categorical columns
* Clean, preprocessed data

**Example data**:

```csv theme={null}
age,income,credit_score,approved
25,45000,720,yes
35,65000,650,no
42,85000,780,yes
```

### Tabular Regression

**What it does**: Predicts continuous values from structured data.

**Real-world examples**:

* House price prediction
* Sales forecasting
* Energy consumption estimation
* Stock price prediction
* Delivery time estimation

**What you need**:

* CSV with features and target values
* Numerical target column
* Historical data

## Advanced Training Methods

### Supervised Fine-Tuning (SFT)

Standard training with examples and correct answers.

**Use when**: You have good quality labeled data.

### DPO (Direct Preference Optimization)

Train models using preference comparisons.

**Use when**: You have examples of good vs bad outputs.

**Data format**:

```json theme={null}
{
  "prompt": "Write a greeting",
  "chosen": "Hello! How can I help you today?",
  "rejected": "sup"
}
```

### ORPO (Odds Ratio Preference Optimization)

Similar to DPO but more stable training.

**Use when**: DPO training is unstable or overfitting.

### Reward Modeling

Train a model to score outputs.

**Use when**: Building a reward model for RLHF.

### PPO (Proximal Policy Optimization)

Reinforcement learning from feedback.

**Use when**: You have a reward model and want to optimize against it.

## Task Selection Guide

### Based on Your Data

| If you have...          | Choose this task                  |
| ----------------------- | --------------------------------- |
| Text + categories       | Text Classification               |
| Text with entity labels | Token Classification              |
| Input/output text pairs | Sequence to Sequence              |
| Conversations           | LLM Fine-tuning                   |
| Images + labels         | Image Classification              |
| Spreadsheet data        | Tabular Classification/Regression |

### Based on Your Goal

| If you want to...        | Choose this task     |
| ------------------------ | -------------------- |
| Sort things into buckets | Classification       |
| Extract information      | Token Classification |
| Transform text           | Sequence to Sequence |
| Create a chatbot         | LLM Fine-tuning      |
| Predict numbers          | Regression           |
| Find objects             | Object Detection     |

### Based on Difficulty

**Easiest to start**:

1. Text Classification
2. Image Classification
3. Tabular Classification

**Medium difficulty**:

1. Token Classification
2. Sequence to Sequence
3. LLM Fine-tuning (SFT)

**Advanced**:

1. DPO/ORPO training
2. Object Detection
3. PPO/RLHF

## Data Requirements

### Minimum Data Needed

| Task                 | Absolute Minimum | Good Starting Point | Production Quality |
| -------------------- | ---------------- | ------------------- | ------------------ |
| Text Classification  | 50 per class     | 500 per class       | 5,000+ per class   |
| Token Classification | 100 documents    | 1,000 documents     | 10,000+ documents  |
| Seq2Seq              | 100 pairs        | 1,000 pairs         | 10,000+ pairs      |
| LLM Fine-tuning      | 50 examples      | 500 examples        | 5,000+ examples    |
| Image Classification | 100 per class    | 1,000 per class     | 10,000+ per class  |
| Tabular              | 500 rows         | 5,000 rows          | 50,000+ rows       |

### Data Quality Matters

Better to have 100 high-quality examples than 1,000 poor ones:

* Accurate labels
* Consistent formatting
* Representative of real-world use
* Balanced across categories

## Multi-Task Training

You can train models for multiple tasks simultaneously:

### Benefits

* Share knowledge between tasks
* More efficient use of data
* Single model deployment

### Example

Train one model to:

* Classify sentiment
* Extract entities
* Summarize text

All with the same base model.

## Task-Specific Settings

### Text Tasks

* **Max sequence length**: How much text to process
* **Tokenizer**: How to split text into tokens
* **Special tokens**: Task-specific markers

### Image Tasks

* **Image size**: Resolution to use
* **Augmentation**: Rotation, flip, crop
* **Normalization**: Pixel value scaling

### Tabular Tasks

* **Feature engineering**: Creating new columns
* **Scaling**: Normalizing numeric values
* **Encoding**: Handling categorical variables

## Evaluation Metrics

Different tasks use different metrics:

| Task                 | Common Metrics                  |
| -------------------- | ------------------------------- |
| Classification       | Accuracy, F1, Precision, Recall |
| Token Classification | Entity-level F1, Token accuracy |
| Seq2Seq              | BLEU, ROUGE, BERTScore          |
| Generation           | Perplexity, Human evaluation    |
| Regression           | MSE, MAE, R²                    |
| Object Detection     | mAP, IoU                        |

## Combining Tasks

### Pipeline Approach

Chain tasks together:

1. Classification → Route to specialized model
2. NER → Extract entities → Generate response
3. Translate → Summarize → Classify sentiment

### Multi-Modal Tasks

Combine different data types:

* Image + Text → Visual QA
* Audio + Text → Speech recognition
* Video + Text → Video understanding

## Next Steps

Ready to dive deeper?

<CardGroup cols={2}>
  <Card title="Model Types" href="/foundations/model-types">
    Choose the right model architecture
  </Card>

  <Card title="Quick Start" href="/foundations/quickstart">
    Train your first model
  </Card>
</CardGroup>
