跳到主内容
@wquguru
精选88r/Rag(Reddit)模型发布/更新

Papr发布papr-embed开源代码检索嵌入模型

Introducing papr-embed: schema-native embeddings, and open-weights embeddings for code retrieval

原文
发到 X
推荐理由

针对代码检索场景的新锐开源模型,在主流基准上展现出优于更大规模竞品的效率,适合需要垂直领域向量检索的工程团队参考选型。

Introducing papr-embed: schema-native embeddings, and open-weights embeddings for code retrieval

介绍 papr-embed:原生模式的嵌入向量,以及用于代码检索的开放权重嵌入模型

Today we're releasing two embedding model series, code-1 with open weights under Apache-2.0:

今天我们发布了两款嵌入模型系列,其中 code-1 采用 Apache-2.0 许可证开放权重:

  • papr-embed-code-1 (4B and 0.6B). Retrieval models for code and text. The 4B scores 80.12 on CoIR and is #1 on the MTEB leaderboard for both CoIR and SciFact (as of Oct 26, 2026), ahead of F2LLM-v2-14B (79.94) on CoIR at under a third of its size. It also has the highest average on MTEB's 12-task Code benchmark (81.13). It is not the best model on RTEB Code, which tests held-out code retrieval; see "Beyond CoIR". CoIR and SciFact are in-domain for us, since we trained on their train splits, and the leaderboard marks that in its zero-shot column; details below.
  • papr-embed-schema-1 (4B and 0.6B). Schema-native embeddings: you describe what matters in your domain as a schema, and the vector carries it as explicit, inspectable dimensions on top of the base embedding.
  • papr-embed-code-1(4B 和 0.6B)。面向代码和文本的检索模型。该 4B 模型在 CoIR 上得分 80.12,并在 MTEB 排行榜的 CoIR 和 SciFact 榜单中均位列第一(截至 2026 年 10 月 26 日),优于 F2LLM-v2-14B(79.94),且其参数量不到后者的三分之一。它在 MTEB 的 12 项任务 Code 基准测试中也取得了最高的平均分(81.13)。它在 RTEB Code 上并非最佳模型,RTEB Code 测试的是保留代码的检索能力;详见“超越 CoIR”。CoIR 和 SciFact 属于我们的领域内数据,因为我们在它们的训练集上进行了训练,且排行榜在其零样本列中标注了这一点;详情见下文。
  • papr-embed-schema-1(4B 和 0.6B)。原生模式嵌入:你可以将领域中重要的内容描述为模式(schema),向量会在基础嵌入之上将其作为显式、可检查的维度承载。

Both are available through the Papr API, and papr-embed-code-1 is on Hugging Face. Every code-1 number in this post can be reproduced with the replicate_mteb.py script that ships in each model repo.

两者均可通过 Papr API 使用,papr-embed-code-1 已上线 Hugging Face。本文中的每个 code-1 数值均可通过每个模型仓库附带的 replicate_mteb.py 脚本复现。

papr-embed-code-1: code retrieval

papr-embed-code-1:代码检索

nDCG@10 averaged over the 10 CoIR tasks, stock mteb, fp32. Max length 8192, except the five tasks whose corpora have documents over 8k tokens, which we ran at 32,768 (see the per-task table):

在 10 个 CoIR 任务上的平均 nDCG@10,使用标准 mteb,fp32 精度。最大长度设为 8192,但对于语料库中包含超过 8k token 文档的五项任务,我们将其设置为 32,768(详见各任务表格):

ModelParamsCoIR (10 tasks)
papr-embed-code-1-4b4B80.12
F2LLM-v2-14B14B79.94*
Qwen3-Embedding-4B (base)4B78.87
papr-embed-code-1-0.6b0.6B77.16
F2LLM-v2-0.6B0.6B77.66*
Qwen3-Embedding-0.6B (base)0.6B74.67
模型参数量CoIR(10 项任务)
papr-embed-code-1-4b4B80.12
F2LLM-v2-14B14B79.94*
Qwen3-Embedding-4B (base)4B78.87
papr-embed-code-1-0.6b0.6B77.16
F2LLM-v2-0.6B0.6B77.66*
Qwen3-Embedding-0.6B (base)0.6B74.67

* From F2LLM's submission in the MTEB results repo (mteb 2.6.7), not rerun by us. Scores from older mteb versions don't always reproduce: stock Qwen3-Embedding-4B's listed SyntheticText2SQL is 78.21; under our protocol we get 72.52. Base rows are our own runs with the same protocol, prompts and batch settings as the papr rows.

* 来自 F2LLM 在 MTEB 结果仓库(mteb 2.6.7)中的提交,非我们复现的结果。不同版本的 mteb 得分并不总能复现:标准 Qwen3-Embedding-4B 列出的 SyntheticText2SQL 得分为 78.21;在我们的协议下得分为 72.52。Base 行是我们使用与 papr 行相同的协议、提示词和批处理设置自行运行的结果。

  • The 4B is ahead of a model 3.5× its size, by a small margin. 80.12 vs 79.94 for F2LLM-v2-14B. That 0.18 is smaller than run-to-run movement on one task (SyntheticText2SQL, below), so read it as "level with a 14B model", not as a clear win. The whole lead comes from that task: we score 72.27 on SyntheticText2SQL against F2LLM-v2-14B's 64.12, and on the other nine tasks F2LLM-v2-14B is ahead, 81.7 to 81.0. It is +1.25 over the Qwen3-Embedding-4B it starts from (78.87), and +1.41 on the nine tasks other than SyntheticText2SQL (80.99 vs 79.58); on SyntheticText2SQL itself it is level with the base (72.27 vs 72.52).
  • The 0.6B is 0.50 behind F2LLM-v2-0.6B (77.16 vs 77.66). Its weakest task is Apps (79.31; the 4B gets 92.56). It is +2.49 over Qwen3-Embedding-0.6B (74.67), and +2.61 on the nine tasks other than SyntheticText2SQL, and runs on a single consumer GPU.
  • How we ran it. Batch size 32 wherever the task fits in 80 GB in fp32. Five tasks have documents over 8k tokens; we ran those at 32,768 context and batch 4. Only SyntheticText2SQL moves with batch size: its corpus has near-identical SQL answers, so the top hit comes down to floating-point ties, and the same weights have scored 65–72 across setups. For scale, stock Qwen3-Embedding-4B scores 72.52 on it in our runs, against 78.21 on its leaderboard entry from an older mteb. The full protocol, including every change and when we made it, ships with the weights as PROTOCOL.md.
  • 4B 模型以微弱优势领先于其体积 3.5 倍的模型。在 F2LLM-v2-14B 上,得分为 80.12 对 79.94。这 0.18 的差距小于单次运行中单个任务(SyntheticText2SQL,见下文)的波动范围,因此应将其解读为“与 14B 模型持平”,而非明显的胜利。这一领先优势完全来自该任务:我们在 SyntheticText2SQL 上得分为 72.27,而 F2LLM-v2-14B 为 64.12;在其他九个任务上,F2LLM-v2-14B 领先,得分为 81.7 对 81.0。相比其起始模型 Qwen3-Embedding-4B(78.87),它提升了 +1.25;在除 SyntheticText2SQL 之外的九个任务上提升了 +1.41(80.99 对 79.58);而在 SyntheticText2SQL 本身的任务上,它与基础模型持平(72.27 对 72.52)。
  • 0.6B 模型落后于 F2LLM-v2-0.6B 0.50 分(77.16 对 77.66)。其最弱的任务是 Apps(79.31;4B 模型在此任务上得分为 92.56)。相比 Qwen3-Embedding-0.6B(74.67),它提升了 +2.49;在除 SyntheticText2SQL 之外的九个任务上提升了 +2.61,并且可在单张消费级 GPU 上运行。
  • 我们的运行方式。只要任务能在 fp32 精度下放入 80 GB 显存,批量大小(batch size)均设为 32。有五个任务的文档超过 8k token;我们针对这些任务使用 32,768 的上下文长度和 4 的批量大小进行运行。只有 SyntheticText2SQL 随批量大小变化:其语料库中的 SQL 答案几乎完全相同,因此最高命中取决于浮点数平局,且相同的权重在不同设置下的得分在 65–72 之间浮动。作为参考,在我们的运行中,标准版 Qwen3-Embedding-4B 在该任务上的得分为 72.52,而其旧版 mteb 排行榜条目得分为 78.21。完整的协议,包括每一项更改及其发生时间,随权重一起发布为 PROTOCOL.md。

Per-task results:

各任务结果:

CoIR task (nDCG@10)code-1-4bcode-1-0.6bBatch
Apps92.5679.314, 32k
CodeSearchNet89.8486.184, 32k
CodeFeedback-MT95.6494.214, 32k
CodeFeedback-ST90.1088.5216
CodeSearchNet-CC95.6091.914, 32k
CodeTransOcean-Contest93.0290.9332
CodeTransOcean-DL35.1434.4732
CosQA40.2940.4232
StackOverflowQA96.7293.574, 32k
SyntheticText2SQL72.2772.0432
Mean80.1277.16
CoIR 任务 (nDCG@10)code-1-4bcode-1-0.6bBatch
Apps92.5679.314, 32k
CodeSearchNet89.8486.184, 32k
CodeFeedback-MT95.6494.214, 32k
CodeFeedback-ST90.1088.5216
CodeSearchNet-CC95.6091.914, 32k
CodeTransOcean-Contest93.0290.9332
CodeTransOcean-DL35.1434.4732
CosQA40.2940.4232
StackOverflowQA96.7293.574, 32k
SyntheticText2SQL72.2772.0432
Mean80.1277.16

What we trained on. We want the numbers read correctly:

我们的训练数据。我们希望这些数据能被正确解读:

  • No test split was used, anywhere. Only train splits entered training.
  • CoIR (10 tasks): the 4B trained on the train splits of 8 of the 10, and the 0.6B on all 10. That is why MTEB lists the 4B as 20% zero-shot on CoIR (2 of 10 tasks never seen: CodeFeedback-ST and CodeTransOcean-Contest) and the 0.6B as 0%.
  • SciFact: both models also trained on the SciFact train split. We evaluate on the official test split, so SciFact is an in-domain result, not a zero-shot one.
  • Code (MTEB v1) adds two more: both models also trained on lightonai/CodeEditSearchTrain, so CodeEditSearch is in-domain, and MTEB's CodeSearchNet shares its source with CoIR's CodeSearchNet, whose train split we used. We declare both. That makes the 4B 16% zero-shot on Code (v1) and the 0.6B 0%. Of RTEB (Code)'s seven public tasks (below), only Apps was in our training data; DS1000, HumanEval, MBPP, WikiSQL, FreshStack and SWEbench were not.
  • The leaderboard declares all of this in each model's training_datasets.
  • To check generalization, we also report retrieval tasks we never trained on, compared with the base Qwen3 models under identical settings:
  • 未在任何地方使用测试集(test split)。仅训练集(train splits)进入训练。
  • CoIR(10 个任务):4B 模型在 10 个任务中的 8 个的训练集上进行了训练,而 0.6B 模型在所有 10 个任务上进行了训练。这就是为什么 MTEB 将 4B 列为在 CoIR 上有 20% 零样本(zero-shot)比例(2 个任务从未见过:CodeFeedback-ST 和 CodeTransOcean-Contest),而 0.6B 为 0%。
  • SciFact:两个模型也在 SciFact 训练集上进行了训练。我们在官方测试集上进行评估,因此 SciFact 是域内(in-domain)结果,而非零样本结果。
  • Code (MTEB v1) 增加了两项:两个模型均在 lightonai/CodeEditSearchTrain 上训练过,因此 CodeEditSearch 属于域内数据;MTEB 的 CodeSearchNet 与 CoIR 的 CodeSearchNet 共享同一来源,我们使用了后者的训练集。我们声明了这两点。这使得 4B 模型在 Code (v1) 上的零样本得分为 16%,而 0.6B 模型为 0%。在 RTEB (Code) 的七个公开任务(见下文)中,只有 Apps 在我们的训练数据中;DS1000、HumanEval、MBPP、WikiSQL、FreshStack 和 SWEbench 均未包含在内。
  • 排行榜在每个模型的 training_datasets 字段中声明了所有这些信息。
  • 为了检查泛化能力,我们还报告了我们从未训练过的检索任务的结果,并与相同设置下的基础 Qwen3 模型进行对比:
Held-out (nDCG@10)papr-embed-code-1-4bQwen3-Emb-4Bpapr-embed-code-1-0.6bQwen3-Emb-0.6B
ArguAna72.5475.0566.4869.34
NFCorpus42.0941.0237.5536.32
SciDocs28.7431.6124.0324.39
FiQA201860.0162.1447.7647.25
TREC-COVID87.0493.0082.7089.30

Gains on code don't come free everywhere. On non-code retrieval both models are flat to worse than their base: they gain about 1 on NFCorpus, lose 2–3 on ArguAna, SciDocs and FiQA (4B), and drop 6 on TREC-COVID. If your workload is mostly prose, use the base Qwen3 model; these are code models.

代码领域的提升并非处处免费。在非代码检索方面,两个模型的表现持平或劣于其基础模型:它们在 NFCorpus 上提升了约 1 分,在 ArguAna、SciDocs 和 FiQA(4B 模型)上损失了 2–3 分,并在 TREC-COVID 上下降了 6 分。如果你的工作负载主要是散文文本,请使用基础 Qwen3 模型;这些是代码模型。

SciFact (scientific claim retrieval, official MTEB test split, nDCG@10):

SciFact(科学主张检索,官方 MTEB 测试集,nDCG@10):

ModelSciFactQwen3-Embedding baseGain
papr-embed-code-1-4b86.7978.33+8.46
papr-embed-code-1-0.6b82.4269.72+12.70

Both trained on the SciFact train split only; the test split was never used. Read these as in-domain results. They show what targeted training can do, not zero-shot ability.

两者仅在 SciFact 训练集上训练过;测试集从未使用过。请将这些结果视为域内结果。它们展示了针对性训练的效果,而非零样本能力。

Beyond CoIR: the rest of MTEB's code benchmarks

超越 CoIR:MTEB 其余的代码基准测试

CoIR is 10 of the 12 tasks in MTEB's Code (v1) benchmark. We also ran every open task in Code (v1) and in RTEB (Code), MTEB's held-out code benchmark, and submitted all of them, not a selection. nDCG@10, mteb 2.26, fp32:

CoIR 仅占 MTEB Code (v1) 基准测试中 12 项任务的 10 项。我们还运行了 Code (v1) 和 RTEB (Code)(MTEB 的保留代码基准测试)中的所有开放任务,并提交了全部结果,而非选择性提交。nDCG@10,mteb 2.26,fp32:

Taskcode-1-4bcode-1-0.6bQwen3-Emb-4B / 0.6B (our earlier runs)
CodeEditSearch (in-domain)80.0766.6276.21 / 64.25
CodeSearchNet (near-domain)92.3490.9692.26 / 90.77
DS100067.8863.82Not evaluated
FreshStack46.9638.65Not evaluated
HumanEval99.1797.48Not evaluated
MBPP93.5790.80Not evaluated
WikiSQL91.7996.08Not evaluated
SWEbench (32k context)7.895.26Not evaluated
  • Code (v1), 12 tasks: the 4B averages 81.12, ahead of F2LLM-v2-14B and C2LLM-7B (both 80.75); the 0.6B averages 77.43. We lead on the average without winning any single task: our best per-task ranks are 4th on CodeFeedback-MT and 4th on CoIR's CodeSearchNet, and our weakest is CodeTransOcean-DL (27th).
  • RTEB (Code) is not a win for us. On the six public tasks that most models have scores for (Apps, DS1000, HumanEval, MBPP, WikiSQL, FreshStack; Apps is in-domain for us), the 4B averages 81.99. The leaders are around 86: voyage-4-large (86.15), Nemotron-3-Embed-8B (86.00) and Octen-Embedding-8B (85.56). Our weak spots are WikiSQL (91.79; the best model scores 99.50) and FreshStack (46.96 vs 57.76), plus DS1000. The 0.6B beats the 4B on WikiSQL (96.08 vs 91.79), which says our text-to-SQL training didn't scale with size. RTEB's two private tasks, Code1 and JapaneseCode1, have been requested from the MTEB maintainers.
  • Code(v1),共 12 项任务:4B 模型平均得分为 81.12,领先于 F2LLM-v2-14B 和 C2LLM-7B(两者均为 80.75);0.6B 模型平均得分为 77.43。我们在平均排名上领先,但未在任何单项任务中夺冠:我们在各单项任务中的最佳排名为 CodeFeedback-MT 第 4 名、CoIR 的 CodeSearchNet 第 4 名,最弱的是 CodeTransOcean-DL(第 27 名)。
  • RTEB(Code)并非我们的胜利。在大多数模型均有分数的六项公开任务(Apps、DS1000、HumanEval、MBPP、WikiSQL、FreshStack;其中 Apps 属于我们的领域内任务)中,4B 模型平均得分为 81.99。领先者得分约为 86:voyage-4-large(86.15)、Nemotron-3-Embed-8B(86.00)和 Octen-Embedding-8B(85.56)。我们的薄弱环节是 WikiSQL(91.79;最佳模型得分为 99.50)和 FreshStack(46.96 vs 57.76),以及 DS1000。0.6B 模型在 WikiSQL 上优于 4B 模型(96.08 vs 91.79),这表明我们的文本到 SQL 训练未能随规模扩大而提升。RTEB 的两项私有任务 Code1 和 JapaneseCode1 已向 MTEB 维护者提出申请。

更进一步:量化金融体系

看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力

进入量化体系 →

相似阅读

关联信息,但可能不是同一事件