当前位置: 首页 > news >正文

【腾讯拥抱开源】KaLM-Embedding-Gemma3-12B-2511:一款基于谷歌Gemma的特征提取模型

简介

KaLM-Embedding-Gemma3-12B-2511 是一款多功能且紧凑的嵌入模型,在 MMTEB 基准测试中(截至 2025 年 11 月)实现了最先进的性能表现。

MMTEB 评估结果

Rank (Borda)ModelMean (Task)Mean (TaskType)Bitext MiningClassificationClusteringInstruction RerankingMultilabel ClassificationPair ClassificationRerankingRetrievalSTS
1KaLM-Embedding-Gemma3-12B-251172.3262.5183.7677.8855.775.4933.0384.7367.2775.6679.02
2llama-embed-nemotron-8b69.4661.0981.7273.2154.3510.8229.8683.9767.7868.6979.41
3Qwen3-Embedding-8B70.5861.6980.8974.0057.6510.0628.6686.4065.6370.8881.08
4gemini-embedding-00168.3759.5979.2871.8254.595.1829.1683.6365.5867.7179.40
5Qwen3-Embedding-4B69.4560.8679.3672.3357.1511.5626.7785.0565.0869.6080.86
6Qwen3-Embedding-0.6B64.3456.0172.2366.8352.335.0924.5980.8361.4164.6576.17
7gte-Qwen2-7B-instruct62.5155.9373.9261.5552.774.9425.4885.1365.5560.0873.98
8Linq-Embed-Mistral61.4754.1470.3462.2450.600.9424.7780.4364.3758.6974.86
9multilingual-e5-large-instruct63.2255.0880.1364.9450.75-0.4022.9180.8662.6157.1276.81
10embeddinggemma-300m61.1554.3164.4060.9051.175.6124.8281.4063.2562.4974.73

模型详情

  • 模型大小:117.6亿参数
  • 嵌入维度:3840
  • 最大输入标记数:3.2万
  • 多分辨率编码维度:3840、2048、1024、512、256、128及64
  • 池化方式:末端标记池化

使用指南

支持sentence-transformers

安装sentence-transformers库后即可便捷调用本模型:

pip install -U sentence-transformers

您可以这样使用该模型:

from sentence_transformers import SentenceTransformer
import torchmodel = SentenceTransformer("tencent/KaLM-Embedding-Gemma3-12B-2511",trust_remote_code=True,model_kwargs={"torch_dtype": torch.bfloat16,"attn_implementation": "flash_attention_2",  # Optional},
)
model.max_seq_length = 512sentences = ["This is an example sentence", "Each sentence is converted"]
prompt = "Instruct: Classifying the category of french news.\nQuery:"
embeddings = model.encode(sentences,prompt=prompt,normalize_embeddings=True,batch_size=256,show_progress_bar=True,
)
print(embeddings)
'''
[[-0.01867676  0.02319336  0.00280762 ... -0.02075195  0.00196838-0.0703125 ][-0.0067749   0.03491211  0.01434326 ... -0.0043335   0.00509644-0.04174805]]
'''

或者您可以使用 encode_queryencode_document 分别自动为查询("指令:给定一个查询,检索回答该查询的文档\n查询:")和文档("")添加默认提示。

from sentence_transformers import SentenceTransformer
import torchmodel = SentenceTransformer("tencent/KaLM-Embedding-Gemma3-12B-2511",trust_remote_code=True,model_kwargs={"torch_dtype": torch.bfloat16,"attn_implementation": "flash_attention_2",  # Optional},
)
model.max_seq_length = 512queries = ["What is the capital of China?","Explain gravity",
]
documents = ["The capital of China is Beijing.","Gravity is a force that attracts two bodies towards each other. It gives weight to physical objects and is responsible for the movement of planets around the sun.",
]query_embeddings = model.encode_query(queries)
document_embeddings = model.encode_document(documents)similarities = model.similarity(query_embeddings, document_embeddings)
print(similarities)
'''
tensor([[0.9034, 0.2563],[0.3153, 0.7396]])
'''

vllm支持说明

注:由于vllm仅支持Gemma3ForCausalLM模型类,不支持Gemma3TextModel,因此必须通过revision="CausalLM"指定CausalLM分支来加载模型参数。

from vllm import LLMsentences = ["This is an example sentence", "Each sentence is converted"]# Create an LLM.
# You should pass task="embed" for embedding models
model = LLM(model="tencent/KaLM-Embedding-Gemma3-12B-2511",task="embed",enforce_eager=True,revision="CausalLM",  # specify the CausalLM branch for Gemma3ForCausalLM config
)outputs = model.embed(sentences)
embeddings = [output.outputs.embedding for output in outputs]

引用

如果您觉得这个模型有用,请考虑给予星标和引用。

@misc{zhao2025kalmembeddingv2,title={KaLM-Embedding-V2: Superior Training Techniques and Data Inspire A Versatile Embedding Model}, author={Xinping Zhao and Xinshuo Hu and Zifei Shan and Shouzheng Huang and Yao Zhou and Xin Zhang and Zetian Sun and Zhenyu Liu and Dongfang Li and Xinyuan Wei and Youcheng Pan and Yang Xiang and Meishan Zhang and Haofen Wang and Jun Yu and Baotian Hu and Min Zhang},year={2025},eprint={2506.20923},archivePrefix={arXiv},primaryClass={cs.CL},url={https://arxiv.org/abs/2506.20923}, 
}@misc{hu2025kalmembedding,title={KaLM-Embedding: Superior Training Data Brings A Stronger Embedding Model}, author={Xinshuo Hu and Zifei Shan and Xinping Zhao and Zetian Sun and Zhenyu Liu and Dongfang Li and Shaolin Ye and Xinyuan Wei and Qian Chen and Baotian Hu and Haofen Wang and Jun Yu and Min Zhang},year={2025},eprint={2501.01028},archivePrefix={arXiv},primaryClass={cs.CL},url={https://arxiv.org/abs/2501.01028}, 
}
http://www.dtcms.com/a/573465.html

相关文章:

  • 南阳seo网站建设费用学ps有用还是网页制作
  • 疫苗最新官方消息优化大师有必要安装吗
  • 新闻速递丨Altair RapidMiner 数据分析和 AI 平台助力企业加速智能升级:扩展智能体 AI 及分析生态系统
  • C# ZipArchive 加压解压zip文件
  • 律师怎么做网站只做正品的购物网站
  • 珠宝网站策划挂别人公司做网站可以吗
  • Nine.fun全球KOL合作计划|以现实娱乐为舞台,构建Web3文化共创生态
  • 面向 Spring Boot 的 JVM 深度解析
  • SCRM工具测评:助力企业微信私域运营的核心功能解析
  • Web3.js 全面解析
  • 企业微信AI聊天agent:优化企业微信客户运营的推荐工具
  • 怎么做文化传播公司网站wordpress免费企业
  • springboot+vue3+redis+sse 后端主动推送数据
  • 潍坊网站优化培训四川在线
  • Azure AI服务成本分析指南
  • OceanBase数据库SQL调优
  • ④使用 PPTSYNC.exe 与华为手机拍照制作 GIF 动画
  • OceanBase all-in-one 4.2.0.0 安装教程(CentOS 7/EL7 一键部署详细步骤)​
  • 环保网站建设方案wordpress前端后端
  • 如何给网站备案山东网站搭建有限公司
  • veereal将在中国推广微型led技术
  • 对话 NuttX 创始人Gregory Nutt——openvela 与 NuttX 的 “双向奔赴” 新范式
  • 河北省地图谷歌seo网站优化
  • 湘潭知名网站建设网站静态页面生成
  • 从EMS看分布式能源发展:挑战与机遇并存
  • Java接入飞书发送通知消息
  • Vue.js 基础教程:从入门到实践
  • .net实现秒杀商品(Redis高并发)
  • 解决phpstudy 8.x软件中php8.2.9没有redis扩展的问题
  • 【MCP系列】飞书MCP使用