Where to cut, how deep: BPE and Unigram-LM on chemistry SMILES

Hunter Heidenreich

arXiv:2607.05691 · 2026-07-08 공개 · arXiv · PDF

language-models tokenization bpe subword-vocabulary unigram-lm smiles chemistry

Abstract

Every chemical language model reading SMILES begins with a tokenizer, yet the field has inherited byte-pair encoding (BPE) from natural language with little scrutiny. In natural language, BPE's principal alternative, Unigram-LM, is known to build structurally different vocabularies. Whether that contrast survives in chemistry was open. We report a controlled comparison of BPE and Unigram-LM over a fixed 165-token chemistry base, at the small vocabulary sizes where token embeddings are learnable, across three corpus typologies (diverse, drug-like, natural-products) and both pre-tokenization boundary policies. The two do not converge. In all 22 matched conditions they build near-disjoint subword vocabularies: cross-algorithm Jaccard overlap on the learned pieces never exceeds 0.161, and at most 0.05 once weighted toward the high-frequency pieces a model updates most. Unigram-LM also segments held-out molecules into 29-41% more tokens; the arms largely agree on where to cut but not how deeply, so BPE's segmentation is a strict coarsening of Unigram-LM's on 80-99% of molecules. The separation holds across corpus, boundary, and vocabulary size, persisting even at eight times that scale. The subword algorithm is therefore a modeling decision, not a free default. The study trains no language models.

한국어 요약

한 줄 요약

화학 SMILES 토크나이저에서 BPE와 Unigram-LM이 동일한 어휘를 생성하지 않으며, 이는 알고리즘 차이에 기인한다.

핵심 기여도

핵심 아이디어

화학 SMILES 토크나이징에서 BPE는 자연어 처리에서 유래한 기술로, Unigram-LM과는 구조적으로 다른 어휘를 생성한다는 사실이 알려져 있으나, 화학 분야에서는 명확하지 않았다. 본 연구는 OpenSMILES 기반 165-토큰 어휘를 고정하고, 다양한 데이터셋(다양한, 약물 유사, 천연물)과 토크나이징 경계 정책(예: SMILES 구문 기반)에서 BPE와 Unigram-LM을 비교함으로써 알고리즘 차이가 어휘 구조에 미치는 영향을 분리했다. 핵심 통찰은, 화학 SMILES가 작은 알파벳과 강한 구조적 제약을 가진다는 점에도 불구하고, 두 알고리즘은 여전히 근접하지 않은 어휘를 생성하며, 이는 알고리즘 차이에 기인한다는 점이다.

기술적 접근법

주요 결과

의의 및 한계

실용적 활용

화학 언어 모델 개발자들에게는 토크나이징 알고리즘 선택이 중요한 모델링 결정임을 인식시키며, BPE는 짧은 시퀀스를 제공하고 Unigram-LM은 세분화된 토큰을 제공하므로, 모델의 시퀀스 길이와 정규화 전략에 따라 선택할 수 있음. 또한, 토크나이저는 학습 데이터셋에 크게 의존하지 않아, 다른 도메인으로 전이 시에도 유사한 성능을 유지할 수 있음.