File size: 1,094 Bytes
bbffad2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Optimized Generation Configurations for Different Use Cases

CONFIGS = {
    "creative": {
        "temperature": 0.9,
        "top_k": 50,
        "top_p": 0.95,
        "repetition_penalty": 1.1,
        "description": "More creative and diverse outputs"
    },
    "balanced": {
        "temperature": 0.7,
        "top_k": 40,
        "top_p": 0.9,
        "repetition_penalty": 1.3,
        "description": "Balanced creativity and coherence (recommended)"
    },
    "focused": {
        "temperature": 0.5,
        "top_k": 30,
        "top_p": 0.85,
        "repetition_penalty": 1.5,
        "description": "More focused and deterministic"
    },
    "factual": {
        "temperature": 0.3,
        "top_k": 20,
        "top_p": 0.8,
        "repetition_penalty": 1.4,
        "description": "Best for encyclopedia-style content"
    }
}

# Better prompts for small models
PROMPT_TEMPLATES = {
    "article": "Wikipedia article about {topic}:\n\n",
    "definition": "{term} is defined as",
    "explanation": "Here is an explanation of {topic}:\n\n",
    "continuation": "{text}"
}