Skip to main content

Model Parameters

Model parameters control how an LLM generates text — including creativity, output length, and sampling strategy. Tuning these parameters appropriately can significantly improve AI output quality and make it better suited to your use case.

When to Use

  • The default output is too random or too rigid and you want to adjust creativity
  • Responses are frequently truncated and you need to increase the output length limit
  • You are using a reasoning model and want to control the depth of thinking
  • You need different parameter combinations for different task scenarios (creative writing vs. code generation)

Where to Configure Parameters

Elftia provides multiple levels of parameter configuration, with the following priority (highest to lowest):

Session-level parameters (temporary adjustments in the chat window)
|
v overrides
Global model parameters (Settings → Model Parameters)
|
v overrides
Provider default parameters (defaultSettings in the provider configuration)
|
v overrides
System defaults

Global Model Parameters

  1. Open SettingsModel Parameters
  2. Adjust the value of each parameter
  3. Use the Enable/Disable toggle next to each parameter to control whether it applies

Session-Level Parameters

  1. In the chat UI, click the Parameters button next to the model selection area
  2. Temporarily adjust parameters for the current session
  3. These adjustments apply only to the current session

Core Parameters Explained

temperature

PropertyValue
Range0 – 2
Default0.7
Global controlYes

Purpose: Controls the randomness and creativity of the output.

  • Low temperature (0 – 0.3): Output is more deterministic and consistent — suitable for code generation, factual Q&A, data extraction, and other precision-demanding scenarios
  • Mid temperature (0.4 – 0.8): Balances creativity and consistency — suitable for everyday conversation and documentation writing
  • High temperature (0.9 – 2.0): Output is more random and creative — suitable for creative writing and brainstorming

Recommended settings:

ScenarioRecommended value
Code generation0 – 0.2
Technical documentation0.3 – 0.5
Everyday conversation0.6 – 0.8
Creative writing0.8 – 1.2
Brainstorming1.0 – 1.5

max_tokens

PropertyValue
Range1 – (model limit)
Default4096
Global controlYes

Purpose: Limits the maximum length of the model's reply in a single response (measured in tokens — roughly 1–2 tokens per Chinese character, ~1 token per English word).

  • If a reply is truncated mid-sentence and a "maximum length reached" message appears, max_tokens is set too low
  • Setting a very high value does not force the model to always produce long responses — the model stops naturally when it considers the answer complete
  • Different models have different limits; values above the model's maximum are automatically clamped

Common model output limits:

ModelMax output tokens
GPT-4o16,384
GPT-565,536
Claude Sonnet 4.565,536
Claude Haiku 4.565,536
Gemini 3 Flash65,536
Qwen3 Max65,536
DeepSeek V38,192

top_p

PropertyValue
Range0 – 1
Default1.0
Global controlYes

Purpose: Nucleus Sampling is another way to control randomness. When generating each token, the model samples only from the candidates whose cumulative probability reaches top_p.

  • top_p = 1.0: All candidate tokens are considered (no filtering)
  • top_p = 0.9: Samples only from the highest-probability tokens that together account for 90% of the probability mass
  • top_p = 0.1: Samples only from the highest-probability tokens that together account for 10% — output is very deterministic

Note: It is generally recommended to adjust only one of temperature or top_p at a time; modifying both significantly can produce unpredictable effects.

Thinking Budget

PropertyValue
Optionsnone / low / medium / high
Defaultlow
Global controlYes

Purpose: Controls the depth of "thinking" performed by reasoning models (such as Claude Sonnet 4.5, Gemini 3 Flash, DeepSeek R1, and other reasoning-capable models) before they reply.

LevelDescriptionUse case
noneReasoning disabled; the model replies directlySimple Q&A, casual chat
lowLight thinkingEveryday tasks — balances speed and quality
mediumModerate thinkingComplex problems requiring some reasoning
highDeep thinking with maximum token budgetMathematical proofs, complex code, in-depth analysis

The thinking budget only takes effect for models marked reasoning: true. For models that do not support reasoning, this setting is ignored.

reasoning_effort

This parameter is specific to OpenAI's o-series models (e.g. o1, o3, o4-mini).

PropertyValue
Optionslow / medium / high
Defaultmedium
  • low: Fast response, suitable for simple questions
  • medium: Balanced mode
  • high: Deep reasoning, suitable for complex tasks

Tool Max Turns

PropertyValue
Range1 – 50
Default5
Global controlYes

Purpose: Limits the maximum number of MCP tool-call iterations in Agent mode. When the model calls tools consecutively within a single conversation, the process is forcibly stopped and the current result is returned once this limit is reached.

Configuration Reference

Global Model Parameters

ParameterTypeDefaultRangeEnable/Disable
temperatureNumber0.70 – 2Enabled by default
topPNumber1.00 – 1Disabled by default
maxTokensNumber40961 – (model limit)Disabled by default
defaultThinkingBudgetEnumlownone/low/medium/highAlways active
toolMaxTurnsNumber51 – 50Always active

Provider Default Parameters

ParameterTypeSystem defaultDescription
temperatureNumber0.7Provider-level default temperature
topPNumber1Provider-level default top_p
maxTokensNumber4096Provider-level default max output
streamBooleantrueWhether to use streaming
presencePenaltyNumber(not set)Presence penalty (–2 to 2)
frequencyPenaltyNumber(not set)Frequency penalty (–2 to 2)
stopString array(not set)Stop sequences
seedNumber(not set)Random seed (for reproducible output)
jsonModeBooleanfalseWhether to force JSON-formatted output

Default Parameter Differences by Provider

Different provider templates ship with different default parameters:

ProvidertemperaturemaxTokenstopPOther
OpenAI0.74,096----
Anthropic0.765,536----
Google Gemini0.765,5360.95--
System default0.74,0961stream: true

Behavior Notes

Parameter Priority

When the same parameter is set at multiple levels, the priority is:

  1. Session-level parameters (temporarily adjusted during chat) — highest priority
  2. Global model parameters (configured in the settings page and marked as "enabled")
  3. Provider default parameters (defaultSettings in the provider configuration)
  4. System defaults (temperature: 0.7, topP: 1, maxTokens: 4096)

Global model parameters marked as "disabled" do not override provider default values.

Parameter Compatibility with Models

Not all parameters are supported by all models:

ParameterOpenAIAnthropicGeminiLocal models
temperatureSupportedSupportedSupportedSupported
maxTokensSupportedSupportedSupportedSupported
topPSupportedSupportedSupportedSupported
presencePenaltySupportedNot supportedNot supportedPartially supported
frequencyPenaltySupportedNot supportedNot supportedPartially supported
seedSupportedNot supportedNot supportedPartially supported
thinkingPartial (o-series)SupportedSupportedNot supported

Unsupported parameters are automatically stripped by the Transformer before the request is sent, so no error is produced.

Transformer Impact on Parameters

Elftia's Transformer system adapts parameters before sending a request:

TransformerParameter handling
anthropicMaps max_tokens to Anthropic's field format
geminiConverts parameters to Gemini's generationConfig format
samplingNormalizes sampling parameters such as temperature and top_p
maxtokenForces a specific max_tokens value (overrides user setting)
maxcompletiontokensConverts max_tokens to max_completion_tokens (required by some models)
reasoningHandles the reasoning_content field for reasoning models
forcereasoningForces reasoning mode on (ignores the user's thinking budget setting)

Model Routing

Elftia supports configuring different models for different task types:

Routing roleDescriptionWhere to configure
Default modelPrimary chat modelModel selection in the chat UI
Background modelUsed for lightweight tasks (summarization, title generation, etc.)Settings → Agent Default Models
Vision modelHandles messages containing images (when the default model does not support vision)Settings → Agent Default Models
Reasoning modelTasks requiring deep thinkingControlled via the thinking budget level

Follow Provider: When this option is enabled, the background model and vision model automatically use the corresponding models from the same provider as the current default model. For example, if you use Zhipu's GLM-5 as the default model, the background model will automatically use GLM-4.5 Air and the vision model will use GLM-4.6V.

Troubleshooting

IssuePossible causeSolution
Responses are truncatedmax_tokens is set too lowIncrease the max_tokens value, or enable it in global parameters and set a larger value
Responses are too random or irrelevanttemperature is too highLower the temperature (0.3–0.7 recommended)
Responses are too rigid or repetitivetemperature is too lowRaise the temperature slightly (0.5–0.8 recommended)
Reasoning model does not show chain-of-thoughtthinking budget is set to noneSet defaultThinkingBudget to low or higher
Reasoning model thinks for too longthinking budget is set to highLower it to medium or low
Parameter settings have no effectOverridden by a higher-priority settingCheck whether session-level parameters are overriding; confirm the global parameter enable switch is on
Request returns a parameter errorThe model does not support a particular parameterCheck parameter compatibility with the model; disable incompatible parameters
Tool calls stop mid-conversationtoolMaxTurns limit reachedIncrease the toolMaxTurns value (note: this may increase API costs)
Large performance differences between providersProvider default parameters differEnable global parameters and set key parameters to a consistent value