
理解NLP最重要的编码方式 — Byte Pair Encoding (BPE),这一篇就够了
在machine learning,尤其是NLP的算法面试时,Byte Pair Encoding (BPE) 的概念几乎成了一道必问的题,然而尴尬的是,很多人用过,却未必十分清楚它的概念(调包大法好)。 本文将由浅入深地介 …
大模型入门:手写一个 BPE 分词器,搞懂 Token 到底怎么来的
May 27, 2026 · 大模型入门:手写一个 BPE 分词器,搞懂 Token 到底怎么来的 摘要: 很多人学习大模型时,会直接从 Attention、Transformer、KV Cache 开始,但真正进入工程实践后,第一个绕不开 …
BPE(字节对编码):原理、流程与应用详解 - 博客园
Aug 24, 2025 · BPE(字节对编码):原理、流程与应用详解 BPE(Byte Pair Encoding,字节对编码)是一种子词级(Subword-level)分词算法,核心思想是通过迭代合并高频出现的字符或子词对, …
Token 化差异背后的 BPE 机制:为何单个汉字「夔」会被拆成多 …
Mar 9, 2026 · 然而,这种方法在处理未知单词和稀有单词时存在局限性。 为了解决这一问题,BPE算法应运而生。 BPE算法是一种基于子词(subword)的分词方法,能够将单词分解成更小的子词单 …
动手实现和优化BPE Tokenizer的训练——第1部分:最简单实现
Sep 7, 2025 · 我们甚至可以用Aho-Corasick (trie)算法来实现更高效的切分。 不过根据优化的Amdahl’s Law,我们在没有profile之前最好不要盲目的优化代码。 接着我们来看一 …
Byte-pair encoding - Wikipedia
In computing, byte-pair encoding (BPE), [1][2] or digram coding, [3] is an algorithm, first described in 1994 by Philip Gage, for encoding strings of text into smaller strings by creating and using a …
字节对编码分词 - Hugging Face LLM 课程 - Hugging Face 文档
字节对编码 (BPE) 最初是作为一种压缩文本的算法开发的,后来被 OpenAI 用于预训练 GPT 模型时的分词。 许多 Transformer 模型都使用它,包括 GPT、GPT-2、RoBERTa、BART 和 DeBERTa。
GitHub - karpathy/minbpe: Minimal, clean code for the Byte Pair ...
Minimal, clean code for the (byte-level) Byte Pair Encoding (BPE) algorithm commonly used in LLM tokenization. The BPE algorithm is "byte-level" because it runs on UTF-8 encoded strings.
每天5分钟搞懂大模型的分词器tokenizer(二):BPE (Byte-Pair …
Oct 25, 2024 · BPE (Byte-Pair Encoding) 字节对编码 (BPE) 最初是作为一种压缩文本的算法开发的,最早是由Philip Gage于1994年在《A New Algorithm for Data Compression》一文中提出,后来被 …
BPE Tokenizer From Scratch | Sebastian Raschka, PhD
Jan 17, 2025 · Implements byte pair encoding (BPE) tokenization from scratch: tokenizer training, GPT-style merge rules, and step-by-step Python examples.