同一输入下,大模型输出相同文本却因分词不同导致价格差异。
Tokenization Multiplicity Leads to Arbitrary Price Variation in LLM-as-a-service
- 提出规范生成,强制模型使用训练时的唯一分词方式。
- 实验证明该方法可消除分词多样性带来的价格波动。
- 适合关注计费公平性与输出一致性的开发者和企业。
大模型即服务(LLM-as-a-service)提供商普遍采用按令牌计费的定价模式,用户通常认为相同输出应支付相同费用。然而,我们的研究表明,这一假设并不总是成立。针对非英文输出,无论是专有模型还是开源模型,即使在相同输入提示下,同一输出字符串常存在多种不同的分词方式,从而导致价格任意波动。为解决分词多重性问题,我们提出规范生成(canonical generation),限制模型仅生成训练过程中使用的唯一分词形式。此外,基于Gumbel-Max技巧设计了一种高效的采样算法。在多种自然语言任务上的实验表明,该算法在性能和运行时间上与标准采样相当,且有效解决了分词多重性问题。
原文摘要 · Abstract (English)
Providers of LLM-as-a-service have predominantly adopted a simple pricing model: users pay a fixed price per token. Consequently, one may think that the price two different users would pay for the same output string under the same input prompt is the same. In our work, we show that, surprisingly, this is not (always) true. We find empirical evidence that, particularly for non-english outputs, both proprietary and open-weights LLMs often generate the same (output) string with multiple different tokenizations, even under the same input prompt, and this in turn leads to arbitrary price variation. To address the problem of tokenization multiplicity, we introduce canonical generation, a type of constrained generation that restricts LLMs to only generate canonical tokenizations -- the unique tokenization in which each string is tokenized during the training process of an LLM. Further, we introduce an efficient sampling algorithm for canonical generation based on the Gumbel-Max trick. Experiments on a variety of natural language tasks demonstrate that our sampling algorithm for canonical generation is comparable to standard sampling in terms of performance and runtime, and it solves the problem of tokenization multiplicity.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。