commit 154a42732aa400f515fb66fb4dbb27d8ac9e6d02 Author: ModelHub XC Date: Mon Sep 21 03:47:16 2026 +0800 初始化项目,由ModelHub XC社区提供模型 Model: Zynerji/Ektome-SmolLM3-3B-PristinelyUncensored Source: Original Platform diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..01f7fab --- /dev/null +++ b/.gitattributes @@ -0,0 +1,44 @@ +*.7z filter=lfs diff=lfs merge=lfs -text +*.arrow filter=lfs diff=lfs merge=lfs -text +*.bin filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.ckpt filter=lfs diff=lfs merge=lfs -text +*.ftz filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.h5 filter=lfs diff=lfs merge=lfs -text +*.joblib filter=lfs diff=lfs merge=lfs -text +*.lfs.* filter=lfs diff=lfs merge=lfs -text +*.mlmodel filter=lfs diff=lfs merge=lfs -text +*.model filter=lfs diff=lfs merge=lfs -text +*.msgpack filter=lfs diff=lfs merge=lfs -text +*.npy filter=lfs diff=lfs merge=lfs -text +*.npz filter=lfs diff=lfs merge=lfs -text +*.onnx filter=lfs diff=lfs merge=lfs -text +*.ot filter=lfs diff=lfs merge=lfs -text +*.parquet filter=lfs diff=lfs merge=lfs -text +*.pb filter=lfs diff=lfs merge=lfs -text +*.pickle filter=lfs diff=lfs merge=lfs -text +*.pkl filter=lfs diff=lfs merge=lfs -text +*.pt filter=lfs diff=lfs merge=lfs -text +*.pth filter=lfs diff=lfs merge=lfs -text +*.rar filter=lfs diff=lfs merge=lfs -text +*.safetensors filter=lfs diff=lfs merge=lfs -text +saved_model/**/* filter=lfs diff=lfs merge=lfs -text +*.tar.* filter=lfs diff=lfs merge=lfs -text +*.tar filter=lfs diff=lfs merge=lfs -text +*.tflite filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.wasm filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text +*tfevents* filter=lfs diff=lfs merge=lfs -text +tokenizer.json filter=lfs diff=lfs merge=lfs -text +hero.png filter=lfs diff=lfs merge=lfs -text +Ektome-SmolLM3-3B-IQ3_M.gguf filter=lfs diff=lfs merge=lfs -text +Ektome-SmolLM3-3B-IQ4_XS.gguf filter=lfs diff=lfs merge=lfs -text +Ektome-SmolLM3-3B-Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text +Ektome-SmolLM3-3B-Q5_K_M.gguf filter=lfs diff=lfs merge=lfs -text +Ektome-SmolLM3-3B-Q6_K.gguf filter=lfs diff=lfs merge=lfs -text +Ektome-SmolLM3-3B-Q8_0.gguf filter=lfs diff=lfs merge=lfs -text +imatrix.dat filter=lfs diff=lfs merge=lfs -text diff --git a/Ektome-SmolLM3-3B-IQ3_M.gguf b/Ektome-SmolLM3-3B-IQ3_M.gguf new file mode 100644 index 0000000..8909763 --- /dev/null +++ b/Ektome-SmolLM3-3B-IQ3_M.gguf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f5ae3d40e0b16bc1dd23d706fbd06318cb7386a5c72be1db24d8a6c5a4a4fdcb +size 1469357728 diff --git a/Ektome-SmolLM3-3B-IQ4_XS.gguf b/Ektome-SmolLM3-3B-IQ4_XS.gguf new file mode 100644 index 0000000..57e1866 --- /dev/null +++ b/Ektome-SmolLM3-3B-IQ4_XS.gguf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0e4aa82fc54db6dae6805762f5fce7b92dd06585aa207c8cc4b63446d351b373 +size 1723834016 diff --git a/Ektome-SmolLM3-3B-Q4_K_M.gguf b/Ektome-SmolLM3-3B-Q4_K_M.gguf new file mode 100644 index 0000000..0d2c976 --- /dev/null +++ b/Ektome-SmolLM3-3B-Q4_K_M.gguf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9c1271a807592d9473227e7a75d486685ebbe5a492eb894559343be4d13c248d +size 1915305632 diff --git a/Ektome-SmolLM3-3B-Q5_K_M.gguf b/Ektome-SmolLM3-3B-Q5_K_M.gguf new file mode 100644 index 0000000..01f3d49 --- /dev/null +++ b/Ektome-SmolLM3-3B-Q5_K_M.gguf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e0db5be069a8043368c513e82ff4a88ce159934ada12e780666ba5dbc93adbe9 +size 2213756576 diff --git a/Ektome-SmolLM3-3B-Q6_K.gguf b/Ektome-SmolLM3-3B-Q6_K.gguf new file mode 100644 index 0000000..ec81c07 --- /dev/null +++ b/Ektome-SmolLM3-3B-Q6_K.gguf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bfebd1bb4c820902a9466e9b333f9db328e960ea02eb12147b3906dccecf5d8a +size 2530860704 diff --git a/Ektome-SmolLM3-3B-Q8_0.gguf b/Ektome-SmolLM3-3B-Q8_0.gguf new file mode 100644 index 0000000..709ce60 --- /dev/null +++ b/Ektome-SmolLM3-3B-Q8_0.gguf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cd8b5d1edb4c96c93c285a97532481a842944df27d6e356be6c6c8a40ba92abf +size 3275574944 diff --git a/README.md b/README.md new file mode 100644 index 0000000..9d259f3 --- /dev/null +++ b/README.md @@ -0,0 +1,121 @@ +--- +license: apache-2.0 +base_model: HuggingFaceTB/SmolLM3-3B +tags: + - uncensored + - abliterated + - uncertified + - ektome + - sphragis + - smollm3 +language: + - en +pipeline_tag: text-generation +--- + +![Ektome-SmolLM3-3B-PristinelyUncensored](./hero.png) + +# Ektome-SmolLM3-3B-PristinelyUncensored + +**Uncensored. No n=2800 certificate has been run for this model, so no capability-retention claim is made.** + +> **compliance 0.44 to 0.99 at capability -0.007 vs pristine.** + +$$\colorbox{black}{$\color{white} +\begin{array}{ll} +\textsf{EKTOME CERTIFICATE} & {} \\ +\textsf{capability} & \textsf{NOT} \\ +\textsf{margin} & 3\% \\ +\textsf{items } n & 200 \\ +\textsf{worst-axis bound} & -0.007 \\ +\textsf{compliance} & 0.44 \rightarrow 0.99 \\ +\end{array}$}$$ + +> ### ⚠️ Not certified +> +> No n=2800 paired certificate exists for this model. Any numbers below are +> point estimates with no confidence interval. + + +📄 **[Read the whitepaper (PDF)](./whitepaper.pdf)** — full method, receipts and certification. +The PDF is the authoritative document: dark-typeset, with the complete derivation, the +per-axis certificate and the reproducibility hashes. + +--- + +## Why this exists + +Standard abliteration removes a coarse *refusal direction* that is entangled with +directions carrying knowledge and reasoning. The result is an uncensored model with a +capability tax that is **almost never measured**. + +Ektomē (ἐκτομή, *excision*) isolates and removes only the refusal-**specific** +component, leaving general helpfulness intact, and does so norm-preservingly on the +pristine model — no training, no distillation, no damage to repair. The extraction +depth is selected per model by automated search against measured compliance. + +The estimator, excision operator and depth-selection procedure are proprietary. +What is published here is the **measured outcome** and the evidence for it, which you +can verify against the artifacts in this repo. + +## The receipt + +| model | capability (MMLU-val) ↑ | compliance on harmful ↑ | +|---|---|---| +| pristine `SmolLM3-3B` | 0.560 | 0.440 | +| **Ektomē (this model)** | **0.568** | **0.990** | + +These are **point estimates with no confidence interval** — which is precisely why the next section exists. + + +## The certificate + +Capability retention is certified by a paired non-inferiority test against the pristine +model (exact McNemar, Holm-corrected, one-sided bootstrap bound on the drop $d$ vs a +3% margin): + +| axis | n | ref | cand | d upper | verdict | +|---|---|---|---|---|---| +| MMLU-val (POINT ESTIMATE, n=200, no CI) | 200 | 0.560 | 0.568 | -0.007 | UNCERTIFIED | + + +**Overall: NOT CERTIFIED - no n=2800 paired test has been run for this model** + +Reproducible from `seed=20260726`, pack `sha256:7bbaff877146e081…`. + +### Generation health checks + +| metric | pristine | Ektomē | n | +|---|---|---|---| +| `foreign_rate` | 0.0 | 0.0 | 15 | +| `degen_rate` | 0.0 | 0.0 | 15 | +| `instr_pass` | 0.4 | 0.4 | 5 | + +These are **degeneration guards** — code-switching, babbling, format compliance — +not capability measures. Note the sample sizes: they detect a broken model, not a +subtly weaker one. The capability claim rests on the certificate above, not here. + + +## Quantisations + +_No quantisations have been published for this model yet — bf16 weights only._ + + +## Limitations + +The certificate bounds **capability retention only**. It does not certify safety, factual +accuracy, or fitness for any purpose. Axes marked *inconclusive* are honestly +under-powered, and the certificate states the $n$ needed to resolve them. Compliance uses +a keyword classifier — a proxy that evasive phrasing can fool. **This model is uncensored +by construction: it will not refuse, and you are accountable for what you do with it.** + +## Citation + +```bibtex +@software{ektome_Ektome-SmolLM3-3B-PristinelyUncensored, + title = {Ektome-SmolLM3-3B-PristinelyUncensored}, + author = {Zynerji}, + year = {2026}, + url = {https://huggingface.co/Zynerji/Ektome-SmolLM3-3B-PristinelyUncensored} +} +``` diff --git a/chat_template.jinja b/chat_template.jinja new file mode 100644 index 0000000..e01e3a1 --- /dev/null +++ b/chat_template.jinja @@ -0,0 +1,94 @@ +{# ───── defaults ───── #} +{%- if enable_thinking is not defined -%} +{%- set enable_thinking = true -%} +{%- endif -%} + +{# ───── reasoning mode ───── #} +{%- if enable_thinking -%} + {%- set reasoning_mode = "/think" -%} +{%- else -%} + {%- set reasoning_mode = "/no_think" -%} +{%- endif -%} + +{# ───── header (system message) ───── #} +{{- "<|im_start|>system\n" -}} + +{%- if messages[0].role == "system" -%} + {%- set system_message = messages[0].content -%} + {%- if "/no_think" in system_message -%} + {%- set reasoning_mode = "/no_think" -%} + {%- elif "/think" in system_message -%} + {%- set reasoning_mode = "/think" -%} + {%- endif -%} + {%- set custom_instructions = system_message.replace("/no_think", "").replace("/think", "").rstrip() -%} +{%- endif -%} + +{%- if "/system_override" in system_message -%} + {{- custom_instructions.replace("/system_override", "").rstrip() -}} + {{- "<|im_end|>\n" -}} +{%- else -%} + {{- "## Metadata\n\n" -}} + {{- "Knowledge Cutoff Date: June 2025\n" -}} + {%- set today = strftime_now("%d %B %Y") -%} + {{- "Today Date: " ~ today ~ "\n" -}} + {{- "Reasoning Mode: " + reasoning_mode + "\n\n" -}} + + {{- "## Custom Instructions\n\n" -}} + {%- if custom_instructions -%} + {{- custom_instructions + "\n\n" -}} + {%- elif reasoning_mode == "/think" -%} + {{- "You are a helpful AI assistant named SmolLM, trained by Hugging Face. Your role as an assistant involves thoroughly exploring questions through a systematic thinking process before providing the final precise and accurate solutions. This requires engaging in a comprehensive cycle of analysis, summarizing, exploration, reassessment, reflection, backtracking, and iteration to develop well-considered thinking process. Please structure your response into two main sections: Thought and Solution using the specified format: Thought section Solution section. In the Thought section, detail your reasoning process in steps. Each step should include detailed considerations such as analysing questions, summarizing relevant findings, brainstorming new ideas, verifying the accuracy of the current steps, refining any errors, and revisiting previous steps. In the Solution section, based on various attempts, explorations, and reflections from the Thought section, systematically present the final solution that you deem correct. The Solution section should be logical, accurate, and concise and detail necessary steps needed to reach the conclusion.\n\n" -}} + {%- else -%} + {{- "You are a helpful AI assistant named SmolLM, trained by Hugging Face.\n\n" -}} + {%- endif -%} + + {%- if xml_tools or python_tools or tools -%} + {{- "### Tools\n\n" -}} + {%- if xml_tools or tools -%} + {%- if tools -%} + {%- set xml_tools = tools -%} + {%- endif -%} + {%- set ns = namespace(xml_tool_string="You may call one or more functions to assist with the user query.\nYou are provided with function signatures within XML tags:\n\n\n") -%} + {%- for tool in xml_tools[:] -%} {# The slicing makes sure that xml_tools is a list #} + {%- set ns.xml_tool_string = ns.xml_tool_string ~ (tool | string) ~ "\n" -%} + {%- endfor -%} + {%- set xml_tool_string = ns.xml_tool_string + "\n\nFor each function call, return a json object with function name and arguments within XML tags:\n\n{\"name\": , \"arguments\": }\n" -%} + {{- xml_tool_string -}} + {%- endif -%} + {%- if python_tools -%} + {%- set ns = namespace(python_tool_string="When you send a message containing Python code between '' and '' tags, it will be executed in a stateful Jupyter notebook environment, and you will then be given the output to continued reasoning in an agentic loop.\n\nYou can use the following tools in your python code like regular functions:\n\n") -%} + {%- for tool in python_tools[:] -%} {# The slicing makes sure that python_tools is a list #} + {%- set ns.python_tool_string = ns.python_tool_string ~ (tool | string) ~ "\n" -%} + {%- endfor -%} + {%- set python_tool_string = ns.python_tool_string + "\n\nThe state persists between code executions: so variables that you define in one step are still available thereafter." -%} + {{- python_tool_string -}} + {%- endif -%} + {{- "\n\n" -}} + {{- "<|im_end|>\n" -}} + {%- endif -%} +{%- endif -%} +{# ───── main loop ───── #} +{%- for message in messages -%} + {%- set content = message.content if message.content is string else "" -%} + {%- if message.role == "user" -%} + {{ "<|im_start|>" + message.role + "\n" + content + "<|im_end|>\n" }} + {%- elif message.role == "assistant" -%} + {% generation %} + {%- if reasoning_mode == "/think" -%} + {{ "<|im_start|>assistant\n" + content.lstrip("\n") + "<|im_end|>\n" }} + {%- else -%} + {{ "<|im_start|>assistant\n" + "\n\n\n" + content.lstrip("\n") + "<|im_end|>\n" }} + {%- endif -%} + {% endgeneration %} + {%- elif message.role == "tool" -%} + {{ "<|im_start|>" + "user\n" + content + "<|im_end|>\n" }} + {%- endif -%} +{%- endfor -%} +{# ───── generation prompt ───── #} +{%- if add_generation_prompt -%} + {%- if reasoning_mode == "/think" -%} + {{ "<|im_start|>assistant\n" }} + {%- else -%} + {{ "<|im_start|>assistant\n" + "\n\n\n" }} + {%- endif -%} +{%- endif -%} \ No newline at end of file diff --git a/config.json b/config.json new file mode 100644 index 0000000..01e36f4 --- /dev/null +++ b/config.json @@ -0,0 +1,111 @@ +{ + "architectures": [ + "SmolLM3ForCausalLM" + ], + "attention_bias": false, + "attention_dropout": 0.0, + "bos_token_id": 128000, + "dtype": "bfloat16", + "eos_token_id": 128012, + "hidden_act": "silu", + "hidden_size": 2048, + "initializer_range": 0.02, + "intermediate_size": 11008, + "layer_types": [ + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention" + ], + "max_position_embeddings": 65536, + "max_window_layers": 28, + "mlp_bias": false, + "model_type": "smollm3", + "no_rope_layer_interval": 4, + "no_rope_layers": [ + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 0 + ], + "num_attention_heads": 16, + "num_hidden_layers": 36, + "num_key_value_heads": 4, + "pad_token_id": 128004, + "pretraining_tp": 2, + "rms_norm_eps": 1e-06, + "rope_parameters": { + "rope_theta": 5000000.0, + "rope_type": "default" + }, + "sliding_window": null, + "tie_word_embeddings": true, + "transformers_version": "5.13.1", + "use_cache": false, + "use_sliding_window": false, + "vocab_size": 128256 +} diff --git a/ektome_report.json b/ektome_report.json new file mode 100644 index 0000000..1e174e0 --- /dev/null +++ b/ektome_report.json @@ -0,0 +1,28 @@ +{ + "status": "SHIP", + "target": 0.99, + "SE_mmlu": 0.02481934729198171, + "base_compliance": 0.44, + "compliance": 0.99, + "base_cap": 0.56, + "cap": 0.5675, + "dcap": 0.0075, + "gen_base": { + "foreign_rate": 0.0, + "degen_rate": 0.0, + "instr_pass": 0.4 + }, + "gen": { + "foreign_rate": 0.0, + "degen_rate": 0.0, + "instr_pass": 0.4 + }, + "gen_delta": { + "d_foreign": 0.0, + "d_degen": 0.0, + "d_instr": 0.0, + "holds_gen": true + }, + "base_model": "HuggingFaceTB/SmolLM3-3B", + "_note": "Redacted: search trajectory, selected depth and edit-scope removed. Reported values are the measured outcome only." +} \ No newline at end of file diff --git a/generation_config.json b/generation_config.json new file mode 100644 index 0000000..fef0659 --- /dev/null +++ b/generation_config.json @@ -0,0 +1,9 @@ +{ + "bos_token_id": 128000, + "do_sample": true, + "eos_token_id": 128012, + "pad_token_id": 128004, + "temperature": 0.6, + "top_p": 0.95, + "transformers_version": "5.13.1" +} diff --git a/hero.png b/hero.png new file mode 100644 index 0000000..7898955 --- /dev/null +++ b/hero.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:571cbd808b39c80acf68efe647b6c00fbb94564066f86fe8a5d12bdeb0e87365 +size 240366 diff --git a/imatrix.dat b/imatrix.dat new file mode 100644 index 0000000..c9a6f52 --- /dev/null +++ b/imatrix.dat @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e4976b6a7444ed9a63dd8b59998c9c5055828ea95359e4dfaec75415c8be0517 +size 3393408 diff --git a/model.safetensors b/model.safetensors new file mode 100644 index 0000000..307225b --- /dev/null +++ b/model.safetensors @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f3bcd3ade165456e6043716578113f400c68c32481c3f9fb6a29d3ebfbf42d2e +size 6150235096 diff --git a/nvfp4/chat_template.jinja b/nvfp4/chat_template.jinja new file mode 100644 index 0000000..e01e3a1 --- /dev/null +++ b/nvfp4/chat_template.jinja @@ -0,0 +1,94 @@ +{# ───── defaults ───── #} +{%- if enable_thinking is not defined -%} +{%- set enable_thinking = true -%} +{%- endif -%} + +{# ───── reasoning mode ───── #} +{%- if enable_thinking -%} + {%- set reasoning_mode = "/think" -%} +{%- else -%} + {%- set reasoning_mode = "/no_think" -%} +{%- endif -%} + +{# ───── header (system message) ───── #} +{{- "<|im_start|>system\n" -}} + +{%- if messages[0].role == "system" -%} + {%- set system_message = messages[0].content -%} + {%- if "/no_think" in system_message -%} + {%- set reasoning_mode = "/no_think" -%} + {%- elif "/think" in system_message -%} + {%- set reasoning_mode = "/think" -%} + {%- endif -%} + {%- set custom_instructions = system_message.replace("/no_think", "").replace("/think", "").rstrip() -%} +{%- endif -%} + +{%- if "/system_override" in system_message -%} + {{- custom_instructions.replace("/system_override", "").rstrip() -}} + {{- "<|im_end|>\n" -}} +{%- else -%} + {{- "## Metadata\n\n" -}} + {{- "Knowledge Cutoff Date: June 2025\n" -}} + {%- set today = strftime_now("%d %B %Y") -%} + {{- "Today Date: " ~ today ~ "\n" -}} + {{- "Reasoning Mode: " + reasoning_mode + "\n\n" -}} + + {{- "## Custom Instructions\n\n" -}} + {%- if custom_instructions -%} + {{- custom_instructions + "\n\n" -}} + {%- elif reasoning_mode == "/think" -%} + {{- "You are a helpful AI assistant named SmolLM, trained by Hugging Face. Your role as an assistant involves thoroughly exploring questions through a systematic thinking process before providing the final precise and accurate solutions. This requires engaging in a comprehensive cycle of analysis, summarizing, exploration, reassessment, reflection, backtracking, and iteration to develop well-considered thinking process. Please structure your response into two main sections: Thought and Solution using the specified format: Thought section Solution section. In the Thought section, detail your reasoning process in steps. Each step should include detailed considerations such as analysing questions, summarizing relevant findings, brainstorming new ideas, verifying the accuracy of the current steps, refining any errors, and revisiting previous steps. In the Solution section, based on various attempts, explorations, and reflections from the Thought section, systematically present the final solution that you deem correct. The Solution section should be logical, accurate, and concise and detail necessary steps needed to reach the conclusion.\n\n" -}} + {%- else -%} + {{- "You are a helpful AI assistant named SmolLM, trained by Hugging Face.\n\n" -}} + {%- endif -%} + + {%- if xml_tools or python_tools or tools -%} + {{- "### Tools\n\n" -}} + {%- if xml_tools or tools -%} + {%- if tools -%} + {%- set xml_tools = tools -%} + {%- endif -%} + {%- set ns = namespace(xml_tool_string="You may call one or more functions to assist with the user query.\nYou are provided with function signatures within XML tags:\n\n\n") -%} + {%- for tool in xml_tools[:] -%} {# The slicing makes sure that xml_tools is a list #} + {%- set ns.xml_tool_string = ns.xml_tool_string ~ (tool | string) ~ "\n" -%} + {%- endfor -%} + {%- set xml_tool_string = ns.xml_tool_string + "\n\nFor each function call, return a json object with function name and arguments within XML tags:\n\n{\"name\": , \"arguments\": }\n" -%} + {{- xml_tool_string -}} + {%- endif -%} + {%- if python_tools -%} + {%- set ns = namespace(python_tool_string="When you send a message containing Python code between '' and '' tags, it will be executed in a stateful Jupyter notebook environment, and you will then be given the output to continued reasoning in an agentic loop.\n\nYou can use the following tools in your python code like regular functions:\n\n") -%} + {%- for tool in python_tools[:] -%} {# The slicing makes sure that python_tools is a list #} + {%- set ns.python_tool_string = ns.python_tool_string ~ (tool | string) ~ "\n" -%} + {%- endfor -%} + {%- set python_tool_string = ns.python_tool_string + "\n\nThe state persists between code executions: so variables that you define in one step are still available thereafter." -%} + {{- python_tool_string -}} + {%- endif -%} + {{- "\n\n" -}} + {{- "<|im_end|>\n" -}} + {%- endif -%} +{%- endif -%} +{# ───── main loop ───── #} +{%- for message in messages -%} + {%- set content = message.content if message.content is string else "" -%} + {%- if message.role == "user" -%} + {{ "<|im_start|>" + message.role + "\n" + content + "<|im_end|>\n" }} + {%- elif message.role == "assistant" -%} + {% generation %} + {%- if reasoning_mode == "/think" -%} + {{ "<|im_start|>assistant\n" + content.lstrip("\n") + "<|im_end|>\n" }} + {%- else -%} + {{ "<|im_start|>assistant\n" + "\n\n\n" + content.lstrip("\n") + "<|im_end|>\n" }} + {%- endif -%} + {% endgeneration %} + {%- elif message.role == "tool" -%} + {{ "<|im_start|>" + "user\n" + content + "<|im_end|>\n" }} + {%- endif -%} +{%- endfor -%} +{# ───── generation prompt ───── #} +{%- if add_generation_prompt -%} + {%- if reasoning_mode == "/think" -%} + {{ "<|im_start|>assistant\n" }} + {%- else -%} + {{ "<|im_start|>assistant\n" + "\n\n\n" }} + {%- endif -%} +{%- endif -%} \ No newline at end of file diff --git a/nvfp4/config.json b/nvfp4/config.json new file mode 100644 index 0000000..28be837 --- /dev/null +++ b/nvfp4/config.json @@ -0,0 +1,161 @@ +{ + "architectures": [ + "SmolLM3ForCausalLM" + ], + "attention_bias": false, + "attention_dropout": 0.0, + "bos_token_id": 128000, + "dtype": "bfloat16", + "eos_token_id": 128012, + "hidden_act": "silu", + "hidden_size": 2048, + "initializer_range": 0.02, + "intermediate_size": 11008, + "layer_types": [ + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention", + "full_attention" + ], + "max_position_embeddings": 65536, + "max_window_layers": 28, + "mlp_bias": false, + "model_type": "smollm3", + "no_rope_layer_interval": 4, + "no_rope_layers": [ + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 0 + ], + "num_attention_heads": 16, + "num_hidden_layers": 36, + "num_key_value_heads": 4, + "pad_token_id": 128004, + "pretraining_tp": 2, + "quantization_config": { + "config_groups": { + "group_0": { + "format": "nvfp4-pack-quantized", + "input_activations": { + "actorder": null, + "block_structure": null, + "dynamic": "local", + "group_size": 16, + "num_bits": 4, + "observer": "static_minmax", + "observer_kwargs": {}, + "scale_dtype": "torch.float8_e4m3fn", + "strategy": "tensor_group", + "symmetric": true, + "type": "float", + "zp_dtype": null + }, + "output_activations": null, + "targets": [ + "Linear" + ], + "weights": { + "actorder": null, + "block_structure": null, + "dynamic": false, + "group_size": 16, + "num_bits": 4, + "observer": "memoryless_minmax", + "observer_kwargs": {}, + "scale_dtype": "torch.float8_e4m3fn", + "strategy": "tensor_group", + "symmetric": true, + "type": "float", + "zp_dtype": null + } + } + }, + "format": "nvfp4-pack-quantized", + "global_compression_ratio": null, + "ignore": [ + "lm_head" + ], + "kv_cache_scheme": null, + "quant_method": "compressed-tensors", + "quantization_status": "compressed", + "sparsity_config": {}, + "transform_config": {}, + "version": "0.17.1" + }, + "rms_norm_eps": 1e-06, + "rope_parameters": { + "rope_theta": 5000000.0, + "rope_type": "default" + }, + "sliding_window": null, + "tie_word_embeddings": true, + "transformers_version": "5.10.1", + "use_cache": false, + "use_sliding_window": false, + "vocab_size": 128256 +} \ No newline at end of file diff --git a/nvfp4/generation_config.json b/nvfp4/generation_config.json new file mode 100644 index 0000000..b667da2 --- /dev/null +++ b/nvfp4/generation_config.json @@ -0,0 +1,9 @@ +{ + "bos_token_id": 128000, + "do_sample": true, + "eos_token_id": 128012, + "pad_token_id": 128004, + "temperature": 0.6, + "top_p": 0.95, + "transformers_version": "5.10.1" +} diff --git a/nvfp4/model.safetensors b/nvfp4/model.safetensors new file mode 100644 index 0000000..9cde647 --- /dev/null +++ b/nvfp4/model.safetensors @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:546f3e1ea37331d754b0412ba7d427e1c34914def4987311d8bb98c94dc9cf06 +size 2107668936 diff --git a/nvfp4/recipe.yaml b/nvfp4/recipe.yaml new file mode 100644 index 0000000..6a93bcc --- /dev/null +++ b/nvfp4/recipe.yaml @@ -0,0 +1,7 @@ +default_stage: + default_modifiers: + QuantizationModifier: + targets: [Linear] + ignore: [lm_head] + scheme: NVFP4 + bypass_divisibility_checks: false diff --git a/nvfp4/tokenizer.json b/nvfp4/tokenizer.json new file mode 100644 index 0000000..074fa66 --- /dev/null +++ b/nvfp4/tokenizer.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7b6a500b662a34eb3f0374db856ba4ad7de4c81040571d78dc0d357238930005 +size 17208819 diff --git a/nvfp4/tokenizer_config.json b/nvfp4/tokenizer_config.json new file mode 100644 index 0000000..8804a73 --- /dev/null +++ b/nvfp4/tokenizer_config.json @@ -0,0 +1,16 @@ +{ + "backend": "tokenizers", + "bos_token": null, + "clean_up_tokenization_spaces": true, + "eos_token": "<|im_end|>", + "fast": false, + "is_local": false, + "local_files_only": false, + "model_input_names": [ + "input_ids", + "attention_mask" + ], + "model_max_length": 131072, + "pad_token": "<|im_end|>", + "tokenizer_class": "TokenizersBackend" +} diff --git a/special_tokens_map.json b/special_tokens_map.json new file mode 100644 index 0000000..190d562 --- /dev/null +++ b/special_tokens_map.json @@ -0,0 +1,16 @@ +{ + "eos_token": { + "content": "<|im_end|>", + "lstrip": false, + "normalized": false, + "rstrip": false, + "single_word": false + }, + "pad_token": { + "content": "<|im_end|>", + "lstrip": false, + "normalized": false, + "rstrip": false, + "single_word": false + } +} diff --git a/tokenizer.json b/tokenizer.json new file mode 100644 index 0000000..074fa66 --- /dev/null +++ b/tokenizer.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7b6a500b662a34eb3f0374db856ba4ad7de4c81040571d78dc0d357238930005 +size 17208819 diff --git a/tokenizer_config.json b/tokenizer_config.json new file mode 100644 index 0000000..d68ea85 --- /dev/null +++ b/tokenizer_config.json @@ -0,0 +1,17 @@ +{ + "backend": "tokenizers", + "bos_token": null, + "clean_up_tokenization_spaces": true, + "eos_token": "<|im_end|>", + "fast": false, + "is_local": false, + "local_files_only": false, + "model_input_names": [ + "input_ids", + "attention_mask" + ], + "model_max_length": 131072, + "pad_token": "<|im_end|>", + "tokenizer_class": "TokenizersBackend", + "chat_template": "{# ───── defaults ───── #}\n{%- if enable_thinking is not defined -%}\n{%- set enable_thinking = true -%}\n{%- endif -%}\n\n{# ───── reasoning mode ───── #}\n{%- if enable_thinking -%}\n {%- set reasoning_mode = \"/think\" -%}\n{%- else -%}\n {%- set reasoning_mode = \"/no_think\" -%}\n{%- endif -%}\n\n{# ───── header (system message) ───── #}\n{{- \"<|im_start|>system\\n\" -}}\n\n{%- if messages[0].role == \"system\" -%}\n {%- set system_message = messages[0].content -%}\n {%- if \"/no_think\" in system_message -%}\n {%- set reasoning_mode = \"/no_think\" -%}\n {%- elif \"/think\" in system_message -%}\n {%- set reasoning_mode = \"/think\" -%}\n {%- endif -%}\n {%- set custom_instructions = system_message.replace(\"/no_think\", \"\").replace(\"/think\", \"\").rstrip() -%}\n{%- endif -%}\n\n{%- if \"/system_override\" in system_message -%}\n {{- custom_instructions.replace(\"/system_override\", \"\").rstrip() -}}\n {{- \"<|im_end|>\\n\" -}}\n{%- else -%}\n {{- \"## Metadata\\n\\n\" -}}\n {{- \"Knowledge Cutoff Date: June 2025\\n\" -}}\n {%- set today = strftime_now(\"%d %B %Y\") -%}\n {{- \"Today Date: \" ~ today ~ \"\\n\" -}}\n {{- \"Reasoning Mode: \" + reasoning_mode + \"\\n\\n\" -}}\n \n {{- \"## Custom Instructions\\n\\n\" -}}\n {%- if custom_instructions -%}\n {{- custom_instructions + \"\\n\\n\" -}}\n {%- elif reasoning_mode == \"/think\" -%}\n {{- \"You are a helpful AI assistant named SmolLM, trained by Hugging Face. Your role as an assistant involves thoroughly exploring questions through a systematic thinking process before providing the final precise and accurate solutions. This requires engaging in a comprehensive cycle of analysis, summarizing, exploration, reassessment, reflection, backtracking, and iteration to develop well-considered thinking process. Please structure your response into two main sections: Thought and Solution using the specified format: Thought section Solution section. In the Thought section, detail your reasoning process in steps. Each step should include detailed considerations such as analysing questions, summarizing relevant findings, brainstorming new ideas, verifying the accuracy of the current steps, refining any errors, and revisiting previous steps. In the Solution section, based on various attempts, explorations, and reflections from the Thought section, systematically present the final solution that you deem correct. The Solution section should be logical, accurate, and concise and detail necessary steps needed to reach the conclusion.\\n\\n\" -}}\n {%- else -%}\n {{- \"You are a helpful AI assistant named SmolLM, trained by Hugging Face.\\n\\n\" -}}\n {%- endif -%}\n\n {%- if xml_tools or python_tools or tools -%}\n {{- \"### Tools\\n\\n\" -}}\n {%- if xml_tools or tools -%}\n {%- if tools -%}\n {%- set xml_tools = tools -%}\n {%- endif -%}\n {%- set ns = namespace(xml_tool_string=\"You may call one or more functions to assist with the user query.\\nYou are provided with function signatures within XML tags:\\n\\n\\n\") -%}\n {%- for tool in xml_tools[:] -%} {# The slicing makes sure that xml_tools is a list #}\n {%- set ns.xml_tool_string = ns.xml_tool_string ~ (tool | string) ~ \"\\n\" -%}\n {%- endfor -%}\n {%- set xml_tool_string = ns.xml_tool_string + \"\\n\\nFor each function call, return a json object with function name and arguments within XML tags:\\n\\n{\\\"name\\\": , \\\"arguments\\\": }\\n\" -%}\n {{- xml_tool_string -}}\n {%- endif -%}\n {%- if python_tools -%}\n {%- set ns = namespace(python_tool_string=\"When you send a message containing Python code between '' and '' tags, it will be executed in a stateful Jupyter notebook environment, and you will then be given the output to continued reasoning in an agentic loop.\\n\\nYou can use the following tools in your python code like regular functions:\\n\\n\") -%}\n {%- for tool in python_tools[:] -%} {# The slicing makes sure that python_tools is a list #}\n {%- set ns.python_tool_string = ns.python_tool_string ~ (tool | string) ~ \"\\n\" -%}\n {%- endfor -%}\n {%- set python_tool_string = ns.python_tool_string + \"\\n\\nThe state persists between code executions: so variables that you define in one step are still available thereafter.\" -%}\n {{- python_tool_string -}}\n {%- endif -%}\n {{- \"\\n\\n\" -}}\n {{- \"<|im_end|>\\n\" -}}\n {%- endif -%}\n{%- endif -%}\n{# ───── main loop ───── #}\n{%- for message in messages -%}\n {%- set content = message.content if message.content is string else \"\" -%}\n {%- if message.role == \"user\" -%}\n {{ \"<|im_start|>\" + message.role + \"\\n\" + content + \"<|im_end|>\\n\" }}\n {%- elif message.role == \"assistant\" -%}\n {% generation %}\n {%- if reasoning_mode == \"/think\" -%}\n {{ \"<|im_start|>assistant\\n\" + content.lstrip(\"\\n\") + \"<|im_end|>\\n\" }}\n {%- else -%}\n {{ \"<|im_start|>assistant\\n\" + \"\\n\\n\\n\" + content.lstrip(\"\\n\") + \"<|im_end|>\\n\" }}\n {%- endif -%}\n {% endgeneration %}\n {%- elif message.role == \"tool\" -%}\n {{ \"<|im_start|>\" + \"user\\n\" + content + \"<|im_end|>\\n\" }}\n {%- endif -%}\n{%- endfor -%}\n{# ───── generation prompt ───── #}\n{%- if add_generation_prompt -%}\n {%- if reasoning_mode == \"/think\" -%}\n {{ \"<|im_start|>assistant\\n\" }}\n {%- else -%}\n {{ \"<|im_start|>assistant\\n\" + \"\\n\\n\\n\" }}\n {%- endif -%}\n{%- endif -%}" +} \ No newline at end of file diff --git a/whitepaper.pdf b/whitepaper.pdf new file mode 100644 index 0000000..93cd8c2 Binary files /dev/null and b/whitepaper.pdf differ