Qwen3.8-27B在单张RTX 3090上运行三周自主开发CUDA内核的实
The bear can dance: Qwen 3.8 27B on one 3090 for 3 weeks
这是一份极具参考价值的本地Agent工程实战复盘,详细披露了约束协议设计与资源调度细节,做本地部署与Agent开发的同学值得收藏研究。
TL;DR: Local agent loop, ~21 days, one RTX 3090. Task was pretty much "build a CUDA inference engine for optimized for yourself on this GPU arch." Got working kernels and benches, not a win over llama.cpp. ~12 human messages. Compaction ate ~83 hours.
TL;DR:本地智能体循环,约21天,一块RTX 3090。任务基本是“在这款GPU架构上为自身构建优化的CUDA推理引擎”。得到了可用的内核和基准测试,但未能超越llama.cpp。涉及约12条人工消息。压缩过程消耗了约83小时。
Old joke: you don’t criticize how well the bear dances, you’re surprised it dances at all.
老笑话:不要批评熊跳得有多好,你应该惊讶于它竟然会跳舞。
Setup: Qwen 3.8 27B Q4, Q8 KV, 200k context, deepseek harness, written rulebook: roles, handoffs, when to ping me, don't copy llama.cpp, don't declare the task impossible alone. I don't write CUDA. Nudges were basically "llama.cpp does ~700 prefill on this card, you're at ~250, try harder."
设置:Qwen 3.8 27B Q4,Q8 KV,200k上下文,deepseek harness,书面规则手册:角色、交接、何时ping我、不要复制llama.cpp、不要单独宣布任务不可能完成。我不写CUDA。提示基本上是说“llama.cpp在这张卡上预填充能达到~700,你只有~250,再努力点。”
Run: Unsupervised for days at a stretch, then escalate when the rules say so. Near day 6 it had several kernels and prefill stuck around 250 tps; same pattern later. Stops were mostly protocol, not the model wandering off. A protocol that's more empowering can probably keep this going indefinitely.
运行:连续数天无人监督,然后按规则升级。接近第6天时,它有几个内核和预填充卡在250 tps左右;后来也出现了相同模式。停止大多是协议层面的,而不是模型走神。一个更具赋能性的协议可能可以让这个过程无限期持续下去。
Suicide loop: Same 3090 has to host the agents (vLLM) and run the engine under test. Both want the full GPU. Kill vLLM wrong and every agent goes dark, leave it up during a bench and you OOM. The rulebook requires a fixed handoff script: stop vLLM, bench, start vLLM, poll health until it's back, write STATE. One subworker treated that as optional, kept killing vLLM outside the window, crashed the orchestrator, then did it again. A worker shutting down the brain that runs it. Harness also hard-crashed once; I restarted that by hand. Fixable with locks and "only this role may touch vllm.sh" protocol-level refinements.
自杀式循环:同一块3090必须同时托管智能体(vLLM)并运行待测引擎。两者都需要完整的GPU资源。错误地关闭vLLM会导致所有智能体离线,而在基准测试期间保留vLLM则会导致OOM(内存溢出)。规则手册要求固定的交接脚本:停止vLLM,进行基准测试,启动vLLM,轮询健康状况直到其恢复,写入STATE。其中一个子工作节点将该流程视为可选,在窗口外反复杀死vLLM,导致协调器崩溃,然后又犯了一次错。这是一个关闭运行自身的“大脑”的工作节点。Harness也曾硬崩溃过一次;我手动重启了它。通过加锁和“仅此角色可操作vllm.sh”的协议级改进可以修复此问题。
Local tax: 180 subagents, ~230M tokens in+out, ~1.7B cache-read. 699 compactions, ~83 h inside them (~17% of calendar time). Typical compact ~7 min on a ~160k+ token prompt.
本地开销:180个子智能体,输入输出约2.3亿token,缓存读取约17亿。699次压缩,其中耗时约83小时(占日历时间的约17%)。典型的压缩过程在约160k+ token的提示下耗时约7分钟。
Prefill landed ~half of llama.cpp on the same card. Still: weeks of coherent goal-following on a consumer box, it left working kernels, benches, notes, and a long git history. For a local (quantized!) 27B to hold a real engineering goal for that long, I’ll take it. Not a graceful ballerina, but damn this bear can dance!
预填充性能达到了同型号显卡上llama.cpp的一半。尽管如此:在一台消费级机器上保持数周连贯的目标遵循能力,留下了可用的内核、基准测试、笔记和长长的git历史记录。对于一个本地的(量化!)27B模型能长时间坚持真正的工程目标,我表示认可。它不是优雅的芭蕾舞者,但这只熊他妈的确实会跳舞!
Dump + rules (~15 GB):
转储 + 规则(约15 GB):
https://huggingface.co/datasets/skeole/qwen-cpp-agent-0-protocol
https://huggingface.co/datasets/skeole/qwen-cpp-agent-0-protocol
Backend:
后端:
https://github.com/syv-ai/HyperQwen (amazing work by u/iamMess)
https://github.com/syv-ai/HyperQwen (由u/iamMess完成的出色工作)
更进一步:量化金融体系
看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力