Elastic
Jina AI
模型
API
keyboard_arrow_down
Reader
把任意 URL 转成 Markdown,为大模型提供更好的事实依据。
向量模型
多模态多语言向量模型。
重排模型
让搜索相关性最大化的重排模型。
Elastic Inference Service
在 Elasticsearch 中原生运行 Jina 模型。
MCP
terminal
命令行
article
llms.txt
smart_toy
智能体
data_object
Schema
menu_book
文档
登录
login
warning
此模型已被更新的模型取代。
向量模型
Apache 2.0 许可证
open_in_new 发布博客

jina-embeddings-v2-base-code

针对代码和文档字符串(docstring)搜索优化
许可证
Apache-2.0
发布日期
calendar_month
2024-02-05
输入
abc
文本(代码)
arrow_forward
输出
more_horiz
向量
迟分 help_outline
check_circle
Yes
模型详情
参数: 137M
输入词元长度: 8K
输出维度: 768
底座模型 help_outline
open_in_new
jina-embeddings-v2-base-en
已训练语言 help_outline
1 种语言
相关模型
link
jina-embeddings-v2-base-en
可通过以下方式获取
Jina API
AWS SageMaker
微软云
Hugging Face
物理隔离
I/O 图

代码

jina-embeddings-v2-base-code

任务

向量

Pareto fronthelp_outline
CoIR
CoIR · appsretrieval
chevron_leftchevron_right
30M100M300M1B3.0B10B40506070bge-base-en-v1.5bge-m3bge-small-en-v1.5CodeRankEmbedCodeSage-baseCodeSage-largeCodeSage-large-v2CodeSage-smallCodeXEmbed-7BContrievere5-base-v2e5-mistral-7b-instructe5-small-v2granite-embedding-engli…granite-embedding-small…gte-base-en-v1.5gte-modernbert-basegte-Qwen2-1.5B-instructjina-code-embeddings-0.…jina-embeddings-v3jina-embeddings-v4modernbert-embed-baseNV-Embed-v2SFR-Embedding-2_RSFR-Embedding-Code-2B_RSFR-Embedding-Code-400M…snowflake-arctic-embed-…UniXcoderParameters (log)nDCG@10
This model
On the front
Jina AI
Other
CoIR
52.24
Parameters
161M
Rank by score
19 / 31
Pareto front
Behind it
取值分布help_outline
AUC 0.8156
语料
翻译对
文档检索
代码
0.7500.000.200.400.600.80
相关10.9%
困难负例1.5%
无关1.0%
推荐阈值
FPR 0.1 · 0.579
FPR 0.01 · 0.750
FPR 0.001 · 0.806
FPR 0.0001 · 0.839
均衡 · 0.369
AUC
0.8156
噪声上限
0.805
召回悬崖
0.204
测量样本对
119 / 11k
向量分量help_outline
-0.160.040.25
σ 0.0361 · 183k 个数值
嵌入几何help_outline
0768
各维度均值,悬停查看区间
噪声下限
0.404
有效维度
43 / 768
选择要比较的模型

概述

Jina Embeddings v2 Base Code 直面现代软件开发中的一个核心难题:如何高效浏览和理解大型代码库。对于苦于代码检索和文档查找的开发团队,该模型支持跨 30 种编程语言的自然语言搜索,彻底改变了开发者与代码交互的方式。传统代码搜索工具依赖精确的模式匹配,而该模型能理解代码背后的语义,开发者用一句平实的英文描述就能找到相关代码片段。这一能力对于维护大型遗留代码库的团队、刚接手新项目的开发者,以及希望提升代码复用和文档质量的企业尤其有价值。

方法

该模型的出色表现源自专为代码理解设计的架构。其核心是一个 1.61 亿参数的 Transformer 神经网络,在多种编程语言数据上训练,重点覆盖六大语言:Python、JavaScript、Java、PHP、Go 和 Ruby。架构的独特之处在于 8,192 词元的超长上下文窗口,可一次性处理整个函数或多个文件,同时保持对语义的把握。模型生成 768 维稠密向量,既捕捉代码的语法结构,也捕捉其语义,因此即便两段代码用不同的编程范式或语法实现同一目标,它也能识别出彼此的关联。

性能

在实际测试中,Jina Embeddings v2 Base Code 表现卓越,在 15 项关键的 CodeNetSearch 基准中有 9 项名列第一。与微软、Salesforce 等行业巨头的模型相比,它以更小的体积取得了更好的成绩。该模型在跨语言代码理解上尤为出色,能准确匹配不同编程语言中功能等价的代码片段。8,192 词元的上下文窗口在处理大型函数和复杂代码文件时价值突出,远胜通常只能处理几百词元的传统模型。它的高效还体现在体积上:未量化仅 307MB,推理迅速,同时在代码相似度和代码搜索任务中保持高准确率。

最佳实践

部署 Jina Embeddings v2 Base Code 时,请留意以下几个实际问题。该模型可与 MongoDB、Qdrant、Weaviate 等主流向量数据库无缝集成,便于搭建可扩展的代码搜索系统。为获得最佳效果,请做好代码预处理以适配 8,192 词元的上限,这一长度通常足以容纳大多数函数和类的定义。模型支持 30 种编程语言,其中 Python、JavaScript、Java、PHP、Go 和 Ruby 这六种核心语言表现最强。大规模建索引时建议采用批处理以提升效率。它对 RAG 的良好兼容性,让它在自动生成文档和代码理解任务中尤为好用;面对超大代码库时,请配套合理的分块策略。生产部署可考虑使用 AWS SageMaker 端点做托管推理,并配上合适的缓存策略来优化查询性能。
提及此模型的博客
四月 08, 2025 • 21 分钟阅读
jina-reranker-m0: Multilingual Multimodal Document Reranker
Introducing jina-reranker-m0, our new multilingual multimodal reranker for retrieving visual documents, with SOTA performance on multilingual long documents and code searching tasks.
Jina AI
Modern dot matrix text display on a dark blue background, conveying a digital feel.
九月 27, 2024 • 15 分钟阅读
Migration From Jina Embeddings v2 to v3
We collected some tips to help you migrate from Jina Embeddings v2 to v3.
Alex C-G
Scott Martens
A digital upgrade theme with "V3" and a white "2", set against a green and black binary code background, with "Upgrade" centr
四月 29, 2024 • 7 分钟阅读
Jina Embeddings and Reranker on Azure: Scalable Business-Ready AI Solutions
Jina Embeddings and Rerankers are now available on Azure Marketplace. Enterprises that prioritize privacy and security can now easily integrate Jina AI's state-of-the-art models right in their existing Azure ecosystem.
Susana Guzmán
Futuristic black background with a purple 3D grid, featuring the "Embeddings" and "Reranker" logos with a stylized "A".
三月 25, 2024 • 21 分钟阅读
Next-Level Cloud AI: Jina Embeddings and Rerankers on Amazon SageMaker
Learn to use Jina Embeddings and Reranking models in a full-stack AI application on AWS, using only components available in Amazon SageMaker and the AWS Marketplace.
Scott Martens
Saahil Ognawala
Abstract image with colorful wavy background featuring AWS, Embeddings, and Reranker logos.
二月 05, 2024 • 4 分钟阅读
Elevate Your Code Search with New Jina Code Embeddings
New 𝗷𝗶𝗻𝗮-𝗲𝗺𝗯𝗲𝗱𝗱𝗶𝗻𝗴𝘀-𝘃𝟮-𝗯𝗮𝘀𝗲-𝗰𝗼𝗱𝗲 is optimized for code & docstring search. This powerful model supports searches between English and 30 widely-used programming languages, all with 8192 context length and SOTA performance.
Jina AI
Abstract image with concentric circles in purple and green, featuring "jina" logo and repeated "code embeddings" text around
当前语言 / 主题
搜索底座
Reader
向量模型
重排模型
获取 Jina API 密钥
速率限制
关于我们
新闻
下载 Jina 徽标
open_in_new
下载 Elastic 徽标
open_in_new
API 状态
Elastic © 2026.安全条款及条件隐私管理 Cookie请勿出售或分享我的个人信息
本网站及其所有相关内容、软件、产品和服务仅供专业人士使用。不面向任何消费者,也不鼓励任何消费者使用。