# Extension points — deepseek-ai/DeepSeek-V3

> Canonical page: https://codevetter.com/unpack/deepseek-v3/extension-points

# Extension points — deepseek-ai/DeepSeek-V3

Scanned commit 9b4e9788e4a3a731f7567338ed15d3ec549ce03b (2025-08-28). Generated by codevetter codevetter 1.12.0 on 2026-09-22.

This is a reference implementation, not a plugin architecture — there are no registries or hook interfaces. Extension happens through four narrow seams: the ModelArgs/configs JSON surface for new model sizes, the convert.py `mapping` table for new HF weight names, the module-level Literal switches (gemm_impl, attn_impl, score_func, scale_fmt) for implementation variants, and the fp8_gemm_configs autotune list for kernel tuning. New chat commands are string-matched literals in the interactive loop.
- ModelArgs is the single configuration surface: adding support for a new checkpoint size means adding a JSON file under inference/configs/ whose keys match ModelArgs field names — unknown keys would raise TypeError in ModelArgs(**json.load(f)). — [inference/model.py#L19-86](https://github.com/deepseek-ai/DeepSeek-V3/blob/9b4e9788e4a3a731f7567338ed15d3ec549ce03b/inference/model.py#L19-L86) [inference/generate.py#L113](https://github.com/deepseek-ai/DeepSeek-V3/blob/9b4e9788e4a3a731f7567338ed15d3ec549ce03b/inference/generate.py#L113) [inference/configs/config_v3.1.json](https://github.com/deepseek-ai/DeepSeek-V3/blob/9b4e9788e4a3a731f7567338ed15d3ec549ce03b/inference/configs/config_v3.1.json)
- convert.py's `mapping` dict is the extension table for weight renames: to support a new HF parameter name, add an entry mapping the HF key segment to (demo_name, shard_axis_or_None); unmapped keys hit 'assert key in mapping'. — [inference/convert.py#L11-30](https://github.com/deepseek-ai/DeepSeek-V3/blob/9b4e9788e4a3a731f7567338ed15d3ec549ce03b/inference/convert.py#L11-L30) [inference/convert.py#L62-65](https://github.com/deepseek-ai/DeepSeek-V3/blob/9b4e9788e4a3a731f7567338ed15d3ec549ce03b/inference/convert.py#L62-L65)
- attn_impl is a Literal['naive','absorb'] global switch; a third attention backend would slot into MLA.__init__'s cache-buffer branch and MLA.forward's score/output branches. — [inference/model.py#L17](https://github.com/deepseek-ai/DeepSeek-V3/blob/9b4e9788e4a3a731f7567338ed15d3ec549ce03b/inference/model.py#L17) [inference/model.py#L439-497](https://github.com/deepseek-ai/DeepSeek-V3/blob/9b4e9788e4a3a731f7567338ed15d3ec549ce03b/inference/model.py#L439-L497)
- gemm_impl is a Literal['bf16','fp8'] switch consulted in the linear() helper; a new GEMM path plugs in there and applies globally to every Linear subclass. — [inference/model.py#L16](https://github.com/deepseek-ai/DeepSeek-V3/blob/9b4e9788e4a3a731f7567338ed15d3ec549ce03b/inference/model.py#L16) [inference/model.py#L153-163](https://github.com/deepseek-ai/DeepSeek-V3/blob/9b4e9788e4a3a731f7567338ed15d3ec549ce03b/inference/model.py#L153-L163)
- Gate.score_func is a Literal['softmax','sigmoid'] switch with per-branch logic in forward (scoring and weight normalization); adding a scorer means touching both places. — [inference/model.py#L72](https://github.com/deepseek-ai/DeepSeek-V3/blob/9b4e9788e4a3a731f7567338ed15d3ec549ce03b/inference/model.py#L72) [inference/model.py#L577-598](https://github.com/deepseek-ai/DeepSeek-V3/blob/9b4e9788e4a3a731f7567338ed15d3ec549ce03b/inference/model.py#L577-L598)
- scale_fmt is threaded from ModelArgs -> Linear.scale_fmt -> linear() -> act_quant -> act_quant_kernel constexpr; 'ue8m0' is the only implemented format (power-of-two scales via ceil(log2)), so new scale formats extend kernel.py's branch. — [inference/model.py#L58](https://github.com/deepseek-ai/DeepSeek-V3/blob/9b4e9788e4a3a731f7567338ed15d3ec549ce03b/inference/model.py#L58) [inference/model.py#L159](https://github.com/deepseek-ai/DeepSeek-V3/blob/9b4e9788e4a3a731f7567338ed15d3ec549ce03b/inference/model.py#L159) [inference/kernel.py#L29-31](https://github.com/deepseek-ai/DeepSeek-V3/blob/9b4e9788e4a3a731f7567338ed15d3ec549ce03b/inference/kernel.py#L29-L31) [inference/configs/config_v3.1.json](https://github.com/deepseek-ai/DeepSeek-V3/blob/9b4e9788e4a3a731f7567338ed15d3ec549ce03b/inference/configs/config_v3.1.json)
- fp8_gemm_configs is an explicit list of triton.Config tile parameters; new shapes/tunings are added by editing this list, and @triton.autotune keys on N,K. — [inference/kernel.py#L113-118](https://github.com/deepseek-ai/DeepSeek-V3/blob/9b4e9788e4a3a731f7567338ed15d3ec549ce03b/inference/kernel.py#L113-L118)
- Chat slash commands are hardcoded string comparisons in the interactive loop ('/exit', '/clear'); a new command is another elif before messages.append. — [inference/generate.py#L134-138](https://github.com/deepseek-ai/DeepSeek-V3/blob/9b4e9788e4a3a731f7567338ed15d3ec549ce03b/inference/generate.py#L134-L138)
- Block selects dense-vs-MoE FFN purely by layer_id < args.n_dense_layers; architectures with interleaved or partially-MoE layouts require changing this branch, not just config. — [inference/model.py#L716](https://github.com/deepseek-ai/DeepSeek-V3/blob/9b4e9788e4a3a731f7567338ed15d3ec549ce03b/inference/model.py#L716)
- Experts are constructed per-rank with None placeholders in the ModuleList for non-local indices — extending to expert-parallel offload or remote experts would hook at this construction and the dispatch loop. — [inference/model.py#L660-666](https://github.com/deepseek-ai/DeepSeek-V3/blob/9b4e9788e4a3a731f7567338ed15d3ec549ce03b/inference/model.py#L660-L666) [inference/model.py#L684-689](https://github.com/deepseek-ai/DeepSeek-V3/blob/9b4e9788e4a3a731f7567338ed15d3ec549ce03b/inference/model.py#L684-L689)
- There is no plugin/registry system; all behavior changes are source edits. The repo's own recommendation for anything beyond demo use is to switch frameworks (SGLang/vLLM/LMDeploy/TRT-LLM/LightLLM). (inferred) — [README.md#L229-238](https://github.com/deepseek-ai/DeepSeek-V3/blob/9b4e9788e4a3a731f7567338ed15d3ec549ce03b/README.md#L229-L238)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
