# 参数详情

在Completions API中发现的频率和存在惩罚可以用来减少采样重复标记序列的可能性。它们通过直接向logits（未归一化的对数概率）添加一个加法项来进行修改。

```
mu[j] -> mu[j] - c[j] * alpha_frequency - float(c[j] > 0) * alpha_presence
```

### 解释

* mu\[j]是第j个令牌的对数概率
* c\[j]是在当前位置之前抽样到该令牌的频率
* float(c\[j]>0)是如果c\[j]>0，则为1，否则为0
* alpha\_frequency是频率惩罚系数
* alpha\_presence是存在惩罚系数

正如我们所看到的，存在惩罚是一次性的加法贡献，适用于所有已经被抽样至少一次的令牌，而频率惩罚是与特定令牌已经被抽样的次数成比例的贡献。

对于惩罚系数的合理值约为0.1到1，如果目的仅是稍微减少重复抽样的话。如果目的是强烈抑制重复，则可以将系数增加到2，但这可能会显着降低抽样质量。负值可用于增加重复的可能性。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.luojixiangliang.com/reference/openai-api-can-kao-wen-dang/can-shu-xiang-qing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
