huggingface / huggingface/tokenizers

Allow users to select/write encoding strategies

Open
#1,655 2 comments 0 reactions 0 assignees View on GitHub
Feature Request
Dominant language
Rust
Stars
11k
Forks
1.2k
Avg merge
3d 8h
Merged PRs (30d)
26

Description

Hi there,

**Do you plan to add the possibility to control how tokenizers behave at inference time?**

For example, adding the possibility for the user to decide whether to use standard BPE (merges) or, e.g., the longest prefix encoding strategy. See [Greed is All You Need: An Evaluation of Tokenizer Inference Methods](https://aclanthology.org/2024.acl-short.73.pdf) for why this can be useful.

Thanks in advance for your time!

Best,
Pietro

----

**Example.** Consider a BPE tokenizer with merges `M = {yu, yum, my}` and initial alphabet `A = {y, u, m}`. Given the string `s = yummy`, the standard BPE merge-based strategy tokenizes `s` as `yu | m | my` while BPE with the longest prefix encoding strategy tokenizes `s` as `yum | my`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.