[论文解读] Human Readable Compression of GFA Paths Using Grammar-Based Code
本文提出 SentencePiece,一种与语言无关的子词分词器和反分词器,可直接从原始文本进行训练而无需预分词,从而实现完全端到端的神经文本处理。其在神经机器翻译(NMT)性能上与传统方法相当,同时支持无损分词和快速推理,尤其适用于日语等无空格分隔的语言。
Pangenome graphs offer a compact and comprehensive representation of genomic diversity, improving tasks such as variant calling, genotyping, and other downstream analyses. Although the underlying graph structures scale sublinearly with the number of haplotypes, the widely used GFA file format suffers from rapidly growing file sizes due to the explicit and repetitive encoding of haplotype paths. In this work, we introduce an extension to the GFA format that enables efficient grammar-based compression of haplotype paths while retaining human readability. In addition, grammar-based encoding provides an efficient in-memory data structure that does not require decompression, but conversely improves the runtime of many computational tasks that involve haplotype comparisons. We present sqz, a method that makes use of the proposed format extension to encode haplotype paths using byte pair encoding, a grammar-based compression scheme. We evaluate sqz on recent human pangenome graphs from Heumos et al. and the Human Pangenome Reference Consortium (HPRC), comparing it to existing compressors bgzip, gbz, and sequitur. sqz scales sublinearly with the number of haplotypes in a pangenome graph and consistently achieves higher compression ratios than sequitur and up to 5 times better compression than bgzip in HPRC graphs and up to 10 times in the graph from Heumos et al.. When combined with bgzip, sqz matches or excels the compression ratio of gbz across all our datasets. These results demonstrate the potential of our proposed extension of the GFA format in reducing haplotype path redundancy and improving storage efficiency for pangenome graphs.
研究动机与目标
- 解决现有子词分词器需要预分词输入的局限性,从而促进端到端和多语言自然语言处理系统的发展。
- 通过使用下划线等元字符将空格和标点符号作为独立符号保留,实现无损分词。
- 支持直接从原始句子进行训练,消除对语言特定预处理工具的依赖。
- 通过避免预分词瓶颈,提升日语和韩语等非分词语言的效率和可扩展性。
- 提供自包含、可复现的模型格式,确保在不同系统间实现一致的归一化和子词分割。
提出的方法
- 使用归一化模块在分词前对 Unicode 字符进行规范化处理。
- 采用两种子词分割算法:字节对编码(BPE)和 unigram 语言模型,两者均直接在原始文本上进行训练。
- 应用基于二叉堆的 O(N log N) 算法加速 BPE 训练和分词,将时间复杂度从 O(N²) 降低。
- 显式管理词汇表到 ID 的映射,支持特殊标记如 <unk>、<s>、</s> 和 <pad>。
- 通过编码和解码函数实现文本与 ID 序列之间的直接转换,支持神经模型中的实时处理。
- 通过模型内嵌操作与 TensorFlow 和 PyTorch 集成,实现深度学习流水线中的无缝部署。
实验结果
研究问题
- RQ1是否可以在无需预分词的情况下有效实现子词分词,特别是在无空格分隔的语言中?
- RQ2与基于预分词的子词训练相比,直接从原始文本训练在神经机器翻译(NMT)性能上表现如何?
- RQ3与 subword-nmt 等现有工具相比,SentencePiece 在原始、非分词数据上的计算效率如何,特别是在处理非分词语言时?
- RQ4通过元符号转义(如用 '_' 表示空格)实现的无损分词是否能提升反分词的可靠性与可复现性?
- RQ5SentencePiece 是否能实现真正端到端、多语言的神经机器翻译系统,而无需语言特定的预处理?
主要发现
- SentencePiece 在 BLEU 分数上达到与标准子词方法相当或更优的表现:在 ja→en 任务上为 29.55 BLEU,在 en→ja 任务上为 21.62,优于词级别基线模型。
- 预分词并非性能提升的必要条件;事实上,在英日翻译任务中,预分词反而略微降低性能(20.86 BLEU vs. 无预分词时的 21.62)。
- 在原始日语文本上,SentencePiece 的训练和分词速度比 subword-nmt 快 380 倍(训练时间分别为 217.3 秒和 528.0 秒),展现出卓越的可扩展性。
- 在日语文本上,分词速度可达约 74k 条句子/秒,使实时推理成为可能。
- SentencePiece 中的 unigram 和 BPE 模型性能几乎相当,验证了两者作为可行选项的有效性。
- 通过元符号转义(如用 '_' 表示空格)实现的无损分词确保了完美可逆性,并消除了反分词过程中的歧义。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。