Balancing Diversity and Risk in LLM Sampling: How to Select Your Method and Parameter for Open-Ended Text Generation

Yuxuan Zhou, Margret Keuper, Mario Fritz
8/24/2024
cs.CLcs.AI

No official code found. Best implementation: ZhouYuxuanYX/Benchmarking-and-Guiding-Adaptive-Sampling-Decoding-for-LLMs (17 stars, last commit 2025-10-16).

Abstract

Sampling-based decoding strategies have been widely adopted for Large Language Models (LLMs) in numerous applications, targeting a balance between diversity and quality via temperature tuning and tail truncation. Considering the strong dependency of the candidate next tokens on different prefixes, recent studies propose to adaptively truncate the tail of LLMs' predicted distribution. Although improved results have been reported with these methods on open-ended text generation tasks, the results are highly dependent on the curated parameters and the limited exemplar text. In this paper, we propose a systematic way to estimate the capacity of a truncation sampling method by considering the trade-off between diversity and risk at each decoding step, based on our collected prefix tree which preserves the context of a full sentence. Our work offers a comprehensive comparison of existing truncation sampling methods and serves as a practical user guideline for their parameter selection.

View on arXivView PDF

Code Implementations(1)

This is the official implementation of our ACL 2025 Main paper "Balancing Diversity and Risk in LLM Sampling".

171PythonAug 15, 20241 years ago
acl-2025adaptive-decodingdecoding-algorithmlarge-language-models

Similar Papers

Cite this paper

@article{zhou2024balancing,
  title  = {Balancing Diversity and Risk in LLM Sampling: How to Select Your Method and Parameter for Open-Ended Text Generation},
  author = {Yuxuan Zhou and Margret Keuper and Mario Fritz},
  year   = {2024},
  eprint = {2408.13586},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2408.13586v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2408.13586.svg)](https://codeofpaper.com/paper/2408.13586)

Discussion