Qwen 3.6 本地跑代码生成 + Ornith-1.0 自我进化 Agent:开发者该怎么选?

2 阅读1分钟

1. Qwen 3.6 27B:本地代码生成的"甜点"配置

为什么火

Hacker News 647 分,528 条评论。开发者 Piotr Migdał 在博客里详细记录了用 Qwen 3.6 27B 做本地开发的体验。核心结论:这是第一个让他觉得"能用"的本地模型。

技术细节

Qwen 3.6 有两个版本:

  • 35B A3B:MoE 架构,激活参数只有 3B,速度快但质量稍差

  • 27B:稠密模型,慢一点但更聪明(推荐)

推荐量化方案:Q8_0(8-bit),体积减半,质量几乎无损。

本地部署实操

# 1. 安装 llama.cpp
brew install llama.cpp  # macOS
# 或从源码编译
git clone https://github.com/ggml-org/llama.cpp
cd llama.cpp && cmake -B build && cmake --build build --config Release

# 2. 下载模型(Hugging Face)
# 推荐 unsloth 的量化版本
huggingface-cli download unsloth/Qwen3.6-27B-MTP-GGUF \
  --include "Q8_0/*.gguf" \
  --local-dir ./models/qwen3.6-27b-q8

# 3. 启动服务
llama-server \
  -m ./models/qwen3.6-27b-q8/Q8_0/Qwen3.6-27B-MTP-Q8_0.gguf \
  --host 0.0.0.0 \
  --port 8080 \
  -ngl 99 \
  -c 8192

# 4. 测试
curl http://localhost:8080/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen3.6-27b",
    "messages": [{"role": "user", "content": "Write a Python function to find prime numbers using the Sieve of Eratosthenes"}],
    "temperature": 0.7
  }'

性能对比(我的测试)

任务

Qwen 3.6 27B (Q8)

Claude Opus 4.5

GPT-5

单文件函数生成

✅ 优秀

✅ 优秀

✅ 优秀

多文件重构

⚠️ 一般

✅ 优秀

✅ 优秀

创意写作

✅ 惊艳

✅ 优秀

✅ 优秀

复杂推理

⚠️ 有差距

✅ 优秀

✅ 优秀

延迟 (M2 Max)

~15 tok/s

N/A (API)

N/A (API)

成本

免费(本地)

~$15/M tokens

~$10/M tokens

结论:日常写函数、写测试、写文档,本地 27B 足够。涉及系统设计、多文件重构,还是得上 API。

2. Ornith-1.0:编码 Agent 的"自我进化"是怎么实现的

核心创新

Ornith-1.0 的训练方法跟传统代码生成模型不同。传统模型只学"怎么写代码",Ornith 同时学两件事:

  1. 生成代码解决方案(solution rollout)

  2. 生成驱动方案的脚手架(scaffold)

用强化学习(RL)联合优化这两个目标,让模型自己发现更好的搜索路径。

架构示意

┌─────────────────────────────────────────┐
│              Ornith-1.0                  │
│                                         │
│  ┌─────────────┐   ┌──────────────┐    │
│  │  Scaffold    │   │   Solution   │    │
│  │  Generator   │──▶│   Generator  │    │
│  └─────────────┘   └──────────────┘    │
│         │                   │           │
│         ▼                   ▼           │
│  ┌─────────────────────────────────┐   │
│  │       RL Reward Signal          │   │
│  │  (task completion + efficiency) │   │
│  └─────────────────────────────────┘   │
└─────────────────────────────────────────┘

Benchmark 数据

# 用 Python 调用 Ornith-1.0 API 做代码生成
import requests

def generate_code(prompt: str, model: str = "ornith-1.0-35b") -> str:
    """调用 Ornith-1.0 生成代码"""
    response = requests.post(
        "http://localhost:8080/v1/chat/completions",
        json={
            "model": model,
            "messages": [
                {
                    "role": "system",
                    "content": "You are an expert coding agent. Generate clean, well-documented code."
                },
                {
                    "role": "user",
                    "content": prompt
                }
            ],
            "temperature": 0.3,  # 代码生成用低温度
            "max_tokens": 4096
        }
    )
    return response.json()["choices"][0]["message"]["content"]

# 示例:生成一个简单的 HTTP 缓存中间件
code = generate_code("""
Write a Python middleware for HTTP caching that:
1. Uses Redis as the cache backend
2. Supports cache invalidation by key pattern
3. Has configurable TTL per route
4. Includes cache hit/miss metrics
""")
print(code)

关键 Benchmark 对比

模型

TerminalBench 2.1

SWE-bench Verified

NL2Repo

Ornith-1.0-35B

64.2

75.6

34.6

Qwen3.5-35B

41.4

70.0

20.5

Qwen3.6-35B

52.5

73.4

29.4

Qwen3.5-397B

53.5

76.4

36.8

35B 的小模型在 TerminalBench 上超过了 397B 的大模型。这说明架构和训练方法的创新比堆参数更重要。

3. 开发者该怎么选?

场景决策树

你的任务是什么?
│
├── 写函数 / 写测试 / 写文档
│   └── 用 Qwen 3.6 27B(本地,免费,隐私安全)
│
├── 多文件重构 / 系统设计
│   └── 用 Claude Opus / GPT-5(API,质量更高)
│
├── 自动化编码任务(CI/CD 集成)
│   └── 考虑 Ornith-1.0(自我进化,适合 Agent 场景)
│
└── 敏感代码 / 离线环境
    └── 本地模型(Qwen 3.6 或 Ornith-1.0-9B)

混合方案(推荐)

# 一个简单的混合路由方案
def route_task(task_type: str, complexity: int) -> str:
    """根据任务类型和复杂度路由到不同的模型"""
    if task_type in ["unit_test", "docstring", "simple_function"]:
        return "local:qwen3.6-27b"  # 本地,免费
    elif complexity > 7:
        return "api:claude-opus"  # 复杂任务用最强模型
    elif task_type == "agent_automation":
        return "local:ornith-1.0-35b"  # Agent 场景用 Ornith
    else:
        return "local:qwen3.6-27b"  # 默认本地

4. 今天 GitHub 上还值得关注的项目

ai-berkshire (+1,386 ⭐/天)

用 Claude Code / Codex 做价值投资研究。把巴菲特、芒格、段永平、李录的投资方法论编码成多 Agent 对抗分析。

技术亮点:多 Agent 并行 + 对抗式分析,这个架构可以迁移到其他决策场景。

video-use (+967 ⭐/天)

用编码 Agent 编辑视频。自然语言描述剪辑效果,Agent 生成 FFmpeg 代码实现。

开发者价值:批量视频处理、自动化剪辑流程。

总结

今天有两个信号值得关注:

  1. 本地模型正在变得可用:Qwen 3.6 27B 不是最强的,但它代表了一个趋势——AI 能力正在从云端迁移到本地。

  2. Agent 架构在进化:Ornith-1.0 的"自我改进"方法可能会成为下一代 AI Agent 的标准范式。

你们团队在用什么方案?本地模型 + API 混合,还是纯 API?欢迎评论区讨论。