{ "

Top-k Sampling

\n

Here we first pick the top-k tokens from the distribution of logits, and then sample from them.

\n

Here's an experiment that uses these sampling techniques.

\n": "

\u30c8\u30c3\u30d7k\u30b5\u30f3\u30d7\u30ea\u30f3\u30b0

\n

\u3053\u3053\u3067\u306f\u3001\u6700\u521d\u306b\u30ed\u30b8\u30c3\u30c8\u306e\u5206\u5e03\u304b\u3089\u4e0a\u4f4dk\u500b\u306e\u30c8\u30fc\u30af\u30f3\u3092\u9078\u629e\u3057\u3001\u6b21\u306b\u305d\u308c\u3089\u304b\u3089\u30b5\u30f3\u30d7\u30ea\u30f3\u30b0\u3057\u307e\u3059\u3002

\n

\u3053\u308c\u306f\u3001\u3053\u308c\u3089\u306e\u30b5\u30f3\u30d7\u30ea\u30f3\u30b0\u624b\u6cd5\u3092\u4f7f\u7528\u3057\u305f\u5b9f\u9a13\u3067\u3059\u3002

\n", "

Top-k Sampler

\n": "

\u30c8\u30c3\u30d7k\u30b5\u30f3\u30d7\u30e9\u30fc

\n", "

Sample from logits

\n": "

\u30ed\u30b8\u30c3\u30c8\u304b\u3089\u306e\u30b5\u30f3\u30d7\u30eb

\n", "

New logits filled with _^_0_^_; i.e. zero probability

\n": "

_^_0_^_\u65b0\u3057\u3044\u30ed\u30b8\u30c3\u30c8\u3092\u57cb\u3081\u308b\u3001\u3064\u307e\u308a\u78ba\u7387\u304c\u30bc\u30ed

\n", "

Pick the largest _^_0_^_ logits and their indices

\n": "

_^_0_^_\u6700\u5927\u306e\u30ed\u30b8\u30c3\u30c8\u3068\u305d\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u9078\u629e\u3057\u3066\u304f\u3060\u3055\u3044

\n", "

Sample from the top-k logits with the specified sampler.

\n": "

\u6307\u5b9a\u3055\u308c\u305f\u30b5\u30f3\u30d7\u30e9\u30fc\u3092\u4f7f\u7528\u3057\u3066\u3001\u4e0a\u304b\u3089k\u500b\u306e\u30ed\u30b8\u30c3\u30c8\u3092\u30b5\u30f3\u30d7\u30ea\u30f3\u30b0\u3057\u307e\u3059\u3002

\n", "

Set the values of the top-k selected indices to actual logits. Logits of other tokens remain _^_0_^_

\n": "

\u9078\u629e\u3057\u305f\u4e0a\u4f4dk\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306e\u5024\u3092\u5b9f\u969b\u306e\u30ed\u30b8\u30c3\u30c8\u306b\u8a2d\u5b9a\u3057\u307e\u3059\u3002\u4ed6\u306e\u30c8\u30fc\u30af\u30f3\u306e\u30ed\u30b8\u30c3\u30c8\u306f\u6b8b\u308a\u307e\u3059 _^_0_^_

\n", "\n

_^_2_^_ can be any sampler that takes a logits tensor as input and returns a token tensor; e.g. `TemperatureSampler'.

\n": "\n

_^_2_^_\u30ed\u30b8\u30c3\u30c4\u30c6\u30f3\u30bd\u30eb\u3092\u5165\u529b\u3068\u3057\u3066\u53d7\u3051\u53d6\u308a\u3001\u30c8\u30fc\u30af\u30f3\u30c6\u30f3\u30bd\u30eb\u3092\u8fd4\u3059\u30b5\u30f3\u30d7\u30e9\u30fc\u306a\u3089\u3069\u308c\u3067\u3082\u304b\u307e\u3044\u307e\u305b\u3093\uff08\u4f8b\uff1a`TemperatureSampler'\uff09\u3002

\n", "A PyTorch implementation of top-k sampling from language models.": "\u8a00\u8a9e\u30e2\u30c7\u30eb\u304b\u3089\u306e top-k \u30b5\u30f3\u30d7\u30ea\u30f3\u30b0\u306e PyTorch \u5b9f\u88c5\u3002", "Top-k Sampling": "\u30c8\u30c3\u30d7k\u30b5\u30f3\u30d7\u30ea\u30f3\u30b0" }