Impactful scheduling for GPU clusters
https://huggingface.co/blog/allenai/impactful-scheduling📌 Ai2如何用「GPU時間預算」終結排程亂象
TL;DR:Ai2 用預算制取代優先權排程,把資源佔用的公共悲劇變成可問責的分配制度。
當你管理的 GPU 只有需求的三分之一到一半,排程就不只是工程問題,而是政治問題。Ai2 的 AI Infrastructure 團隊最近公開了他們如何從一套「優先權失控」的舊排程系統,走到用時間預算與層級式公平分享(fair-share)重新設計整套機制的過程。
🤔 supply 永遠追不上 demand 的現實
Ai2 管理數千張 NVIDIA H100、B200、B300 GPU,叢集規模從 88 張到 1024 張不等,服務約 150 位內部研究者,涵蓋 LLM/VLM 訓練、機器人 RL 模擬,以及科學 agentic 應用的 post-training。根據提交的工作負載估算,任何時刻叢集上排隊的 GPU 需求都是實際供給的 2 到 3 倍。
舊系統採用優先權排程,並允許工作負載選擇「不可被搶佔(non-preemptable)」。每個團隊對不可搶佔工作有固定的 GPU 使用上限,可搶佔的工作則能在閒置 GPU 上超出這個上限。
🧩 當「免費」的優先權變成大家都在鑽的漏洞
這套制度催生出幾種典型病態:研究者會把「無作用」的空轉工作停在叢集上佔位(GPU squatting),原因是真正需要除錯時,無法以足夠低的延遲啟動新工作去即時處理問題;同時出現優先權膨脹——最終幾乎 100% 的排程工作都標成 HIGH,導致較低優先層級直接被餓死;值班工程師也因為「不可搶佔」是選配,花費大量處理工單的時間在和團隊協商、組織性關閉跑在已知有維護問題機器上的工作。
Ai2 將這個現象定性為經典的「公共悲劇(tragedy of the commons)」:每個人在追求個人最優時,共同導致了全域的次優結果。文章引用 Ghodsi 等人 2011 年提出 Dominant Resource Fairness 的論文中的一個軼事:某搜尋公司只把專屬機器分給能保證高使用率的工作,結果使用者直接在程式碼裡「灑」無窮迴圈,人為灌高使用率數字。資源分配的根本難題——使用者比組織更了解自己工作的真實價值,卻有動機隱藏或濫用這個資訊不對稱——在硬體換了好幾代後依然存在。
💡 從「分配機器」到「分配時間」
解決公共悲劇的經典方法是私有化共享資源:把 GPU 整組劃給團隊壟斷使用,這正是 Ai2 最初做法的雛形,但粒度太粗。研究工作本身有季節性,團隊有時密集跑實驗,有時閒置,一旦分配壟斷,就一定會出現某團隊空等、GPU 卻閒置的情況——本質上是在手動解一個動態變化的背包問題(knapsack problem)。
Ai2 的解法是把「擁有 GPU」改成「擁有 GPU 時間的一個份額」。預測未來的運算需求等同預測科學實驗的結果,幾乎不可能精確,但研究策略上的優先順序是可以提前討論與決策的策略問題。於是他們設計出一套層級式系統:管理者可以按比例把 GPU 時間分配給自己負責的專案與研究者。文章提到的範例中,Project A1 知道自己對整體容量擁有 35% 的固定佔比,不受其他專案排隊多寡影響。
在新制度下,任何 GPU 時間請求都必須有預算支撐,否則不受搶佔保護。舊制度裡 HIGH 優先權不用付代價、不可搶佔又能無限期佔滿團隊的並發上限,所以人人都用;新制度下沒有東西是免費的,任何想鑽漏洞拿到 GPU 時間的招數,都是在消耗受益者自己的預算。空轉佔位的工作,等於是在燒自己團隊的錢卻什麼都沒換到。Ai2 明確把策略定義為:讓「鑽排程系統漏洞」的成本,高於「誠實爭取更大預算」的成本。
預算審查的關鍵設計是:研究者要有頻繁的機會爭取自己需要的時間,而決策要交給最了解其中取捨的管理者——專案內部由主責研究者決定,研究計畫內部由 PI 決定,跨計畫則由計畫負責的經理或 CEO 決定。
🧩 搭配層級式公平分享排程
有了時間預算,Ai2 接著建立了層級式 fair-share 排程器,用來管理整個計畫樹下各分配額度的實際佔用狀況。文章強調這個演算法本身不是新發明——時間窗口上的層級 fair-share 可以追溯到 2009 年的 Hadoop Fair Scheduler,而同樣的方法今天仍活躍於 SLURM 的 Fair Tree 以及 YARN 的 Fair Scheduler。
🎯 實務啟示
如果你的團隊也在管理稀缺的 GPU 叢集,這篇文章提供了一個重要的框架轉換:不要試著用更複雜的排程演算法去解一個本質上是治理問題的難題。把「這個專案該分到多少運算資源」變成一個可以提前討論、定期覆盤的預算決策,比起臨時的優先權競爭,更能讓管理者用他們實際擁有的上下文資訊做判斷,同時讓鑽系統漏洞變得不值得。
🔗 來源
- 標題:Impactful scheduling for GPU clusters
- 作者/機構:Kyle Wiggers/Ai2(allenai, Hugging Face Blog)
- 連結:https://huggingface.co/blog/allenai/impactful-scheduling
#GPUCluster #Scheduling #AI2 #MLInfrastructure #ResourceAllocation #FairShare #DistributedTraining #MLOps #CloudComputing #TragedyOfTheCommons
原始資料 HuggingFace Blog · 收集於 2026-10-09
摘要原文
Back to Articles Impactful scheduling for GPU clusters Enterprise Article Published October 9, 2026 Upvote 1 Kyle Wiggers Ai2Comms Follow allenai Building a cluster scheduler to prioritize high-impact research while maintaining full occupancy On the AI Infrastructure team at Ai2, we’re responsible for providing the institute’s GPU compute capacity, specifically targeting large, distributed training workloads. We think about this task as a pyramid of four metrics that build on each other. The foundation is availability : how often the hardware is healthy and ready for work. Above this is occupancy : the fraction of available time assigned to a specific workload. Next is impact : how often the most valuable workloads are chosen to receive resources. The capstone of the pyramid is utilization : the fraction of GPU capacity used over the lifetime of a workload. This post is about improving the impact of our scheduling decisions. We recently replaced a priority-based scheduler with a system including GPU time budgets, hierarchical fair-share allocation, and a time-slicing contract. As a result, we shifted the debate about how much GPU time each research project deserves from a case-by-case operational task to a transparent administrative budgeting process. Overcommitting At Ai2, we manage thousands of NVIDIA H100, B200, and B300 GPUs arranged in clusters ranging in size from 88 to 1024 GPUs. These clusters are built for large-scale distributed training of AI models, and they serve a group of about 150 internal researchers whose work covers a diverse set of AI domains, including the full model flow of LLM and VLM training, robotics reinforcement learning (RL) simulation, and post-training for scientific agentic use cases. Like many labs, we have demand for GPU time that far exceeds supply. Based on submitted workloads, at any moment in time we have outstanding requests for 2-3x more GPUs than are available. One way to think about this is that every available GPU hour on our cluster has 2-3 different research workloads competing for it. Historically, we used a priority-based scheduler, and we allowed workloads to opt out of preemptability. Each team had a limit on concurrent GPUs that could be used by workloads which were protected from preemption. Preemptible workloads could exceed that limit on idle GPUs. This strategy produced predictable pathologies. For example, we observed instances of GPU “squatting” where users would park no-op workloads they could connect to when the need arose. This occurred because researchers found they could not launch debugging workloads with low enough latency to tackle problems in real time. We also observed priority inflation, where eventually 100% of scheduled workloads used HIGH priority. This meant that lower priority levels were starved of GPU time altogether. Since preemptability was optional, we also found that our on-call engineers spent a majority of their ticket response time negotiating the organized shutdown of non-preemptable workloads running on hosts with known maintenance problems. Tragedy of the commons When these problems emerged, we were slow to identify their root causes. Our initial attempts to ensure the most important work received GPU time were focused on tighter control of how priorities were set, and, ultimately, working around the priority-based scheduler by explicitly assigning GPU monopolies to important projects. While we didn’t recognize it at first, we had built a perfect laboratory for observing the “tragedy of the commons.” Individuals were competing over a scarce, shared resource and, by seeking to maximize individual outcomes, achieving a non-optimal global result and abusing the underlying resource. We were far from the first to observe this kind of interaction. Resource allocation is a fascinating research domain that mixes algorithm development, economics, and system management. A central problem is that users often know the value of their own jobs better than the organization does, but they may have incentives to hide that value or hold on to resources even when doing so hurts total performance. For example, in their 2011 paper introducing Dominant Resource Fairness , Ghodsi et al. recount an anecdote in which a search company provided dedicated machines to jobs only if their users could guarantee high utilization. They soon discovered “users would sprinkle their code with infinite loops to artificially inflate utilization levels.” The hardware changes, but the fundamental problems that make resource allocation complex persist. Budgets not schedules The classic solution to a tragedy of the commons is to privatize the shared resource—owners are incentivized to maximize the value of their property. When we assigned teams monopolies over sets of GPUs, we were already doing a version of this, but it was too coarse. It caused GPUs to sit idle due to the seasonality of research. Teams are ready to run experiments and training at different times, so assigning a monopoly would ensure that there would be times when no jobs were ready to execute, with another team left waiting for capacity. We were manually solving a knapsack problem , trying to fit dynamically changing research needs into a static schedule. We wanted the ownership incentive, but we also wanted to maintain full occupancy of the GPUs. We decided to iterate on the ownership model. Instead of issuing teams GPUs, we chose to allocate a portion of GPU time. Predicting demand into the future would require knowing the result of novel science experiments, so it cannot be forecast with precision. Priority across research efforts, however, is a question of strategy, and it can be more easily debated and decided in advance. Instead of trying to solve the scheduling puzzle, we enabled leadership to think like investors. Before the workloads exist, decide how to fund each research effort with GPU time based on their judgment of its likely impact. The scheduler could then use that information when prioritizing arriving workloads. With this in mind, we devised a hierarchical system where managers could proportionally allocate GPU time to the projects and researchers they were responsible for. As the diagram below illustrates, this translates program strategy directly into a guaranteed share of GPU time. Project A1 knows it has a 35% claim on total capacity, regardless of how many other projects are queuing up elsewhere. Parenthetical values represent the total cluster capacity assigned to a leaf project. In this system, every request for GPU time must be funded by a budget, or it is not protected from preemption. In the old system, HIGH priority carried no cost and non-preemptibility allowed a team to fill their concurrent GPU limit indefinitely, so everyone used them. Now, nothing is free, so any trick to get GPU time draws from the benefiting user’s allocation. A squatting workload is spending team budget on nothing. Our strategy is to make gaming the scheduler more expensive than honestly engaging in the debate for a larger budget. We are constantly iterating on this budget review process, but the key requirements are that there are frequent opportunities for researchers to advocate for the time they need, and the decisions are made by managers with the most context on the tradeoffs in question. This means allocation decisions within a research project are made by a lead researcher, within a research program by a principal investigator, and across programs by a lead program manager, or by the CEO. Fair-share Paired with this GPU time budgeting tool, we built a hierarchical fair-share scheduler to manage actual occupancy of allocations throughout the program tree. The algorithm here is not new—hierarchical fair-share over a time window is part of a lineage that goes back to the Hadoop Fair Scheduler in 2009 , and the same approach is in active use today in SLURM’s Fair Tree and YARN’s Fair Scheduler .
由 claude-code/sonnet 自動生成