- Blog
- Large Language Model (LLM) Parameter Settings Explanation
Large Language Model (LLM) Parameter Settings Explanation
on 13 days ago
Large Language Model (LLM) Parameter Settings Explanation
When interacting with large language models using prompt words, you can obtain different results by configuring parameters. Below are common parameter settings and their explanations:
Temperature
- Function: Controls the determinism and randomness of results.
- Lower values: Results are more deterministic and fact-based (e.g., for QA tasks requiring truthful and concise answers).
- Higher values: Results are more random and creative (e.g., for poetry generation or other creative tasks).
- Principle: Adjusts the weight of possible tokens to balance determinism and diversity.
Top_p
- Function: Together with
Temperature
, it belongs to nucleus sampling techniques to control result authenticity and diversity.- Lower values: Results are more accurate and fact-oriented.
- Higher values: Results are more diverse.
- Recommendation: Typically, adjust either
Temperature
orTop_p
, not both simultaneously.
Max Length
- Function: Limits the number of tokens generated by the model to prevent lengthy or irrelevant responses and control costs.
Stop Sequences
- Function: A specified string (e.g.,
"11"
) to stop the model from generating further tokens, controlling response length and structure. - Example: Adding
"11"
as a stop sequence can generate a list with no more than 10 items.
Frequency Penalty
- Function: Applies a penalty to tokens based on their occurrence frequency in the response and prompt, reducing repetition.
- Higher values: Lower likelihood of token repetition, suppressing frequent word reuse.
Presence Penalty
- Function: Applies a uniform penalty to all repeated tokens (regardless of occurrence count) to prevent monotonous content.
- Higher values: Promote diverse content; lower values: Keep content focused.
- Recommendation: Typically, adjust either
Frequency Penalty
orPresence Penalty
, not both simultaneously.
Notes
Final generated results may vary depending on the version of the large language model used.