二氧化碳排放與模型效能:來自 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/能源-引數-得分圖,你覺得呢?

註冊登入 發表評論

© . This site is unofficial and not affiliated with Hugging Face, Inc.