lemon-train-code
收藏资源简介:
ZEST数据集是一个多领域数据集,旨在通过领域感知的tokenization技术提升小模型在特定任务上的性能。该数据集覆盖两个核心领域:生物学(蛋白质)和计算机科学(编程语言)。在蛋白质领域,数据来源于UniRef50用于预训练(Masked Profile Modeling),Pfam用于构建包含32K结构基序的ZEST tokenizer词汇表,以及SCOPe 2.08和CATH S20 v4.4用于评估蛋白质远程同源性任务(指标包括mAP、fold AUC、top-k recall)。在代码领域,数据来源于CodeSearchNet(包含6种编程语言)用于预训练(Masked Language Modeling),并利用tree-sitter挖掘32K语法模式构建ZEST-Code tokenizer词汇表,评估基准包括POJ-104(用于代码克隆检测,指标为MAP@R)和Devign(用于代码缺陷检测,指标为准确率)。该数据集支持的任务包括蛋白质序列的远程同源性检测、代码克隆检测和代码缺陷检测。其核心创新在于通过注入领域归纳偏见到tokenizer级别,使得小模型(如70M参数)能够匹配或超越大模型基线(如3B参数),实现高达43倍的参数减少,并具备可测量的信息论优势(ZEST token携带的任务相关比特是标准BPE的1.7倍)。
The ZEST dataset is a multi-domain dataset designed to enhance the performance of small models on specific tasks through domain-aware tokenization techniques. It covers two core domains: biology (proteins) and computer science (programming languages). In the protein domain, data is sourced from UniRef50 for pre-training (Masked Profile Modeling), Pfam for building a ZEST tokenizer vocabulary with 32K structural motifs, and SCOPe 2.08 and CATH S20 v4.4 for evaluating protein remote homology tasks (metrics include mAP, fold AUC, top-k recall). In the code domain, data is sourced from CodeSearchNet (including 6 programming languages) for pre-training (Masked Language Modeling), and tree-sitter is used to mine 32K syntactic patterns to construct the ZEST-Code tokenizer vocabulary. Evaluation benchmarks include POJ-104 (for code clone detection, with MAP@R metric) and Devign (for code defect detection, with accuracy metric). The dataset supports tasks such as protein remote homology detection, code clone detection, and code defect detection. Its core innovation lies in injecting domain inductive bias at the tokenizer level, enabling small models (e.g., 70M parameters) to match or exceed large model baselines (e.g., 3B parameters), achieving up to 43x parameter reduction, and providing measurable information-theoretic advantages (ZEST tokens carry 1.7x more task-related bits than standard BPE).
数据集概述
- 数据集名称:lemon-train-code
- 所属项目:ZEST(Zoned Encoding of Sequence Themes)
- 核心目标:通过在分词器层级注入归纳偏置,提升小模型在下游任务中的性能,实现与更大模型相当的效果。
关键成果
- 性能对比:仅70M参数模型使用ZEST分词后,在蛋白质远程同源性检测(折叠级别)上,与3B参数的ProtTucker/ProtT5-XL基线模型表现相当,实现43倍参数缩减。
- 信息论优势:ZEST分词每个token携带的任务相关比特数比标准BPE高出1.7倍。
评估指标:τ(T)
- 定义:τ(T) = I(T; Y) / E[tokens per sequence],其中I(T; Y)是分词词表与任务标签之间的互信息,E[tokens per sequence]是每个序列的平均token数。
- 作用:量化分词器的归纳偏置,更高的τ值表示分词更有效,模型扩展性更好。
数据集用途
该数据集与ZEST项目的代码部分相关,主要用于以下任务:
- 代码克隆检测
- 代码缺陷检测
领域与应用
1. 蛋白质(生物学)
- 分词器:ZEST,基于从Pfam挖掘的32K结构基序,采用贪心最大匹配。
- 预训练:在UniRef50上使用掩码配置文件建模(Masked Profile Modeling)。
- 微调:在CATH数据对上使用层次化对比学习。
- 基准测试:SCOPe 2.08和CATH S20 v4.4,评估指标包括mAP、折叠AUC、top-k召回率。
2. 代码(编程语言)
- 分词器:ZEST-Code,基于通过tree-sitter挖掘的32K语法模式,采用贪心最大匹配。
- 预训练:在CodeSearchNet(6种编程语言)上使用掩码语言建模(Masked Language Modeling)。
- 基准测试:POJ-104(MAP@R)和Devign(准确率)。
模型训练策略
- 一次性预训练,多次剪枝:对每个分词器预训练一个大模型,然后使用层剪枝创建多个小规模变体。
- 剪枝示例:70M参数(16层)模型可剪枝为30M(4层)或43M(8层),每个剪枝后的模型再进行层次化微调,从单个预训练检查点生成多个扩展曲线数据点。
快速开始
- 计算τ(T):
python experiments/biology/compute_tau.py --scope-fasta data/scope40.fa --cath-fasta data/cath_s20.fa - 构建ZEST-Code分词器:
python experiments/code/build_tokenizer.py --codesearchnet-dir data/code/codesearchnet/ --output data/code/zest_code_vocab.json
许可证
MIT




