Hyperloom README

The project's README from github.com/AMD-AGI/Hyperloom. As one markdown file: README.md.

ROCm Hyperloom

Tests Lint Version License: MIT Python

ROCm™ Hyperloom is a multi-agent harness that autonomously optimizes inference on AMD Instinct™ GPUs. It profiles each workload, searches framework and kernel optimizations, validates every candidate end to end, and carries proven results into a recipe knowledge base — without per-model human tuning.

It supports text generation, image generation, and custom pipelines on vLLM, SGLang, and xDiT.

Hyperloom architecture

Why Hyperloom

Serving efficiency determines hardware capacity, latency, and operating cost. Tuning a workload across serving configuration, framework source, and GPU kernels has traditionally taken weeks from a scarce specialist pool, and that work repeats for every new model, framework release, and accelerator generation.

Handing the same loop to an LLM is not enough. A real session runs for hundreds of turns, starts and stops many inference servers, and edits a serving framework's source tree. Left as the only source of truth, the model drifts from the original goal, rediscovers the same dead ends on every run, and can apply unsafe patches. Hyperloom is the harness around that loop: it keeps the mission grounded, reuses what earlier sessions already learned, and bounds what an agent is allowed to change.

How it works

A session is a closed loop: input → optimize → validate → learn.

PRELUDE → ENABLEMENT → FRAMEWORK_AGENT → KERNEL_AGENT → SWEEP → CLOSE

After Sweep, the coordinator either closes or starts another cycle when budget remains, the run has not converged, and roofline analysis still shows headroom. A hard cycle ceiling prevents unbounded looping. A new cycle resumes at the framework layer from the established baseline, rather than starting over.

Phase What it does
Prelude Measures a stock baseline (the anchor for every later comparison), optionally replays the closest recipe from the knowledge base, then profiles and builds a roofline so later phases know where the headroom is.
Enablement Makes the model run at all (serving flags through targeted rebuilds), graded on runnability and accuracy. Only entered when a baseline fails; skipped on healthy runs.
Framework optimization Searches serving flags, precision, attention, batching, and ranked upstream diffs.
Kernel optimization Delegates hot kernels to one AMD backend — GEAK or KernelForge — then re-measures every accepted change end to end. Only one backend runs per phase.
Sweep Re-measures the accumulated stack across concurrency and sequence-length operating points. Skips itself when the validated gain has not moved.
Close Records why the run stopped, writes the recipe knowledge base, final report, and machine-readable session artifacts.

Benchmarks are run by the coordinator, not by the model. A gain an agent predicts is logged for calibration and never decides a keep. A kernel backend's claimed speedup is held as unverified until Hyperloom re-measures it under the session protocol. Changes that fail validation are reverted; successful changes become the new baseline.

See the optimization loop for the runtime contracts, enablement ladder, and phase allowlists.

Multi-agent harness

The Coordinator runs Orchestration and Critic turns and dispatches specialists when needed. Each turn is grounded in persisted session state rather than an automatic supervision or recovery loop:

Role When it runs How it keeps the run on-goal
Orchestration Every tick Continuous planner; mission and progress are re-seeded from the state file, not from the transcript
Critic Every keep-or-revert Rules on whether a change served the mission; the learning record is written from that verdict
Specialist Authoring only Ephemeral. Returns a reviewed diff, not a decision

Risky source edits go through an isolated worktree, a unified-diff gate, a policy check, a Critic sign-off, and a coordinator benchmark. A rejection names the rule it broke so the next attempt is a fix, not a repeat.

Recipe knowledge base

Every session reads the recipe knowledge base (Recipe KB) before it starts and writes back when it finishes. A row stores the winning configuration, measured throughput, useful lessons, and failures worth remembering. Lookup relaxes one field at a time (model, hardware, framework, model type, architecture, framework version, precision) so a close match can warm-start the next run. Past failures are evidence in prompt context, not hard disqualifiers; what enters the KB is strict, because a bad entry outlives the run that created it.

Profiling and bottleneck analysis are backed by TraceLens, with trace collection from Magpie and low-level GPU tooling from IntelliKit. Long-horizon search and the knowledge base are described further in Arbor.

Supported features

Feature Options
Workload Text generation, image generation, and custom / scriptable pipelines
Platform MI300X, MI325X, MI355X
Framework SGLang, vLLM, xDiT
Kernel language HIP, Triton, FlyDSL
Kernel backends GEAK, KernelForge
LLM backend Claude

Get started

Goal Guide
Set up Hyperloom and run a demo Quickstart
Launch and monitor an optimization Run an optimization
Understand the algorithm Optimization loop
python -m hyperloom.inference_optimizer.cli optimize

Documentation

Topic Link
ROCm Docs Hyperloom
Authentication and credentials Authentication & credentials
Environment variables Environment variables
Components Components
Compatibility Compatibility matrix
Troubleshooting Troubleshooting
Operations Operations & self-hosting
Session output schema session_breakdown.json

File issues and feedback

If you encounter problems or bugs while running Hyperloom, open an issue, or send feedback through the beta survey.


Developer entry points

For contribution workflow, testing, and linting, see CONTRIBUTING.md.


Licensing

Hyperloom is released under the MIT License. The full license text is in LICENSE.

You may use Hyperloom commercially, modify it, and distribute it under the terms of the MIT license, provided the copyright notice and the permission notice are retained in all copies or substantial portions of the software.

Third-party tools and agents (Cursor, Visual Studio, and Claude Code) that Hyperloom invokes are governed by their own separate license terms and are NOT covered by the MIT license above — see the "Third-Party Tools and Agents" section in LICENSE. You are responsible for reviewing and complying with each tool's individual license.

A few files distributed inside Hyperloom are also third-party — reference kernels and a Triton oracle carried in forge's knowledge base and examples. They keep their own licences; THIRD_PARTY.md lists them and REUSE.toml carries the machine-readable form.

For security-relevant issues, see SECURITY.md. For contribution conventions, see CONTRIBUTING.md.

Hyperloom (AMD-AGI/Hyperloom)

Searching Database…

这是什么?一个多智能体框架,能在 AMD Instinct GPU 上自主优化大语言模型的推理:它会分析你的工作负载,搜索框架和 GPU 内核层面的优化,对每个候选方案做端到端验证,并把验证过的结果存进一个配方知识库。
它是我导入的库,还是针对我的推理服务运行的工具?它是一个 Python 命令行工具,你针对自己的推理服务运行它——python -m hyperloom.inferenceoptimizer.cli optimize——另外 scripts/ 目录下还有一些运维脚本,用于平台检查。
我怎么把它跑起来?从快速入门指南开始,里面讲了如何安装配置 Hyperloom 并运行一个演示;另一份指南讲如何启动和监控一次优化;完整文档在 ROCm 文档里。
它用 AI 模型来做优化吗?用的是哪个模型?是的,它的大语言模型后端是 Claude,所以你需要有 Claude 的访问权限。Hyperloom 还会调用 Cursor、Visual Studio、Claude Code 这类第三方工具,这些工具各有独立的许可证。
它允许智能体修改推理框架的源码——我怎么知道它不会把我的环境搞坏?有风险的修改会经过多重把关:隔离的 worktree、统一 diff 审查、策略检查、Critic 审核确认,以及由协调器(而不是模型)执行的基准测试。任何未通过验证的修改都会被回滚。
可以免费商用吗?可以——它采用 MIT 许可证,商用、修改和分发都没问题。不过被调用的工具(如 Cursor 和 Claude Code)以及少数内置的第三方内核文件有各自的许可证,你需要单独遵守。
我需要专门的硬件吗?需要——一块 AMD Instinct GPU:MI300X、MI325X 或 MI355X。它不能优化 NVIDIA 或其他加速器上的工作负载。
一次优化会话具体做什么?一次会话是一个闭环——输入、优化、验证、学习——分为六个阶段:Prelude(原始基线、性能分析、roofline 分析)、Enablement、框架优化、内核优化、在多个并发点上做 Sweep 扫描,以及 Close 收尾,并设有硬性的循环上限,所以不会无限循环。
它支持哪些框架和工作负载?它可以优化在 vLLM、SGLang 或 xDiT 上服务的文本生成、图像生成以及自定义或可脚本化的流水线。内核工作则交给 GEAK 或 KernelForge 后端,用 HIP、Triton 或 FlyDSL 编写。
配方知识库是什么?每次会话开始前都会读取它,结束后会把结果写回去。每一行记录获胜的配置、实测吞吐量、经验教训和值得记住的失败案例;查询时一次只放宽一个字段,这样相近的匹配就能为下一次运行做热启动。
为什么要交给框架来管,而不是让大语言模型自由调优?一次真实的调优要经历数百轮对话、反复重启推理服务器、修改框架源码——放任不管的话,模型会跑偏、重复走进死胡同,还可能应用不安全的补丁。Hyperloom 把任务锚定在持久化状态上,并限制智能体能改动的范围。
为什么不用它的话,调优通常要花几周时间?因为调优横跨服务配置、框架源码和 GPU 内核,传统上需要稀缺的专家时间——而且每换一个新模型、每个框架新版本、每一代新加速器都要重来一遍。Hyperloom 把这个循环自动化了,不再需要针对每个模型的人工调优。
scripts/ 目录里的运维脚本是干什么的?partitionmodesweep.py 对 AMD 的每种分区模式(SPX/DPX/QPX/CPX)做基准测试,找出工作负载适合哪种形态;platformaudit.py 按照 AMD 的指南检查 EPYC CPU 的调优;platformauditbmc.py 通过 BMC 审计仅限 BIOS 层面的设置项。
Creator
AMD-AGI
Size
86 MB
Stars
242
Age
6mo
Commits · 90 Days