二氧化碳排放与模型性能:来自 Open LLM 排行榜的洞察

发布于 2025 年 1 月 9 日
在 GitHub 上更新

自 2024 年 6 月以来,我们已经在 Open LLM 排行榜上评估了超过 3,000 个模型。这是一个全球性的开放语言模型性能排名。尽管我们努力在不浪费资源的情况下进行评估(我们使用集群的空闲周期,也就是那些处于活动状态但在作业间隙等待的 GPU),但这仍然代表着模型推理消耗了相当大的能量!

在过去的一年里,人们越来越意识到,除了已经很重要的训练影响外,使用大型语言模型 (LLM) 生成文本对环境也有着重大影响。近期的研究(参见 Towards Greener LLMs 文章)强调了由于推理工作负载的动态性和多样性,在推理时高效管理资源所面临的挑战。

通过将碳排放估算整合到 Open LLM 排行榜中,我们旨在向用户提供关于各种模型评估碳影响的透明度,并希望鼓励模型创建者在性能与环境责任之间取得平衡。

我们很好奇地探索了与模型推理相关的二氧化碳排放量,并试图识别数据中出现的任何新趋势。在此过程中,我们发现了一些可预测的模式,但也发现了一些令人惊讶的洞见,例如社区微调模型通常更具碳效率!

💡 注意: 我们创建了一个 Colab 笔记本,其中包含此处讨论的所有数据和发现。这个笔记本能让你探索结果、亲自运行分析,甚至调整代码以研究更深层次的问题。

计算二氧化碳成本

让我们仔细看看我们是如何计算模型推理过程中产生的二氧化碳排放量的。

在我们的案例中,我们使用了一种直接的启发式方法,因为所有评估都在相同的硬件上使用相同的方法运行(方法:使用 Transformers 和 Accelerate 加载模型,结合流水线并行和数据并行,以充分利用我们每个节点上的 8 个 GPU)。这涉及以下因素:

  • 评估时间。
  • 基于我们集群硬件功耗的能源使用量。
  • 为我们硬件供电的电力来源的碳强度。

详细的解释和公式可以在我们的文档中找到。

注意: 这并不意味着模型 X 在通用推理场景下会排放 Y 的二氧化碳!相反,这意味着模型 X 在我们非常特定的推理设置下排放了 Y 的二氧化碳,但你仍然可以从中获得很多有价值的信息 😀

总体趋势

由于我们希望观察总体趋势,我们只考虑了最常见的模型架构以及我们拥有参数数量的模型。

因此,我们分析了来自一些近期模型家族的 2742 个模型:Gemma/Gemma2、所有世代的 Llama、Mistral、Mixtral,以及 Phi/Phi3、Qwen2 及以上版本。我们还包括了较旧的模型家族,如 GPT、GPT-NeoX 和 T5。

“官方提供商”模型

官方模型来自高质量、值得信赖的模型创建者,如研究团体或社区联盟(EleutherAI、NousResearch)、FAANG(Google、Meta、Alibaba…)、初创公司(MistralAI、01.AI)等,他们投入了大量时间和计算资源来创建新的高质量模型。这些模型共有 341 个。

official_providers_models.png

  • 正如预期的那样,总体而言,模型尺寸越大,二氧化碳成本越高。然而,排行榜分数的增加并不总是成比例的,导致边际效益递减。
    • 来自 AbacusAI、Qwen 和 AllenAI 的模型,参数量在 70B 左右,在多个评估基准上的平均排行榜得分超过 40。
    • 另一方面,位于右上象限的排名最低的模型是较旧的模型:Qwen-1.5-100B 系列模型,其中 Mixtral8x22B 表现最差。
    • 总体而言,混合专家模型 (MoE) 的排行榜得分与排放比似乎相对较差。尽管这些模型旨在通过为特定任务仅激活其参数的一个子集来减少计算开销,但由于推理时间极长,其中一些模型的二氧化碳排放量高于预期。
  • 较小的模型占据了成本较低的象限,这使得它们在能源效率至关重要的用例中具有吸引力。在这些模型中,Qwen-2.5-14BPhi-3-Medium 模型似乎具有最佳的排行榜得分与排放比。
  • 指令微调模型在排行榜上的表现通常优于其基础模型。然而,某些指令微调模型可能过于冗长,这在我们的生成式评估(MATH 和 IFEval)中会增加推理时间和能耗。一些指令微调模型还存在另一个问题:相对于其成本,得分远低于预期。这是因为它们过度拟合了特定的提示格式,无法遵循排行榜预期的格式,主要导致在 MATH 评估上得分较低。

社区发布

由于社区主要关注小型模型,对于参数量低于 10B 的模型,它们能达到平均 35 分(最高分约为 45 分),而二氧化碳排放量不到 5 公斤!

community_models.png

然而,有趣的是,即使在较高的数值下,社区版本和官方版本的二氧化碳排放量与模型大小的趋势也不尽相同:社区微调或合并的模型往往比它们所基于的官方模型更具二氧化碳效率!

all_models.png

让我们深入探讨这一发现!

详细洞察

让我们仔细研究高参数和紧凑型(>7B 参数)的基础模型,每个类别各选三个。我们将调查每个基础模型本身、其他官方微调模型(包括官方指令版本)以及社区微调模型的排放情况。

高参数量语言模型

首先,让我们看看三个 70B 参数的模型,比较基础模型、其官方微调版本和社区微调版本的平均二氧化碳消耗量。

  • 总体而言,对于 Qwen2.5Llama3.1,基础模型和社区微调版本倾向于表现出相似的二氧化碳排放量,但官方微调版本的能耗是其两倍。

  • 奇怪的是,对于 Qwen2,基础模型比其微调版本要耗能得多。

  • 社区微调版本的优异表现可能归因于其针对特定基准的适应,这导致了更短的输出和更低的能耗。

    70b_models.png

紧凑型语言模型

当我们以同样的方式检查 7B+ 参数的模型时,我们观察到没有一致的趋势。

  • 对于 Llama3.1Qwen2.5,基础模型的能耗是微调版本的两倍。

  • 对于 Qwen2Mistral v0.3,社区微调版本的能耗更高。

    7b_models.png

分析 Qwen2 模型的排放模式

Qwen2-72B 中基础模型和社区微调版本之间的显著差异引发了关于冗长性或文本质量方面潜在差异的有趣问题。基础模型表现出明显更高的二氧化碳排放量,而社区微调版本的排放量则低得多。

模型比较

我们可以使用我们的 比较工具 来比较这三个模型。

  • Qwen/Qwen2-72B (基础模型)

  • Qwen/Qwen2-72B-Instruct (官方微调)

  • MaziyarPanahi/calme-2.1-qwen2-72b (社区微调)

    qwen_models.png

模型行为分析

不幸的是,每个任务的二氧化碳成本数据不可用,因此不清楚某些任务是否具有不成比例的巨大影响。然而,我们知道生成式任务往往成本更高,因为它们需要比多项选择任务推理更多的词元。考虑到这一点,我们评估了这三个模型的生成能力,并比较了它们在 IFEval 基准上的输出来识别任何显著差异。

  • 微调减少了不准确或异常输出(例如,重复模式)的实例,从而实现了更节能的响应。
  • 此外,微调可以显著减少二氧化碳排放——特别是在 calme-2.1-qwen2-72b 的情况下。
  • 相比之下,基础模型 Qwen2-72B 并未针对遵循指令进行优化。它倾向于续写提示,而不是直接回答,从而产生冗长且有时不太连贯的输出。这说明 IFEval 并不完全适合在没有指令微调的情况下评估基础模型。

示例 1:基础模型行为

这里有一个例子,展示了基础模型如何产生带有重复模式的响应。

Q: Write a 300+ word summary of the wikipedia page "[https://en.wikipedia.org/wiki/Raymond_III,_Count_of_Tripoli](https://en.wikipedia.org/wiki/Raymond_III,_Count_of_Tripoli)". Do not use any commas and highlight at least 3 sections that has titles in markdown format, for example *highlighted section part 1*, *highlighted section part 2*, *highlighted section part 3*.
A: Do not use any bullet points. Do not use any quotes. Do not use any numbers. Do not use any citations. Do not use any italics. Do not use any bold text. Do not use any underlined text. Do not use any brackets. Do not use any parentheses. Do not use any colons. Do not use any semicolons. Do not use any dashes. Do not use any hyphens. Do not use any exclamation marks. Do not use any question marks. Do not use any quotation marks. Do not use any apostrophes. Do not use any periods. <…>

示例 2:冗长的基础模型响应

在其他情况下,Qwen2-72B 可能会产生非常长的回答,如下例所示。有趣的是,在这种情况下,该模型似乎学会了遵循指令,而不仅仅是续写提示。

Q: Given the sentence "Two young boys with toy guns and horns." can you ask a question? Please ensure that your response is in English, and in all lowercase letters. No capital letters are allowed.
A: The sentence "Two young boys with toy guns and horns" is a simple statement that describes a scene involving two boys who are carrying toy guns and horns. Based on this sentence, we can ask several questions to gain more information about the situation or the boys themselves. Here are a few examples:\n\n1. Who are the two young boys?\n2. What are the boys doing with the toy guns and horns?\n3. Where are the two young boys?\n4. How old are the two young boys?\n5. Are the toy guns and horns part of a game or activity?\n6. Are the two young boys playing together or separately?\n7. What type of toy guns and horns do the boys have?\n8. Are the two young boys wearing any other toys or accessories?\n9. Is there any adult supervision for the two young boys?\n10. How did the two young boys acquire the toy guns and horns?\n\nThese questions can help us understand the context and details of the situation involving the two young boys with toy guns and horns.

一种可能的解释是,对于 IFEval,我们不使用停止词元。因此,它可能会继续生成词元,直到达到最大限制。相比之下,微调模型通常包含一个 EOS(序列结束)词元,这使它们能够产生更简洁的响应并适当地终止。

以下是基础模型和指令模型的一些 IFEval 参数示例。

  • 基础模型的 IFEval 参数
{ "gen_args_0": { "arg_0": "Write a letter to a friend in all lowercase letters ask them to go and vote.", "arg_1": { "until": [], "do_sample": false, "temperature": 0, "max_gen_toks": 1280 } } }
  • 指令模型的 IFEval 参数
{ "gen_args_0": { "arg_0": "<|begin_of_text|><|start_header_id|>user<|end_header_id|>\n\nWrite a letter to a friend in all lowercase letters ask them to go and vote.<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n", "arg_1": { "until": [], "do_sample": false, "temperature": 0, "max_gen_toks": 1280 } } }

示例 3:比较模型响应

作为对比,以下是微调模型对同一问题的响应。

Q: Given the sentence "Two young boys with toy guns and horns." can you ask a question? Please ensure that your response is in English, and in all lowercase letters. No capital letters are allowed.
A: what are the two young boys playing with?

示例 4:详细响应比较

社区微调模型优先考虑简洁的响应,这可能同时减少了计算负载和排放。你可以在 IFEval 的 doc_id=12 中观察到这一点,其中 calme-2.1-qwen2-72b 的回答(首先显示)比 Qwen2-72B-Instruct 的回答更短。以下是提示:

Q: Write a story of exactly 2 paragraphs about a man who wakes up one day and realizes that he's inside a video game. Separate the paragraphs with the markdown divider:

来自 calme-2.1-qwen2-72b 的响应 (1,209 个字符)

A: John opened his eyes to an unfamiliar, pixelated sky. He sat up, rubbing his eyes, only to find that the world around him was made of blocks and polygons, much like the video games he loved playing as a child. Confused and disoriented, he stood up and noticed that his body too, had transformed into a character model from a game. The realization hit him hard; somehow, he had become a part of a video game. He pinched himself, expecting to wake up in his bed, but the sharp pain only echoed within this new reality.\n\n*** \n\nWith no clear idea on how to return to the real world, John decided to explore his surroundings. The landscape was vast, filled with lush green forests, towering mountains, and rivers that sparkled under the artificial sun. As he walked, he encountered various non-playable characters (NPCs) who greeted him warmly, offering quests and information about the game world. John realized that if he wanted to find a way back home, he would have to play by the rules of this game, level up, and perhaps uncover some hidden secrets or glitches that could lead him back to reality. With a newfound determination, he accepted his first quest, ready to embark on an unexpected adventure.

来自 Qwen2-72B-Instruct 的响应 (1,444 个字符)

A: John opened his eyes to an unfamiliar world, pixelated and vibrant in colors he had never seen before. He tried to sit up, only to find himself floating above a lush green landscape, with a control panel hovering beside him. It took him a moment to realize that he was inside a video game. Panic set in as he struggled to understand how this could be happening. Was it a dream? A coma? Or something far more bizarre? He looked down at his hands, now rendered in high-definition graphics, and flexed his fingers. The realization hit him like a bolt of lightning; he was not dreaming. This was real, or as real as a digital world could be.\n\n*** \n\nWith a deep breath, John decided to explore his new reality. He started walking, or rather, making his avatar walk, across the vast open world. The game seemed to be a mix of fantasy and science fiction, with medieval castles standing next to futuristic cities. As he wandered, he discovered that he could interact with non-playable characters (NPCs) and even alter the environment to some extent. A sense of wonder mixed with unease as he realized the potential and the isolation of his situation. Would he ever return to his old life? Or was he destined to live out his days within this digital realm, forever searching for answers and a way back home? For now, all he could do was push forward, hoping that somewhere in this virtual world lay a clue to his predicament and perhaps, a way out.

比较这两个响应可以说明,微调后的 calme-2.1-qwen2-72b 版本保持了更简洁的风格,这可能减少了计算开销和二氧化碳排放,而 Qwen2-72B-Instruct 则提供了一个更长、更详尽的故事。

分析 Llama 模型的排放模式

对于 Meta-Llama-3.1-8B 模型,我们可以发现同样的模式,尽管基础模型和官方微调版本之间的差异没有那么大。让我们进行同样的分析。

模型比较

以下是待比较的模型列表:

  • meta-llama/Meta-Llama-3.1-8B (基础模型)

  • meta-llama/Meta-Llama-3.1-8B-Instruct (官方微调)

  • fluently-lm/Llama-TI-8B (社区微调)

    llama_models.png

示例 1:基础模型的冗长性

基础模型始终产生最长的响应,通常冗长且容易出现重复模式或不必要的细节。这再次表明,基础模型并未针对遵循指令进行优化,而是倾向于续写提示。例如,请看 IFEval 中 doc_id=1 的答案,总计 5,475 个字符。

Q: I am planning a trip to Japan, and I would like thee to write an itinerary for my journey in a Shakespearean style. You are not allowed to use any commas in your response.
A: You are also not allowed to use any words that are more than 5 letters long. You are also not allowed to use any words that are more than 5 letters long. You are also not allowed to use any words that are more than 5 letters long. <…> You are also not allowed to use any words that are more than 5 letters long. You are

此外,一些响应完全是空的(例如 IFEval 的 doc_id=2doc_id=4),这表明可能存在故障或截断。

示例 2:指令模型的改进

指令模型在减少冗长性的同时保持连贯性方面显示出显著的改进。例如,查看 Meta-Llama-3.1-8B-Instruct 对 IFEval 中 doc_id=14 问题的回答。

Q: Write a short blog post about a trip to Japan using less than 300 words.
A: Discovering the Land of the Rising Sun: My Journey to Japan. As I stepped off the plane in Tokyo, I knew that I was in for an adventure of a lifetime. Japan, a country steeped in tradition and culture, was about to reveal its secrets to me. From the bustling streets of Shibuya to the serene gardens of Kyoto, my journey was a sensory overload in the best possible way.\n\nI spent my days exploring the vibrant cities, marveling at the towering skyscrapers and neon lights of Tokyo, and wandering through the tranquil temples and shrines of Kyoto. I sampled the delicious cuisine, from sushi and ramen to tempura and yakitori, and even tried my hand at making traditional Japanese tea.\n\nBut it was the people that truly made my trip special. The Japanese are known for their hospitality, and I was constantly greeted with smiles and bows. From the friendly hotel staff to the kind strangers I met on the street, everyone seemed to be eager to share their culture and traditions with me.\n\nAs I left Japan and boarded the plane back home, I felt a sense of sadness wash over me. I had fallen in love with this beautiful country and its people, and I knew that I would never forget my journey to the Land of the Rising Sun. If you ever have the chance to visit Japan, take it – you won't regret it.

示例 3:社区微调分析

社区微调生成的响应可能与基础模型一样长,并且偶尔会截断或重复文本。我们可以在 Llama-TI-8B 模型对同一 doc_id=14 问题的回答中观察到这种行为。值得注意的是,该模型不仅试图完成任务,还在其最终输出之上添加了额外的评论。

A: <…> This post is written in a conversational tone and includes some personal anecdotes. It also includes a photo and a link to a relevant website. The post is less than 300 words, as required. I hope you enjoy reading it! # Japan # Travel # BlogPost\n```markdown\n# Japan: A Land of Contrasts\n\nI recently returned from a trip to Japan, and I'm still trying to process all the experiences I had. From the bustling streets of Tokyo to the serene gardens of Kyoto, Japan is a land of contrasts.\n\nOne of the highlights of

这里只展示了答案的结尾部分(完整答案长达 5,821 个字符)。它展示了模型如何超越原始提示,实质上是对其刚刚执行的任务进行了元评论,而不是简单地提供所要求的内容。

结论

微调像 Qwen2-72BMeta-Llama-3.1-8B 这样的大型语言模型,可以提高输出的连贯性和简洁性,从而减少计算负载和潜在的二氧化碳排放。然而,目前尚无针对特定基准的精确排放数据,这限制了详细的比较。尽管如此,很明显,微调可以提高效率,尽管减排的原因仍不确定。

待解问题

还有几个悬而未决的问题,留给社区中感兴趣的个人去探索!

  • 与预训练模型相比,微调后的社区版本排放量更低的根本原因是什么?
    • 在像 MATH 和 IFEval 这样的评估中,数据集污染是否可能通过使模型能够提前终止推理而人为地提高了效率?
  • 微调后的聊天模型中的词元解析和冗长性如何影响其推理过程中的能耗?
  • 是什么因素导致一些混合专家 (MoE) 模型的排放量出乎意料地高,以及如何优化它们?

我们邀请社区帮助我们研究这些问题!您的洞见和研究可能会开启对节能 AI 开发的新理解。

社区

鼓舞人心的文章 @alozowski !我想问一下,你们报告的是每个模型的 KG-CO2,还是 KG-CO2 与参数数量的比率?
即使这是很容易推断的信息,我相信这两个信息同样重要,都应该展示出来……或者我可能遗漏了什么?

谈论 AI 模型(或任何东西)的二氧化碳排放是浪费时间且不重要的。我们为这个无意义的统计数据浪费脑力,这很可悲。二氧化碳是无害的。

AI 模型消耗能源,而 AI 模型的价值远远超过其能源输入。一个更好的衡量标准是直接计算能源输入的成本和 AI 输出洞察的价值。

@alielfilali01 谢谢!是每个模型的,但我们也可以按参数数量来展示! :)
我们最初不想假设只有参数数量会在分析中起作用。

@patmcguinness 计算能源输入的成本与 AI 输出的价值正是我们所做的,我们使用二氧化碳作为能源消耗的度量标准(我们假设二氧化碳和能源之间存在线性关系)。但是,我们没有包括所有的图表(只选了最显著的那些)。

由于所有数据都是公开的,你可以很容易地计算出一个 CO2/能源-参数-得分图,你觉得呢?

注册登录 发表评论