sampling-strategies

Analyze token sampling strategies for controlling language model generation quality.

1|Updated Jun 4, 2026
One-click install
npx skills add https://github.com/hung-phan/ml-skills --skill sampling-strategies
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sampling-strategies
Source: https://github.com/hung-phan/ml-skills/tree/main/skills/ml-review/references/ml-architectures/sampling-strategies
Command: npx skills add https://github.com/hung-phan/ml-skills --skill sampling-strategies

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides a deep dive into the intricacies of token sampling in autoregressive language models, helping users understand and utilize various sampling strategies to achieve desired output qualities like factual accuracy, creativity, or structured data generation.

Core Features & Use Cases

  • Sampling Fundamentals: Explains the fundamental concepts behind different sampling methods such as temperature, top-k/top-p, beam search, repetition penalties, and logprobs.
  • Sampling Strategies: Offers detailed guidance on implementing different sampling strategies like greedy, beam search, top-k, top-p, min-p, typical sampling, mirostat, repetition control, and structured generation.
  • Use Case: For instance, a developer could use this Skill to fine-tune the sampling settings for a language model to produce more factual and coherent responses, or a content creator could adjust settings to enhance creative writing.

Quick Start

Review the sampling strategies section in the skill to understand how to adjust temperature and top-p parameters to improve the output quality of your model.

Frequently Asked Questions about sampling-strategies

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I control LLM output quality using token sampling strategies?

Token sampling strategies in LLMs control output quality by adjusting parameters like temperature, top-k, and top-p to balance factual accuracy and creativity. This Skill analyzes these methods to help developers and content creators achieve fine-grained generation control.

What is the difference between top-k, top-p, and min-p sampling in language models?

Top-k, top-p, and min-p are token sampling strategies that filter candidate tokens by probability thresholds. This Skill explains their fundamental mechanisms, detailing how each method truncates the token distribution to influence language model generation quality and style.

How do I fix repetitive text generation when tuning LLM parameters?

Repetitive LLM outputs are addressed by applying repetition penalties during token sampling. This Skill provides guidance on implementing repetition control and other sampling strategies to debug generation issues and produce more coherent, varied language model responses.

When should I use temperature vs beam search for structured data generation?

Temperature scaling increases randomness while beam search explores high-probability sequences, making them suited for different tasks. This Skill details when to apply each strategy to optimize language model outputs for structured data generation versus creative text.

Does typical sampling or mirostat work better for stabilizing long-form LLM outputs?

Typical sampling and mirostat are advanced strategies for stabilizing long-form LLM outputs by dynamically adjusting token probability distributions. This Skill offers detailed implementation guidance on both methods to help manage generation coherence over extended text.

What sampling parameters should I adjust to make LLM responses more factual?

To make LLM responses more factual, lower the temperature and restrict probability mass using top-p or top-k sampling. This Skill provides specific guidance on tuning these parameters to reduce randomness and enhance factual accuracy in model generation.