透過跨語言分詞器手術與離線蒸餾將多語言嵌入模型適應於土耳其語
Adapting Multilingual Embedding Models to Turkish via Cross-Lingual Tokenizer Surgery and Offline Distillation
May 28, 2026
作者: M. Ali Bayram, Banu Diri, Savaş Yıldırım
cs.AI
摘要
句子嵌入是语义搜索、聚类、分类及检索增强生成的基础组件。本文提出embeddingmagibu-200m,一个聚焦土耳其语的句子嵌入模型,生成768维L2归一化向量,支持8192个token的上下文窗口,远超早期基于BERT的土耳其语编码器512个token的限制。该方法无需完整预训练,而是引入高效的三阶段适配流程:(1) 构建土耳其语优化的多语言分词器,其词汇量为131,072,通过从教师模型的词汇表中剪枝冗余token,并结合基于40语言语料库频率分析的多语言token;(2) 克隆教师嵌入模型,保留Transformer骨干网络权重,通过均值组合token映射为新词汇初始化兼容的嵌入表;(3) 利用预计算的教师向量,在平衡的40语言维基百科语料库上,通过余弦相似度目标进行离线嵌入蒸馏。所得学生模型参数约2亿,在单GPU上约四小时即可完成训练(避免训练期间在线教师推理),总成本约5-20美元。实验表明,在STSbTR数据集上,皮尔逊/斯皮尔曼相关系数分别达77.55%/77.45%,超越了3亿参数的教师模型(73.84%/72.92%)。在TR-MTEB(26个任务)上平均得分63.9%,在26个模型中排名第7,以比教师少33%的参数提供了有竞争力的成本-质量权衡。为促进可重复性和下游应用,所有成果均已开源,包括模型权重、分词器文件、预计算嵌入数据集以及开源克隆和蒸馏工具。
English
Sentence embeddings are a foundational component for semantic search, clustering, classification, and retrieval-augmented generation. This paper presents embeddingmagibu-200m, a Turkish-focused sentence embedding model that produces 768-dimensional L2-normalized vectors and supports an 8,192-token context window, far exceeding the 512-token limit of earlier BERT-based Turkish encoders. Instead of full pretraining, an efficient three-stage adaptation pipeline is introduced: (1) construct a Turkish-optimized multilingual tokenizer with a 131,072 vocabulary by pruning redundant tokens from the teacher's vocabulary and incorporating multilingual tokens via frequency analysis on a 40-language corpus, (2) clone a teacher embedding model while preserving transformer backbone weights and initializing a compatible embedding table for the new vocabulary via mean-composition token mapping, and (3) perform offline embedding distillation from precomputed teacher vectors using a cosine similarity objective over a balanced 40-language Wikipedia corpus. The resulting student model contains approximately 200M parameters and trains in roughly four hours on a single GPU by avoiding online teacher inference during training, at a total cost of 5-20. Empirically, Pearson/Spearman correlations of 77.55%/77.45% are obtained on STSbTR, surpassing the 300M-parameter teacher model (73.84%/72.92%). On TR-MTEB (26 tasks), a mean score of 63.9% is achieved (7th out of 26 models), providing a competitive cost-quality trade-off with 33% fewer parameters than the teacher. To facilitate reproducibility and downstream use, all artifacts are released including model weights, tokenizer files, precomputed embedding datasets, and open-source cloning and distillation tooling.