The cockpit of ai a beginner’s guide to llm parameters
Table of Contents
When you use an LLM (Large Language Model) through an API like OpenRouter, you aren’t just sending a text message and hoping for the best. You actually have access to a “cockpit” of dials and switches that control how the AI thinks.
Do you want a creative storyteller? A rigid mathematician? A robot that never repeats itself?
This guide explains every parameter you can use, broken down into simple terms.
🏗️ 1. The “Creativity” Knobs (Sampling)
These parameters control the AI’s imagination. LLMs work by predicting the next word in a sentence. These settings determine how “risky” or “safe” those predictions are.
Temperature
-
Key:
temperature -
What it does: Controls the “wildness” of the AI.
-
How it works:
-
Low (0.0 - 0.5): The AI plays it safe. It only picks the most likely words. Great for facts, code, and logic.
-
High (0.8 - 2.0): The AI takes risks. It picks less common words, leading to more creative (but potentially weird) results.
-
-
Analogy: Think of a chef. Low temp = following the recipe exactly. High temp = experimenting with spices.
Top P
-
Key:
top_p -
What it does: A “smart filter” for word choices.
-
How it works: Instead of considering all words in the dictionary, the AI only looks at the top % of likely words (e.g., the top 90%).
-
Low Top P: Limits choices to the absolute best options.
-
High Top P: Allows for a wider variety of vocabulary.
-
-
Pro Tip: Usually, you change either Temperature or Top P, not both.
Top K
-
Key:
top_k -
What it does: A “hard limit” on word choices.
-
How it works: It forces the AI to only pick from the top $K$ words. If you set Top K to 5, the AI must choose one of the 5 most likely next words and ignore everything else.
-
Use case: Good for keeping the AI focused and preventing it from going off the rails with nonsense words.
Min P
-
Key:
min_p -
What it does: A “relative” filter.
-
How it works: It sets a minimum standard. If the most likely word has a 50% chance, and you set Min P to 0.1 (10%), then any other word must have at least a 5% chance (10% of 50%) to be considered. It cuts out the “garbage” options relative to how sure the model is.
Top A
-
Key:
top_a -
What it does: Another dynamic filter similar to Top P.
-
How it works: It tightens the choices when the AI is very confident and loosens them when the AI is unsure. If the AI is 99% sure the next word is “Cat,” Top A forces it to pick “Cat.” If it’s unsure, it allows more options.
Seed
-
Key:
seed -
What it does: Makes the AI “repeatable.”
-
How it works: Usually, AI is random. If you use the same Seed number (like
12345) on two identical requests, the AI will try to generate the exact same text both times. Useful for testing.
🚫 2. The “Don’t Repeat Yourself” Knobs (Penalties)
LLMs love to get stuck in loops. These parameters slap the AI on the wrist when it repeats words.
Frequency Penalty
-
Key:
frequency_penalty -
What it does: Punishes words that have been used many times.
-
Effect: The more a word appears, the more the AI hates using it again. This drastically reduces repetitive phrases like “and then… and then… and then…”
Presence Penalty
-
Key:
presence_penalty -
What it does: Punishes words that have been used at least once.
-
Effect: As soon as a word is used, the AI tries to avoid it. This encourages the AI to talk about new topics rather than staying on the same subject.
Repetition Penalty
-
Key:
repetition_penalty -
What it does: A simpler penalty that discourages repeating tokens.
-
Effect: A higher value makes the model less likely to repeat text. Be careful—setting this too high can make the AI sound disjointed because it’s trying too hard not to use normal words like “the” or “a” again.
🚧 3. The “Control” Knobs (Structure)
These settings control the length, format, and structure of the output.
Max Tokens
-
Key:
max_tokens -
What it does: Sets a word count limit.
-
Effect: The AI will stop generating text once it hits this limit. Useful for keeping costs down or ensuring short answers.
Stop
-
Key:
stop -
What it does: A “kill switch” word.
-
Effect: You give the AI a list of words (e.g.,
["User:", "END"]). If the AI is about to type one of those words, it stops immediately.
Response Format
-
Key:
response_format -
What it does: Forces the AI to speak in code.
-
Effect: You can force the output to be valid JSON (a data format used by programmers). This guarantees the robot doesn’t just chat with you but gives you data you can use in software.
Structured Outputs
-
Key:
structured_outputs -
What it does: Advanced data enforcement.
-
Effect: Similar to “Response Format” but stricter. It ensures the output matches a very specific schema or template you provide.
Verbosity
-
Key:
verbosity -
What it does: Controls length/detail.
-
Effect: A simple switch (
low,medium,high) to tell the model whether to be brief or chatty.
🛠️ 4. The “Tool” Knobs (Actions)
Modern AIs can use tools (like a calculator or Google Search). These parameters control that ability.
Tools
-
Key:
tools -
What it does: Gives the AI a toolbox.
-
Effect: You list functions the AI can “call.” For example, you tell the AI “Here is a weather_check tool.” The AI won’t run it, but it will tell you when it wants to run it.
Tool Choice
-
Key:
tool_choice -
What it does: Forces or bans tool usage.
-
Options:
-
none: “Don’t use tools, just talk.” -
auto: “Use a tool if you think it helps.” -
required: “You MUST use a tool right now.”
-
Parallel Tool Calls
-
Key:
parallel_tool_calls -
What it does: Multi-tasking.
-
Effect: If
true, the AI can decide to check the weather in New York AND London at the exact same time, rather than doing one after the other.
🤓 5. The “Developer” Knobs (Advanced)
These are for advanced users who need to look under the hood.
Logit Bias
-
Key:
logit_bias -
What it does: Manually rigging the election.
-
Effect: You can force the AI to always use a specific word (bias +100) or never use a specific word (bias -100).
Logprobs
-
Key:
logprobs -
What it does: “Show your work.”
-
Effect: If true, the AI returns the answer plus the mathematical probability of that answer. It tells you how confident it was.
Top Logprobs
-
Key:
top_logprobs -
What it does: Detailed confidence report.
-
Effect: It shows the probability of the chosen word and the runner-up words that almost won.
Reference
[1] Openrouter.ai, 2025. https://openrouter.ai/docs/api/reference/parameters.