Hacker News 熱門精选79

HN 发布:Magnitude (YC S25)——面向智能体的自优化推理引擎

Launch HN: Magnitude (YC S25) – Self-optimizing inference engine for agents

· 13天前
跳到正文

精选理由

了解面向本地智能体的自优化推理引擎,提升速度并降低显存占用

AI 摘要

大家好,HN 用户们,我是 Anders,Tom 也在这里。我们正在开发 Magnitude,这是一个面向智能体的推理引擎,能够自我优化,以便在你的硬件上尽可能快速地运行。它支持 Mac、Linux 和 Windows,可运行于任何硬件上,速度最高可达 llama.cpp 的 2 倍。 我们都是软件工程师,此前曾构建过一个开源浏览器智能体,获得了 4k+ GitHub 星标和 100k+ 下载量。我们越来越希望在本地模型上运行它,但发现没有任何推理引擎适合我们的使用场景。 如今的推理引擎都需要在性能上做出取舍。它们要么是: - 面向数据中心硬件上的批量推理构建,以牺牲单会话性能为代价(vLLM、SGLang) - 注重广泛兼容性,而不是针对特定硬件进行优化(llama.cpp、Ollama) - 针对特定硬件或模型进行了专门优化,但引擎功能不够完整(oMLX、ds4) 此外,它们都不是为在本地运行智能体而设计的。智能体会运行很长时间,通常还会同时运行多个实例,而你仍然希望电脑能够处理其他任务。 Magnitude 专为在你的硬件上实现最高性能以及运行本地智能体而构建: - 设备端编译与调优:内核使用灵活的参数编写,并会在模型运行前根据你的实际设备进行调优。这让我们在保持与广泛硬件兼容的同时,也能达到与硬件专用内核相同的性能上限。 - 专注于最佳架构:我们会针对最流行的开放权重模型系列编写可调优且高效的内核。这使我们能够达到并超越硬件或模型专用引擎的性能,而不必为了过度泛化而牺牲性能。 - 动态内存分配:Magnitude 在启动时只预留足以容纳模型权重的内存。随着智能体会话增长,内存堆会动态扩展;智能体停止后,所占内存也会自动释放。这样,智能体运行期间,你的硬件仍可用于其他任务。 - 混合分页注意力:我们借鉴了 SGLang 等引擎中的优秀理念,让并发会话能够共享前缀缓存,同时针对内存邻接性优化数据布局,从而不会影响单会话性能。 Magnitude 完全开源(Apache 2.0)。我们使用 Rust 构建了它,其中包括定制的 GPU 内核运行时和自动调优器。为了达到性能上限,我们从学术界的最佳推理创新(例如 FlashAttention、FlashInfer、TurboQuant)以及其他引擎(例如 SGLang 的基数注意力)中汲取灵感。 在 Qwen 3.6 35B A3B(4 bit)、64k 上下文且不使用推测解码的条件下,与 llama.cpp 进行基准测试: Metal(Mac M4 Pro 48 GB) - 解码速度提升 92%(30 tok/s → 57 tok/s) - 预填充速度提升 9%(466 tok/s → 507 tok/s) - 每个智能体的内存占用降低 28% CUDA(DGX Spark) - 解码速度提升 19%(49 tok/s → 58 tok/s) - 预填充速度提升 23%(2,033 tok/s → 2,507 tok/s) - 每个智能体的内存占用降低 27% Magnitude 以桌面应用的形式发布,你可以轻松地将它连接到已经在使用的各种智能体(Pi、OpenCode、Hermes、Codex 等)。只有当这些智能体确实需要模型时,它才会按需自动运行模型,并在闲置后将其关闭。 效果如下: https://www.youtube.com/watch?v=0qE8BWEZu7o 我们很期待进一步推进 Magnitude,让你能够在相同硬件上运行更大的模型,同时持续提升性能。我们的计划包括: - 专家流式加载:将专家存储在 RAM 或磁盘中,并在需要时即时加载。这样,你就能运行原本无法装入 GPU 的更大模型。 - 内核编译器:目前,我们的内核会调优少量参数以适配你的硬件。借助完全定制的编译器,我们可以更进一步,自动选择内核融合方式和实现方案,从而让它更好地适配你的硬件。 - 多设备利用:通过检测系统中的所有硬件(CPU、GPU、RAM、磁盘),自动求解最佳模型布局,以尽可能充分地利用它们。 我们希望有更多人来试用并向我们提供反馈。欢迎在这里留言,我们一整天都会在线! 评论链接: https://news.ycombinator.com/item?id=49911995 得分:5 评论数:0

正文

Magnitude icon

Magnitude

Run open models as fast as your hardware allows

Download Magnitude Documentation Discord Follow Magnitude on Twitter GitHub Repo stars

Magnitude is an open source inference engine for agents that optimizes itself for your exact hardware. It compiles and tunes its kernels on your device, so open models run up to 2x faster than llama.cpp. One click connects the agent you already use (Pi, OpenCode, Hermes, Codex, and more). Works on Apple Silicon, NVIDIA, AMD, or nothing but a CPU.

Download Magnitude for macOS, Windows, or Linux

⭐ Help us reach more developers and grow the Magnitude community. Star this repo!

demo-9-29.mp4

Get started

  1. Download Magnitude, install it, and open the app.
  2. Choose a recommended model in Discover and download it.
  3. Connect your agent in Connections and start using it.

The desktop app includes the magnitude CLI. No separate installation is needed.

Why Magnitude?

  • Up to 2x faster than llama.cpp: 92% faster decode on Metal, 19% on CUDA
  • Tuned on your device: kernels are tuned on your hardware before a model runs
  • Built for the best models: hand-optimized kernels for popular open-weight families
  • Memory that flexes: 27% less memory per agent, freed when agents stop
  • Fast concurrent sessions: sessions share prefix caches to prevent slowdown
  • Works with your agent: one click to connect Pi, OpenCode, Hermes, Codex, and more
  • Free, private, open source: no token costs, nothing leaves your machine, Apache 2.0

Up to 2x faster than llama.cpp

Magnitude vs llama.cpp: 9% faster prefill and 92% faster decode on Metal, 23% faster prefill and 19% faster decode on CUDA

FAQ

What is Magnitude?

An open source inference engine that optimizes itself for your hardware. It ships as a desktop app that runs open models and connects them to the agent you already use.

How is it faster than llama.cpp, Ollama, or LM Studio?

They ship kernels precompiled for broad classes of hardware. Magnitude compiles and tunes its kernels on your actual device before a model runs, so they fit your exact chip. See the benchmarks against llama.cpp.

What hardware do I need?

Any Apple Silicon, NVIDIA, or AMD GPU, or nothing but a CPU. There is no fixed minimum. Smaller machines run smaller models, and more memory lets you run larger ones.

What operating systems does it support?

macOS, Linux, and Windows.

Which models does it support?

See the full list at magnitude.dev/models. We write optimized kernels for the most popular open-weight families, which is how we beat generalist engines.

Which agents work with it?

One click connects Pi, OpenCode, Hermes, OpenClaw, Codex, Claude Code, Oh My Pi, and Cline. Anything else works through the OpenAI-compatible API.

Is it private?

Yes. Prompts, files, and models stay on your machine. No internet needed once a model is downloaded.

查看原文(Hacker News 熱門)