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.
生成参数
调整这些设置以控制模型输出。关键参数
Temperature
控制回复中的随机性。| 值 | 效果 | 用例 |
|---|---|---|
| 0.0 - 0.3 | 非常一致,确定性 | 事实性答案,代码 |
| 0.5 - 0.7 | 平衡 | 一般对话 |
| 0.8 - 1.0 | 更多变化,创造性 | 创意写作 |
| 1.0+ | 非常随机 | 头脑风暴 |
Max Tokens
回复的最大长度。| 值 | 典型用途 |
|---|---|
| 50-100 | 简短答案 |
| 256 | 标准回复 |
| 512-1024 | 详细解释 |
| 2048+ | 长文本内容 |
更大的 max tokens = 更长的生成时间。
Top-p (Nucleus Sampling)
将 token 选择限制为累积概率。- 0.95 (UI 默认值) - 考虑直到 95% 概率质量的 tokens
- 0.9 - 稍微更聚焦
- 0.5 - 非常聚焦
Top-k
限制为 k 个最可能的 tokens。- 50 (默认值) - 考虑前 50 个 tokens
- 10 - 非常聚焦
- 100 - 更多变化
参数组合
事实性问答
创意写作
代码生成
对话
找到正确的设置
从默认值开始
默认设置适用于大多数情况:- temperature: 0.7
- max_tokens: 256
- top_p: 0.95
- top_k: 50
- do_sample: true
UI 滑块范围
聊天界面提供以下参数范围:| 参数 | 最小值 | 最大值 | 步长 | 默认值 |
|---|---|---|---|---|
| Temperature | 0 | 2 | 0.1 | 0.7 |
| Max Tokens | 50 | 2048 | 50 | 256 |
| Top P | 0 | 1 | 0.05 | 0.95 |
| Top K | 0 | 100 | 5 | 50 |
一次调整一个
- 如果回复太随机 → 降低 temperature
- 如果回复太重复 → 提高 temperature
- 如果回复被截断 → 增加 max_tokens
- 如果回复太长 → 减少 max_tokens
系统化测试
对于重要应用:- 选择 5-10 个测试提示
- 尝试每个参数设置
- 比较输出
- 记录有效的方法
高级参数
Repetition Penalty
减少重复短语。- 1.0 - 无惩罚
- 1.1 - 轻微惩罚(推荐)
- 1.3+ - 强惩罚
Stop Sequences
当这些 tokens 出现时结束生成。- 对结构化输出有用
- 示例:
["\n\n", "User:"]
Do Sample
控制是否使用采样或贪心解码。- true (默认值) - 使用 temperature/top-p/top-k 进行采样
- false - 贪心解码(总是选择最可能的 token)
System Prompt
设置系统消息以指导模型行为。可在聊天界面设置面板中使用。 示例 system prompts:- “You are a helpful coding assistant. Provide concise code examples.”
- “You are a creative writing partner. Be imaginative and descriptive.”
- “You are a technical documentation expert. Be precise and thorough.”
参数效果总结
| 参数 | 低值 | 高值 |
|---|---|---|
| temperature | 一致,聚焦 | 随机,创造性 |
| max_tokens | 短回复 | 长回复 |
| top_p | 聚焦 | 多样化 |
| top_k | 非常聚焦 | 更多选项 |
| repetition_penalty | 可能重复 | 避免重复 |
下一步
CLI 训练
使用 CLI 训练模型
Python API
程序化控制