|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > AI - Artificial Intelligence Commands > AIX. - Grok / X - API > !Response Behavior Settings > AIX - Artificial Intelligence and X Platform Utility |
MiniRobotLanguage (MRL)
AIX.Set FrequencyPenalty
Set the Frequency Penalty to Control Word Repetition
Intention
Set FrequencyPenalty Command: Adjust Repetition Control
The Set FrequencyPenalty command sets a penalty value to control the repetition of words in AI-generated responses, influencing the Grok model’s behavior.
This helps tailor the output’s diversity.
It’s part of the AIX - Grok / X - API suite.
The Set FrequencyPenalty command updates a global setting (e.g., AIX_FrequencyPenalty) that adjusts the penalty applied to frequently used words during response generation.
A higher value increases the penalty, reducing repetition, while a lower value allows more repetition. The typical range is 0.0 to 2.0, with 0.0 as the default (no penalty).
Setting the frequency penalty is useful for:
•Diversity Control: Reduces repetitive phrasing in responses.
•Customization: Tailors output to specific use cases (e.g., creative vs. factual).
•Optimization: Balances fluency and variety in AI output.
Use the command to set the frequency penalty before executing AI queries with AIX.Ask or AIX.AskVision.
Specify a value between 0.0 and 2.0, and verify with AIX.Get FrequencyPenalty.
Example Usage
AIX.Set FrequencyPenalty|1.5
AIX.Ask|""Write a unique story""
AIX.Get FrequencyPenalty|$$PENALTY
DBP.Frequency penalty: $$PENALTY
AIX.Set FrequencyPenalty|0.0
AIX.Ask|""Repeat a phrase""
This example sets a high penalty for a unique story, verifies it, then resets to no penalty for repetition.
Illustration
┌────────────────────┐
│ Set Frequency │
├────────────────────┤
│ Input: Penalty │
│ Process: Update │
│ Output: Setting │
└────────────────────┘
A visual of setting and updating the frequency penalty configuration.
Syntax
AIX.Set FrequencyPenalty|value
AIX_Set_FrequencyPenalty|value
Parameter Explanation
value - (Required) A numeric value (e.g., 0.0 to 2.0) of type DOUBLE specifying the frequency penalty to apply.
Remarks
- The frequency penalty is passed to the Grok API to influence word selection during response generation.
- A value of 0.0 applies no penalty, while values up to 2.0 increase the penalty on repeated words.
Limitations
- Changes apply only to future responses; existing responses are unaffected.
- Values outside the 0.0 to 2.0 range may be clamped or cause errors, depending on API behavior.
See also:
• AIX.Ask
• Model Configuration and Tools