
将 Claude/GPT 蒸馏到 7B 模型用于生产:逐步指南
将 Claude 或 GPT-4o 的能力蒸馏到 7B 参数模型用于本地生产部署的逐步教程——从数据集生成到微调到 GGUF 导出。
你有一个运行在 Claude Sonnet 或 GPT-4o 上的系统。它工作。质量很好。但每次请求都花钱,每次请求都增加延迟,每次请求都将你的数据发送到别人的服务器。你想拥有驱动你产品的模型。
总时间: 3-4 小时 | 总成本: $10-30 | 预期结果: 在你特定任务上达到教师模型质量的 85-95%
第 1 步:定义任务范围
蒸馏在窄任务上有效。越窄越好。
第 2 步:手动创建 50 个种子示例
花 1-2 小时。种子示例的质量直接决定最终模型的质量。
第 3 步:使用教师模型生成 2,000 个合成示例
成本估计:$2-7(批处理可降至 $1.50-3.50)。
第 4 步:质量过滤数据集
预期丢弃约 25%。自动过滤:模式验证、类别验证、置信度阈值、去重、长度异常值。
第 5 步:在 Ertas Studio 中微调
模型选择:Llama 3.3 8B 或 Qwen 2.5 7B。LoRA rank 16,学习率 2e-4,3 个 epoch。训练时间 30-45 分钟,成本约 $8-12。
第 6 步:对照教师模型评估
目标:90%+ 与教师一致。可接受:85%+。
第 7 步:导出到 GGUF 并通过 Ollama 部署
FROM ./your-model-Q5_K_M.gguf
PARAMETER temperature 0.1
PARAMETER top_p 0.9
PARAMETER num_ctx 512
SYSTEM """You are a product feedback classifier..."""
ollama create feedback-classifier -f Modelfile
ollama run feedback-classifier "The search function is incredibly slow"
第 8 步:监控生产性能并迭代
每 2-4 周收集标记的低置信度示例和不正确预测,添加 200-500 个新示例,重新训练。
你早上还在按 token 付费。到午餐时,你拥有了模型。
Ship AI that runs on your users' devices.
Ertas early bird pricing starts at $14.50/mo — locked in for life. Plans for builders and agencies.
Ship AI that runs on your users' devices.
Early bird pricing starts at $14.50/mo — locked in for life. Plans for builders and agencies.
Keep reading

How to Distill Open-Source Models Legally: A Step-by-Step Guide
A practical guide to model distillation the right way: using open-source teacher models with permissive licenses, your own domain data, and a clear legal path to model ownership.

How to Fine-Tune an LLM: The Complete 2026 Guide
Learn how to fine-tune large language models step by step — from preparing training data and choosing a base model to configuring LoRA, evaluating results, and deploying locally.

Fine-Tuning Llama 3: A Practical Guide for Your Use Case
A hands-on guide to fine-tuning Meta's Llama 3 models — covering model selection, dataset preparation, LoRA configuration, training tips, and deployment as GGUF for local inference.