DeepSeek-V3-3.4B-A3.0B-small

This is a small version of deepseek-ai/DeepSeek-V3-Base created for testing and development. It preserves the full architecture characteristics of the base model (MLA attention, MoE with shared experts, noaux-tc sigmoid routing, untied embeddings, identical hyperparameters) with fewer layers and experts.

Model Details

  • Base Model: deepseek-ai/DeepSeek-V3-Base
  • Architecture: DeepseekV3ForCausalLM (model_type deepseek_v3)
  • Total Parameters: 3.37B (3,372,768,256)
  • Activated Parameters: 3.02B (3,020,446,720)

Configuration Changes

The following parameters were reduced from the original model:

Parameter Base Small
num_hidden_layers 61 2 (1 dense-MLP layer + 1 MoE layer, dense first as in base)
first_k_dense_replace 3 1
n_routed_experts 256 16

All other hyperparameters are identical to the base: hidden_size 7168, intermediate_size 18432, moe_intermediate_size 2048, vocab_size 129280, num_experts_per_tok (topk) 8, n_group 8, topk_group 4, n_shared_experts 1, MLA dims (q_lora_rank 1536, kv_lora_rank 512, qk_head_dim 192, ...), rope/yarn parameters, tie_word_embeddings false, num_nextn_predict_layers 1, etc.

Checkpoint Structure

Single model.safetensors file with 77 bf16 tensors (the base is sharded; single-file vs sharded is equivalent). Tensor naming matches the base checkpoint exactly modulo layer count, verified against the base model.safetensors.index.json (23/23 name patterns match; per-layer tensor sets identical to base dense layer 0 and MoE layer 3). The base's fp8 weight_scale_inv tensors are absent because this checkpoint is unquantized bf16. This is a backbone-only checkpoint: num_nextn_predict_layers is kept at 1 from the base, and no MTP weights are materialized (matching the transformers save convention for this family).

Usage

from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained("inference-optimization/DeepSeek-V3-3.4B-A3.0B-small", device_map="auto")
tokenizer = AutoTokenizer.from_pretrained("inference-optimization/DeepSeek-V3-3.4B-A3.0B-small")

input_ids = tokenizer("According to all known laws", return_tensors="pt").input_ids.to(model.device)
output = model.generate(input_ids, max_new_tokens=20)
print(tokenizer.decode(output[0]))

Creation Process

This model was created using the llm-compressor create-tiny-model skill.

Built from the base AutoConfig with only the allowed changes above (layers, layer-type list first_k_dense_replace, expert count), initialized with init_weights() (bf16), and fine-tuned on a toy copypasta dataset until perplexity ~1.0 (target 3.0).

Validation

$ python validate_tiny_model.py DeepSeek-V3-3.4B-A3.0B-small-ft
Success: 1.0000025033950806 <= 10.0

Generating sample text:
According to all known laws of aviation, there is no way a bee should be able to fly.

Notes

  • Why 16 experts instead of 8 (= topk): the DeepSeek-V3 grouped-topk router requires at least 2 experts per group (n_group=8, intra-group topk(2)) and at least num_experts_per_tok=8 surviving candidates after topk_group=4 group masking. 8 routed experts (1 per group) would crash routing; 16 is the minimum feasible count and still exercises the full routing path (sigmoid scoring, e_score_correction bias / noaux_tc, group selection, topk-prob normalization, routed_scaling_factor 2.5, 1 shared expert). topk itself is unchanged at 8.
  • Embeddings dominate the parameter count: with fixed vocab (129280) and hidden (7168) and untied embeddings, input+output embeddings alone are 1.85B params; the minimal 2-layer set keeps the total at 3.37B, far below the base (671B) and within the accepted range for this family.
  • quantization_config stripped: the base is fp8 block-quantized; this checkpoint is clean unquantized bf16 (matching the convention for these small test models).
  • auto_map removed: the base config references remote-code files (configuration_deepseek.py, modeling_deepseek.py) that are not carried over in this repo; transformers (>= native deepseek_v3 support) and vLLM both load this model with their native implementations.
  • Backbone-only: num_nextn_predict_layers kept from base (1); transformers does not materialize MTP weights on init/save, so no MTP weights are included (the base's layer-61 MTP tensors are intentionally absent).
Downloads last month
49
Safetensors
Model size
3B params
Tensor type
F32
·
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for inference-optimization/DeepSeek-V3-3.4B-A3.0B-small

Finetuned
(22)
this model

Collection including inference-optimization/DeepSeek-V3-3.4B-A3.0B-small