Tagged articles
3 articles
Page 1 of 1
AI Algorithm Path
AI Algorithm Path
Jun 28, 2025 · Artificial Intelligence

Implementing Greedy and Beam Decoding for Large Language Models from Scratch

This article walks through the mechanics of greedy search and beam search in large language models, demonstrates both methods with GPT‑2 on the prompt "I have a dream", visualizes the decoding trees, compares their scores, and discusses the trade‑offs between efficiency and output quality.

Beam SearchGPT-2Greedy Search
0 likes · 16 min read
Implementing Greedy and Beam Decoding for Large Language Models from Scratch
Architect
Architect
Jul 1, 2023 · Artificial Intelligence

Comprehensive Guide to Text Generation Decoding Strategies with HuggingFace Transformers

This tutorial explores various text generation decoding methods—including greedy search, beam search, top‑k/top‑p sampling, sample‑and‑rank, and group beam search—explaining their principles, providing detailed Python code examples, and comparing their use in modern large language models.

Beam SearchGreedy SearchSampling
0 likes · 59 min read
Comprehensive Guide to Text Generation Decoding Strategies with HuggingFace Transformers
Tencent Cloud Developer
Tencent Cloud Developer
Jun 1, 2023 · Artificial Intelligence

A Comprehensive Guide to Decoding Strategies for Text Generation with HuggingFace Transformers

This guide thoroughly explains the major decoding strategies for neural text generation in HuggingFace Transformers—including greedy, beam, diverse beam, sampling, top‑k, top‑p, sample‑and‑rank, beam sampling, and group beam search—detailing their principles, Python implementations with LogitsProcessor components, workflow diagrams, comparative analysis, and references to original research.

Beam SearchSamplingText Generation
0 likes · 60 min read
A Comprehensive Guide to Decoding Strategies for Text Generation with HuggingFace Transformers