欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 新闻 > 社会 > 【字节拥抱开源】字节豆包团队开源首发 Seed-Coder 大模型

【字节拥抱开源】字节豆包团队开源首发 Seed-Coder 大模型

2025/5/13 16:23:40 来源:https://blog.csdn.net/weixin_41446370/article/details/147847584  浏览:    关键词:【字节拥抱开源】字节豆包团队开源首发 Seed-Coder 大模型

我们非常高兴地向大家介绍 Seed-Coder,它是一个功能强大、透明、参数高效的 8B 级开源代码模型系列,包括基础变体、指导变体和推理变体。Seed-Coder 通过以下亮点促进开放代码模型的发展。

  • 以模型为中心:Seed-Coder主要利用大语言模型(LLMs)而非手工规则进行代码数据过滤,最大限度地减少了预训练数据构建中的人工工作量。
  • 透明:我们公开分享了以模型为核心的数据管道的详细见解,包括整理GitHub数据、提交数据和代码相关网络数据的方法。
  • 强大:Seed-Coder在多种编码任务中,在同等规模的开源模型中实现了最先进的性能。

在这里插入图片描述

Seed-Coder-8B-Base 模型,具备以下特征:

  • 类型:因果语言模型
  • 训练阶段:预训练
  • 数据来源:GitHub 数据、代码相关网络数据
  • 训练标记:6 万亿
  • 支持功能:代码补全、代码填充(中间填充)
  • 上下文长度:32,768

代码示例

您需要安装最新版本的 transformers accelerate

pip install -U transformers accelerate

这是一个简单的示例,展示了如何使用 Hugging Face 的 pipeline API 加载模型并执行代码生成:

import transformers
import torchmodel_id = "ByteDance-Seed/Seed-Coder-8B-Base"pipeline = transformers.pipeline("text-generation",model=model_id,model_kwargs={"torch_dtype": torch.bfloat16},device_map="auto",
)output = pipeline("def say_hello_world():", max_new_tokens=100)
print(output[0]["generated_text"])

填充中间部分(FIM)示例
Seed-Coder-8B-Base 原生支持 填充中间部分(FIM) 任务,即模型被提供一个前缀和一个后缀,并要求预测缺失的中间内容。这使得在代码填充场景中,如完成函数体或在两段代码之间插入缺失的逻辑成为可能。

import transformers
import torchmodel_id = "ByteDance-Seed/Seed-Coder-8B-Base"pipeline = transformers.pipeline("text-generation",model=model_id,model_kwargs={"torch_dtype": torch.bfloat16},device_map="auto",
)# You can concatenate a prefix, a special FIM separator token, and a suffix
prefix = "def add_numbers(a, b):\n    "
suffix = "\n    return result"# Combine prefix and suffix following the FIM format
fim_input = '<[fim-suffix]>' + suffix + '<[fim-prefix]>' + prefix + '<[fim-middle]>'output = pipeline(fim_input, max_new_tokens=512)
print(output[0]["generated_text"])

评估

Seed-Coder-8B-Base 在代码生成、代码补全和代码推理基准测试中进行了评估,在约 8B 的开源模型中实现了最先进的性能。

DeepSeek-Coder-6.7B-BaseOpenCoder-8B-BaseQwen2.5-Coder-7BSeed-Coder-8B-Base
HumanEval47.666.572.077.4
MBPP70.279.979.482.0
MultiPL-E44.761.058.867.6
cruxeval-O41.043.956.048.4

Seed-Coder-8B-Instruct 模型,具有以下特点:

  • 类型:因果语言模型
  • 训练阶段:预训练与后训练
  • 数据来源:公共数据集、合成数据
  • 上下文长度:32,768

代码示例
您需要安装最新版本的 transformers accelerate

pip install -U transformers accelerate

这是一个简单的示例,展示了如何使用 Hugging Face 的 pipeline API 加载模型并执行代码生成:

from transformers import AutoTokenizer, AutoModelForCausalLM
import torchmodel_id = "ByteDance-Seed/Seed-Coder-8B-Instruct"tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto", trust_remote_code=True)messages = [{"role": "user", "content": "Write a quick sort algorithm."},
]input_ids = tokenizer.apply_chat_template(messages,tokenize=True,return_tensors="pt",add_generation_prompt=True,  
).to(model.device)outputs = model.generate(input_ids, max_new_tokens=512)
response = tokenizer.decode(outputs[0][input_ids.shape[-1]:], skip_special_tokens=True)
print(response)

评估

Seed-Coder-8B-Instruct 在广泛的编码任务中进行了评估,包括代码生成、代码推理、代码编辑和软件工程,在约 8B 的开源模型中实现了最先进的性能。

ModelHumanEvalMBPPMHPPBigCodeBench (Full)BigCodeBench (Hard)LiveCodeBench (2410 – 2502)
CodeLlama-7B-Instruct40.954.06.721.93.43.6
DeepSeek-Coder-6.7B-Instruct74.474.920.035.510.19.6
CodeQwen1.5-7B-Chat83.577.717.639.618.93.0
Yi-Coder-9B-Chat82.382.026.738.111.517.5
Llama-3.1-8B-Instruct68.370.117.136.613.511.5
OpenCoder-8B-Instruct83.579.130.540.316.917.1
Qwen2.5-Coder-7B-Instruct88.482.026.741.018.217.3
Qwen3-8B84.877.032.851.723.023.5
Seed-Coder-8B-Instruct84.885.236.253.320.524.7

Seed-Coder-8B-Reasoning 模型,具有以下特点:

  • 类型:因果语言模型
  • 训练阶段:预训练与后训练
  • 数据来源:公共数据集
  • 上下文长度:32,768

代码示例
您需要安装最新版本的 transformers accelerate

pip install -U transformers accelerate

这是一个简单的示例,展示了如何使用 Hugging Face 的 pipeline API 加载模型并执行代码生成:

from transformers import AutoTokenizer, AutoModelForCausalLM
import torchmodel_id = "ByteDance-Seed/Seed-Coder-8B-Reasoning"tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto", trust_remote_code=True)messages = [{"role": "user", "content": "Write a quick sort algorithm."},
]input_ids = tokenizer.apply_chat_template(messages,tokenize=True,return_tensors="pt",add_generation_prompt=True,  
).to(model.device)outputs = model.generate(input_ids, max_new_tokens=16384)
response = tokenizer.decode(outputs[0][input_ids.shape[-1]:], skip_special_tokens=True)
print(response)

评估

Seed-Coder-8B-Reasoning 在竞争性编程中表现出色,表明较小的语言模型也能在复杂推理任务中胜任。我们的模型在 IOI’2024 上超越了 QwQ-32B 和 DeepSeek-R1,并在 Codeforces 竞赛中取得了与 o1-mini 相当的 ELO 评分。

在这里插入图片描述
在这里插入图片描述
有关详细的基准性能,请参阅我们的📑 技术报告.

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词