> For the complete documentation index, see [llms.txt](https://docs.meganova.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.meganova.ai/character-studio/character-features/advanced-settings.md).

# Advanced Settings

> **Note:** Advanced settings give you fine-grained control over how your character behaves, including model selection, temperature, and custom prompts.

## Overview

Advanced settings control:

* **Model Selection** — Which AI model powers responses
* **Temperature** — Response creativity/randomness
* **System Prompt** — Custom instructions to the AI
* **Post-History Instructions** — Guidance after message history

## Model Selection

### Available Models

Character Studio supports 50+ models including:

| Category              | Examples                                |
| --------------------- | --------------------------------------- |
| **Fast & Affordable** | GPT-4o-mini, Claude Haiku, Llama 3.1-8B |
| **Balanced**          | GPT-4o, Claude Sonnet, Llama 3.1-70B    |
| **Premium**           | GPT-4, Claude Opus, Llama 3.1-405B      |
| **Specialized**       | Role-play optimized models              |

### Choosing a Model

Consider these factors:

| Factor      | Recommendation                                   |
| ----------- | ------------------------------------------------ |
| **Quality** | Larger models generally produce better responses |
| **Speed**   | Smaller models respond faster                    |
| **Cost**    | Credits vary by model                            |
| **Context** | Check context window size for long conversations |

### Per-Character Model

Set a default model for each character:

1. Open character in editor
2. Go to **Advanced** section
3. Select model from dropdown
4. Save character

This model is used when users chat with your character (unless they override).

## Temperature

### What Temperature Does

Temperature controls response randomness:

| Value       | Effect                 | Best For                           |
| ----------- | ---------------------- | ---------------------------------- |
| **0.0-0.3** | Deterministic, focused | Factual, consistent responses      |
| **0.4-0.7** | Balanced               | Most characters (default: 0.7)     |
| **0.8-1.0** | Creative, varied       | Creative, unpredictable characters |
| **1.1-2.0** | Very random            | Experimental, chaotic characters   |

### Setting Temperature

1. Open character editor
2. Go to **Advanced** section
3. Adjust temperature slider
4. Save character

### Examples

**Low temperature (0.3):** Character always responds consistently, predictable.

```
User: How are you?
Response 1: I'm doing well, thank you for asking.
Response 2: I'm doing well, thank you for asking.
(Nearly identical)
```

**High temperature (1.2):** Character responds variedly, sometimes surprisingly.

```
User: How are you?
Response 1: I'm doing well, thank you for asking.
Response 2: *stretches* Could be worse! The stars aligned today.
(More variation)
```

## System Prompt

### What It Does

The system prompt tells the AI how to behave. It's the foundational instruction before any conversation.

### Default Behavior

By default, Character Studio generates a system prompt from your character definition:

* Name and identity
* Description and personality
* Scenario and context
* Behavioral guidelines

### Custom System Prompt

Override the default for complete control:

1. Go to **Advanced** section
2. Find **System Instruction** field
3. Enter your custom prompt
4. Save character

**Example custom prompt:**

```
You are {{char}}, a mysterious librarian in an ancient magical library.
You speak in riddles and always know more than you reveal.
Never break character. Never acknowledge being an AI.
Respond to questions with questions when appropriate.
Reference obscure books and forgotten lore.
```

### System Prompt Variables

Use placeholders that get replaced:

| Variable       | Replaced With        |
| -------------- | -------------------- |
| `{{char}}`     | Character's name     |
| `{{user}}`     | User's name/persona  |
| `{{scenario}}` | Character's scenario |

## Post-History Instructions

### What They Are

Instructions inserted after the message history, right before the AI generates a response.

### Use Cases

1. **Reminders**: Keep the AI focused

   ```
   Remember: Stay in character. No meta-commentary.
   ```
2. **Style guidance**: Enforce formatting

   ```
   Respond with 2-3 paragraphs. Include an action in asterisks.
   ```
3. **Constraints**: Prevent certain behaviors

   ```
   Do not reveal the character's secret identity yet.
   ```

### Setting Post-History Instructions

1. Go to **Advanced** section
2. Find **Post-History Instructions** field
3. Enter your instructions
4. Save character

## Sampling Parameters

### Top-P (Nucleus Sampling)

Controls token selection diversity:

* **1.0**: Consider all tokens (default)
* **0.9**: Only top 90% probability mass
* Lower values = more focused responses

### Top-K

Limits tokens considered:

* **0**: No limit (default)
* **50**: Only top 50 tokens considered
* Higher values = more diversity

### Frequency Penalty

Reduces repetition of frequent words:

* **0.0**: No penalty (default)
* **0.5**: Moderate penalty
* **1.0**: Strong penalty

### Presence Penalty

Encourages topic diversity:

* **0.0**: No penalty (default)
* **0.5**: Some novelty encouraged
* **1.0**: Strong push for new topics

## Context Window

### Understanding Context

The context window is the AI's "memory" limit:

* Includes: System prompt + chat history + lorebook + current message
* Measured in tokens (\~4 characters = 1 token)

### Model Context Sizes

| Model         | Context Window |
| ------------- | -------------- |
| GPT-4o-mini   | 128K tokens    |
| Claude Sonnet | 200K tokens    |
| Llama 3.1-8B  | 128K tokens    |
| GPT-4         | 8K-32K tokens  |

### Managing Context

When context fills up:

* Oldest messages are trimmed
* System prompt always stays
* Critical information may be lost

**Solutions:**

* Use models with larger context
* Summarize long conversations
* Use lorebooks for persistent info
* Keep character definitions concise

## Settings Combinations

### Consistent Character

```
Temperature: 0.3
Top-P: 0.9
Post-History: "Maintain consistent personality and speech patterns."
```

### Creative Storyteller

```
Temperature: 0.9
Top-P: 1.0
Frequency Penalty: 0.3
Post-History: "Be creative and descriptive in responses."
```

### Factual Assistant

```
Temperature: 0.1
Top-P: 0.5
Post-History: "Prioritize accuracy. Ask for clarification if uncertain."
```

## Troubleshooting

### Character breaks role

* Add stronger instructions in system prompt
* Use post-history reminders
* Lower temperature for consistency

### Responses are repetitive

* Increase frequency penalty
* Raise temperature slightly
* Add variety in example dialogues

### Responses are too random

* Lower temperature
* Reduce top-p
* Add more structured instructions

### Context running out

* Switch to higher-context model
* Trim character definition
* Move details to lorebooks

## See Also

* [Token Management](https://docs.meganova.ai/character-studio/advanced/token-management.md) — Understanding context
* [Prompt Engineering](https://docs.meganova.ai/character-studio/advanced/prompt-engineering.md) — Writing effective prompts
* [Model List](https://docs.meganova.ai/inference-models/model-list.md) — Available models
* [Quality Metrics](https://docs.meganova.ai/character-studio/testing-quality/quality-metrics.md) — Evaluating settings
