Heretic
Heretic 部署:GPU 环境、量化与模型溯源
规划隔离 GPU 工作节点、PyTorch 兼容性、VRAM、产物和恢复。

你将学会
- Explain the KL/refusal optimization objective
- Run a pinned model experiment
- Design broader safety evaluation
开始前需要
- Basic Git and command-line usage
- Comfort reading a project README
You can explain the project, run its documented first step, and decide what to verify before adopting it.
先看结论
- Deploy Heretic as an isolated experiment worker, not an open endpoint.
- PyTorch feature compatibility matters more than the minimum version.
- Artifacts and recovery records are part of the deployment contract.
Treat deployment as an experiment runner
Heretic 更像隔离的实验运行器而不是多租户服务;固定 Python/PyTorch/uv 锁文件、模型修订和输出目录,并为中断、磁盘和上传失败准备恢复路径。
Python 3.10+ and PyTorch 2.2+ are the baseline. The README warns that some models need later PyTorch features, such as `torch.accelerator` for MXFP4 gpt-oss models; pin the exact stack instead of assuming the minimum is sufficient.
Capacity and artifacts
The program benchmarks the machine to choose batch size. On the documented RTX 3090 example, Qwen3-4B takes roughly 20–30 minutes, but treat that as a workload-specific reference. Bitsandbytes `bnb_4bit` can reduce VRAM while adding a quantization variable to the evidence.
Persist the source model revision, lockfile, TOML configuration, hardware inventory, logs, evaluation outputs, checkpoint hash, and license. Keep upload credentials outside the worker and make export an explicit, reviewed step.
Recovery
Use a disposable output directory, checkpoint space and a known-good baseline. Test interrupted runs, insufficient VRAM, corrupted downloads, failed uploads, and cleanup before scheduling batches.
如何选择
| 比较维度 | 方案 A | 方案 B |
|---|---|---|
| Best when | You need predictable behavior and easy auditing | You need adaptive optimization and have reliable telemetry |
| Main risk | May leave performance on the table | Can become difficult to explain or debug |
实施步骤
- 1
Pin Python, PyTorch, Heretic, uv lock, and model revisions.
- 2
Provision GPU, cache, output, and secret boundaries.
- 3
Run a smoke transform and evaluation with bounded VRAM.
- 4
Test interruption, restore, export, and cleanup paths.
可复制示例
uv run heretic --help
# pin the model revision and config.default.toml
heretic --model <model-id> --evaluate-model <checkpoint>
# keep HF/upload credentials in the secret manager, never in the image常见问题
Can I run Heretic as a public API?
The README describes a CLI workflow; expose any service only after adding authentication, quotas, isolation, and a separate safety review.
Does 4-bit quantization preserve the same result?
Not necessarily. Measure it as a separate configuration because quantization changes memory, speed, and potentially model behavior.
资料来源
- Heretic README (captured 2026-08-31)来源核查 2026-08-31
- Heretic repository来源核查 2026-08-31