64GB显存跑Agent不再是尴尬区,27B模型成新甜点
64GB isn't the dead zone anymore if you run agents
本地部署者必看,这篇实测用具体数据证明了64GB内存跑27B Agent模型的可行性与瓶颈细节,直接指导硬件选型与配置取舍。
The usual advice was that 64GB is a dead zone for local LLMs: too small for a 70B with real context, and more than a 30B needs. After running a 27B for agentic coding on a 64GB M4 Max for the last ten days, I think that has flipped. My memory usage is in the 50 GB as the context starts building up.
通常的建议是,64GB 对于本地大语言模型来说是一个尴尬的区间:对于需要真实上下文的 70B 模型来说太小,而对于 30B 模型来说又绰绰有余。在过去十天里,我在配备 M4 Max 芯片、64GB 内存的 Mac 上运行一个 27B 模型进行智能体编码工作,我认为这种观点已经反转。随着上下文逐渐积累,我的内存使用量已达到约 50 GB。
Setup: Qwen3.8 27B (16 GB MLX quant) in LM Studio, 256k context, coding agent sessions that sit at 100-200k tokens.
环境配置:在 LM Studio 中运行 Qwen3.8 27B(16 GB MLX 量化版),支持 256k 上下文,智能体编码会话的 token 数量维持在 100k-200k。
At 164k tokens, LM Studio's engine process is using 48 GB, 46 GB of it GPU memory. Roughly:
当 token 数达到 164k 时,LM Studio 的引擎进程使用了 48 GB 内存,其中 46 GB 为 GPU 显存。大致构成如下:
- 16 GB weights
- ~11 GB KV cache (~64 KB/token, only 16 of the 64 layers are full attention)
- what looks like a second copy of the context for the prompt cache, plus the linear attention checkpoints
- MLX holding on to scratch memory from prefill
- 16 GB 权重
- ~11 GB KV 缓存(约 64 KB/token,64 层中仅有 16 层是全注意力机制)
- 看起来像是用于提示缓存的上下文第二副本,以及线性注意力的检查点
- MLX 保留了来自预填充阶段的临时内存
The prompt cache is what makes it usable. It's hitting 93%, so a turn processes about 1k new tokens instead of 160k. When it misses, a full prefill takes about 20 minutes.
提示缓存是让系统可用的关键。其命中率已达 93%,因此每次处理仅新增约 1k 个 token,而非 160k。当发生缓存未命中时,完整的预填充过程大约需要 20 分钟。
Why not quantize the KV cache like people do on a 24GB card? LM Studio's MLX vision path refuses KV quantization for this model. The text-only path allows it, but skips the cache checkpoints when the cache is quantized, and on a hybrid model that means a lot more full reprocessing.
为什么不像在 24GB 显存的设备上那样对 KV 缓存进行量化?LM Studio 的 MLX 视觉路径拒绝对该模型启用 KV 量化。纯文本路径允许量化,但在缓存被量化时会跳过检查点保存;对于混合架构模型而言,这意味着需要进行更多次的完整重新处理。
So on 48GB this doesn't fit unless you drop to ~128k context or move to llama.cpp with q8 KV (should be ~25-30 GB at 256k, with slower prefill). On 64GB it fits with nothing to spare. Free memory is about 150 MB right now.
因此在 48GB 内存下,若不将上下文降至约 128k,或改用 llama.cpp 并采用 q8 KV 量化(在 256k 上下文下预计占用约 25-30 GB,但预填充速度较慢),则无法容纳。而在 64GB 内存下,虽然能容纳但已无多余空间可用。当前空闲内存仅剩约 150 MB。
The dead zone argument was about weights. With agents, context costs about as much as the model, and 27B models are now good enough for real work. That puts 64GB right in the sweet spot. Bigger MoE models or two models loaded at once still want 128GB.
所谓‘尴尬区间’的说法主要针对模型权重。在使用智能体时,上下文开销与模型本身相当,而 27B 模型现在已足以胜任实际工作。这使得 64GB 正好处于最佳甜点区。更大的 MoE 模型或同时加载两个模型仍需要 128GB 内存。
Anyone else on 64GB seeing the same? And is anyone running long context on llama.cpp on a Mac with prefill speeds they're happy with?
是否有其他 64GB 设备用户也观察到相同情况?是否有人在 Mac 上使用 llama.cpp 运行长上下文,且对预填充速度感到满意?
更进一步:量化金融体系
看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力