commit ae0f8da94f9750424508da395e557ca7c7571cb3 Author: ModelHub XC Date: Sun Jun 21 11:53:20 2026 +0800 初始化项目,由ModelHub XC社区提供模型 Model: NoesisLab/Arcade-3B Source: Original Platform diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..401f451 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,38 @@ +*.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 +benchmark_comparison.png filter=lfs diff=lfs merge=lfs -text +dia.jpg filter=lfs diff=lfs merge=lfs -text diff --git a/README.md b/README.md new file mode 100644 index 0000000..93bf7bc --- /dev/null +++ b/README.md @@ -0,0 +1,143 @@ +--- +language: +- en +license: apache-2.0 +base_model: HuggingFaceTB/SmolLM3-3B +tags: +- smollm +- smolreasoner +- reasoning +- instruction-tuned +- arcade +- sc-orthogonal +pipeline_tag: text-generation +--- + +# Arcade-3B — SmolReasoner + +[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.19029063.svg)](https://doi.org/10.5281/zenodo.19029063)[![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) +[![Base Model](https://img.shields.io/badge/Base-SmolLM3--3B-orange)](https://huggingface.co/HuggingFaceTB/SmolLM3-3B) +[![NoesisLab](https://img.shields.io/badge/Lab-NoesisLab-purple)](https://huggingface.co/NoesisLab) +[![GSM8K](https://img.shields.io/badge/GSM8K-62.9%25-brightgreen)](https://huggingface.co/NoesisLab/Arcade-3B) +[![ARC-Easy](https://img.shields.io/badge/ARC--Easy-74.4%25-brightgreen)](https://huggingface.co/NoesisLab/Arcade-3B) + +**Arcade-3B** is a 3B instruction-following and reasoning model built on [SmolLM3-3B](https://huggingface.co/HuggingFaceTB/SmolLM3-3B). +It is the first public release from the **ARCADE** project at [NoesisLab](https://huggingface.co/NoesisLab), which investigates the *State–Constraint Orthogonality Hypothesis*: standard Transformer hidden states conflate factual content and reasoning structure in the same subspace, and explicitly decoupling them improves generalization. + +--- + +## Method: SC-Orthogonal Training + +Standard Transformer hidden states conflate two distinct functions: + +| Half | Symbol | Role | +|------|--------|------| +| `H[..., :D/2]` | **S** (State) | *What* the model knows — factual content | +| `H[..., D/2:]` | **C** (Constraint) | *How* to retrieve it — reasoning structure | + +ARCADE's **SCOrthoTrainer** injects an orthogonality penalty on the final hidden layer, encouraging S and C to decouple in representation space without modifying any attention operators: + +$$\mathcal{L}_{\text{total}} = \mathcal{L}_{\text{CE}} + \frac{\lambda}{B \cdot L} \sum_{b,l} \left( \mathbf{S}_{b,l} \cdot \mathbf{C}_{b,l} \right)^2$$ + +with **λ = 0.1**. This soft regularization reduces divergence errors at inference time at zero architectural cost. + +![SC-Orthogonal Optimization Loop](dia.jpg) + +--- + +## Training Details + +| Setting | Value | +|---------|-------| +| Base model | `HuggingFaceTB/SmolLM3-3B` | +| λ (orth penalty) | 0.1 | +| Max sequence length | 2048 | +| Learning rate | 2e-4 (cosine) | +| Steps | 10 000 | +| Effective batch | 16 sequences/step | +| Hardware | 1 × A100-80 GB | +| Precision | bfloat16 | + +### Training Data + +| Dataset | Split | Sampling weight | +|---------|-------|-----------------| +| [nohurry/Opus-4.6-Reasoning-3000x-filtered](https://huggingface.co/datasets/nohurry/Opus-4.6-Reasoning-3000x-filtered) | train (2.3 K) | 10 % | +| [HuggingFaceTB/smol-smoltalk](https://huggingface.co/datasets/HuggingFaceTB/smol-smoltalk) | train (460 K) | 45 % | +| [OpenDataArena/ODA-Mixture-500k](https://huggingface.co/datasets/OpenDataArena/ODA-Mixture-500k) | train (500 K) | 45 % | + +Reasoning samples are wrapped with `…` tags and upsampled 10× to compensate for the small dataset size. + +--- + +## Evaluation + +Results from [lm-evaluation-harness](https://github.com/EleutherAI/lm-evaluation-harness): + +### Comparison with Peer Models + +![Benchmark Comparison](benchmark_comparison.png) + +> `< 10%` entries are displayed as `<10%` in the chart. + +| Benchmark | Arcade-3B | Gemma-2-2B | Llama-2-7B | Qwen1.5-1.8B | OpenLLaMA-v2-3B | +|-----------|-----------|------------|------------|--------------|-----------------| +| MMLU | **52.9%** | 52.4% | 45.3% | 46.8% | 41.0% | +| GSM8K | **62.9%** | 50.9% | 14.6% | 37.8% | < 10% | +| HumanEval | **41.5%** | 32.3% | 12.8% | 27.4% | < 10% | +| ARC-Challenge | 52.6% | **53.1%** | 46.2% | 41.2% | 34.2% | +| ARC-Easy | 74.4% | **75.9%** | 75.3% | 66.8% | 68.1% | + +### Arcade-3B Detailed Scores + +| Benchmark | Few-shot | Metric | Score | ± | +|-----------|----------|--------|-------|---| +| GSM8K | 5 | flexible-extract / exact_match | **0.6293** | 0.0133 | +| HumanEval | 0 | pass@1 | **0.4146** | 0.0386 | +| ARC-Challenge | 25 | acc_norm | **0.5256** | 0.0146 | +| ARC-Easy | 0 | acc | **0.7437** | 0.0090 | +| MMLU | 0 | acc | **0.5293** | 0.0040 | + +--- + +## Usage + +```python +from transformers import AutoTokenizer, AutoModelForCausalLM +import torch + +model_id = "NoesisLab/Arcade-3B" +tok = AutoTokenizer.from_pretrained(model_id) +model = AutoModelForCausalLM.from_pretrained( + model_id, + torch_dtype=torch.bfloat16, + device_map="auto", +) + +messages = [{"role": "user", "content": "Solve step by step: If a train travels 120 km in 1.5 hours, what is its average speed?"}] +input_ids = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device) + +output = model.generate(input_ids, max_new_tokens=512, temperature=0.7, do_sample=True) +print(tok.decode(output[0][input_ids.shape[-1]:], skip_special_tokens=True)) +``` + +For step-by-step reasoning, the model may emit a `…` block before the final answer. + +--- + +## Citation + +```bibtex +@misc{noesislab2025arcade, + title = {ARCADE: State-Constraint Orthogonal Training}, + author = {NoesisLab}, + year = {2025}, + howpublished = {\url{https://huggingface.co/NoesisLab/Arcade-3B}}, +} +``` + +--- + +## License + +Apache 2.0 — inherited from SmolLM3-3B. diff --git a/benchmark_comparison.png b/benchmark_comparison.png new file mode 100644 index 0000000..f516675 --- /dev/null +++ b/benchmark_comparison.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:822c3f53e7599ef8a921ed6cabce22182b4263179a9565e58a3d59f8feaff7e9 +size 127895 diff --git a/chat_template.jinja b/chat_template.jinja new file mode 100644 index 0000000..7c50e31 --- /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 Arcade, 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 Arcade, 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..2770763 --- /dev/null +++ b/config.json @@ -0,0 +1,111 @@ +{ + "architectures": [ + "SmolLM3ForCausalLM" + ], + "attention_bias": false, + "attention_dropout": 0.0, + "bos_token_id": null, + "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": 128012, + "pretraining_tp": 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.3.0", + "use_cache": false, + "use_sliding_window": false, + "vocab_size": 128256 +} diff --git a/dia.jpg b/dia.jpg new file mode 100644 index 0000000..e07919e --- /dev/null +++ b/dia.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c4008b2bfd2fbba7cd0600f3ddd7ab064ed7dffc8c4e856a5f888adf25b9dabd +size 207006 diff --git a/generation_config.json b/generation_config.json new file mode 100644 index 0000000..0244913 --- /dev/null +++ b/generation_config.json @@ -0,0 +1,10 @@ +{ + "do_sample": true, + "eos_token_id": [ + 128012 + ], + "pad_token_id": 128012, + "temperature": 0.6, + "top_p": 0.95, + "transformers_version": "5.3.0" +} diff --git a/model.safetensors b/model.safetensors new file mode 100644 index 0000000..cd2d26f --- /dev/null +++ b/model.safetensors @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ca13b22db96e7ec59e8f2c86a5a725c436e7663c1a8f294b1e884211f13a492d +size 6150235096 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..66a8b32 --- /dev/null +++ b/tokenizer_config.json @@ -0,0 +1,14 @@ +{ + "backend": "tokenizers", + "bos_token": null, + "clean_up_tokenization_spaces": true, + "eos_token": "<|im_end|>", + "fast": false, + "is_local": false, + "model_input_names": [ + "input_ids", + "attention_mask" + ], + "model_max_length": 131072, + "pad_token": "<|im_end|>" +} \ No newline at end of file