commit f9d365e14946cc36972b444ca4959e3e88203c0b Author: ModelHub XC Date: Sun Aug 30 06:32:16 2026 +0800 初始化项目,由ModelHub XC社区提供模型 Model: maxzt/Roswaal-8B Source: Original Platform diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..52373fe --- /dev/null +++ b/.gitattributes @@ -0,0 +1,36 @@ +*.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 diff --git a/README.md b/README.md new file mode 100644 index 0000000..3af6f0e --- /dev/null +++ b/README.md @@ -0,0 +1,102 @@ +--- +license: apache-2.0 +base_model: Qwen3-8B +language: + - en +library_name: transformers +pipeline_tag: text-generation +tags: + - qwen3 + - reasoning + - uncensored + - chain-of-thought + - math + - gsm8k + - unsloth + - maxzt +--- + +![image](https://cdn-uploads.huggingface.co/production/uploads/6a535822f7c1c2b44a684b39/1klDT0g2XRYgvHnwPRI_X.png) + +# Roswaal-8B + +**Roswaal-8B** is a full-parameter reasoning model built on top of a **deeply uncensored Qwen3-8B** and post-trained via Chain-of-Thought (CoT) distillation. + +The result is a compact, fast, **dramatically more capable** 8B reasoning model that proves data quality beats brute-force volume. Headline capabilities: + +- **🏆 Dominates benchmarks:** Scores **87.64% exact_match** on the full GSM8K test set (1,319 questions) using 5-shot evaluation — outperforming both its base model and heavily fine-tuned 50K-synthetic variants. +- **🧠 Advanced Chain-of-Thought:** Strictly trained to deconstruct complex prompts, show its work step-by-step, and perform self-correction inside `` blocks before outputting the final answer. +- **⚡ High-Efficiency Training:** Trained locally on a single NVIDIA RTX 6000 Ada Generation (96GB VRAM) in just over an hour using [Unsloth](https://github.com/unslothai/unsloth) optimization. + +Roswaal-8B is intentionally designed to engage seriously with technically demanding, multi-step logical and mathematical challenges without unnecessary refusals or boilerplate disclaimers. + +--- + +## Benchmark Results + +![image](https://cdn-uploads.huggingface.co/production/uploads/6a535822f7c1c2b44a684b39/2otPSJ0-Yx3Gh365soPU2.png) + +Evaluated on the full GSM8K test set (1,319 problems) using `lm-evaluation-harness` with a 5-shot prompt configuration (`temperature=0.1` / low-temp reasoning). + +| Model | GSM8K Accuracy | +| :--- | :--- | +| Gemma 3 4B IT | 89.2% | +| Qwen2.5 Coder 14B Instruct | 88.7% | +| Phi-4-mini | 88.6% | +| **Roswaal-8B** | **87.64%** | +| Qwen2.5 Coder 7B Instruct | 86.7% | +| Phi 3.5 Mini Instruct | 86.2% | +| Phi-3 Medium (4k-instruct) | 85.2% | +| Gemma 2 9B | 84.9% | +| Llama 3.1 8B Instruct | 82.4% | +| **Qwen3-8B** | **79.4%** | +| Mistral-7B | 77.9% | +| Llama 3.2 3B | 77.7% | + +*Roswaal-8B scores 8.24 p.p. above Qwen3-8B on GSM8K.* + +--- + +## Methodology: Why It Works + +Unlike standard fine-tuning processes that attempt to map a question directly to an answer, Roswaal-8B was explicitly trained on ~20,000 highly curated Chain-of-Thought (CoT) sequences. + +The training objective forces the model to: +1. Deconstruct complex prompts into smaller, actionable logical steps. +2. Self-correct during the generation phase (e.g., catching internal arithmetic errors before outputting the final answer). +3. Strictly isolate its internal monologue from the user-facing output using specialized structural tags. + +--- + +### Hyperparameters + +| Parameter | SFT | +|---|---| +| Method | LoRA (16-bit) | +| LoRA rank (r) | 16 | +| LoRA alpha | 32 | +| LoRA targets | "q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj" | +| Learning rate | 1e-4 | +| Scheduler | Cosine | +| Optimizer | adamw_8bit | +| Epochs | 1 | +| Batch size | 8 | +| Gradient accumulation | 4 | +| Max sequence length | 2,048 | +| Precision | bf16 | +| Gradient checkpointing | Unsloth | + +--- + +## Prompt Format & Generation Strategy + +Roswaal-8B relies on the standard ChatML template but requires a specific generation logic. The model expects to enclose its reasoning process inside `...` tags. + +**Recommended Generation Parameters:** +- **Temperature:** `0.1` to `0.6` (Keep it low to prevent logical drift during complex math). +- **Top_p:** `0.9` +- **Max_new_tokens:** `1024` - `4096` (Crucial: The model needs enough token space to "think" before answering. Do not restrict this too heavily). + +--- + +**Developed by maxzt** \ No newline at end of file diff --git a/chat_template.jinja b/chat_template.jinja new file mode 100644 index 0000000..ecb8be2 --- /dev/null +++ b/chat_template.jinja @@ -0,0 +1,8 @@ +{% for message in messages %}{% if message['role'] == 'user' %}{{'<|im_start|>user +' + message['content'] + '<|im_end|> +'}}{% elif message['role'] == 'assistant' %}{{'<|im_start|>assistant +' + message['content'] + '<|im_end|> +' }}{% else %}{{ '<|im_start|>system +' + message['content'] + '<|im_end|> +' }}{% endif %}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant +' }}{% endif %} \ No newline at end of file diff --git a/config.json b/config.json new file mode 100644 index 0000000..17a60c1 --- /dev/null +++ b/config.json @@ -0,0 +1,71 @@ +{ + "architectures": [ + "Qwen3ForCausalLM" + ], + "attention_bias": false, + "attention_dropout": 0.0, + "bos_token_id": null, + "torch_dtype": "bfloat16", + "eos_token_id": 151645, + "head_dim": 128, + "hidden_act": "silu", + "hidden_size": 4096, + "initializer_range": 0.02, + "intermediate_size": 12288, + "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": 40960, + "max_window_layers": 36, + "model_type": "qwen3", + "num_attention_heads": 32, + "num_hidden_layers": 36, + "num_key_value_heads": 8, + "pad_token_id": 151643, + "rms_norm_eps": 1e-06, + "rope_parameters": { + "rope_theta": 1000000, + "rope_type": "default" + }, + "sliding_window": null, + "tie_word_embeddings": false, + "unsloth_version": "2026.7.6", + "use_cache": true, + "use_sliding_window": false, + "vocab_size": 151936 +} \ No newline at end of file diff --git a/generation_config.json b/generation_config.json new file mode 100644 index 0000000..5fe7de7 --- /dev/null +++ b/generation_config.json @@ -0,0 +1,10 @@ +{ + "do_sample": true, + "eos_token_id": 151645, + "max_length": 40960, + "pad_token_id": 151643, + "temperature": 0.6, + "top_k": 20, + "top_p": 0.95, + "transformers_version": "5.5.0" +} diff --git a/model.safetensors b/model.safetensors new file mode 100644 index 0000000..578b94a --- /dev/null +++ b/model.safetensors @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0e928c81c98e8bc118888312234b2b8f403a310bb1eb5ad075ffcda4cd2ceb24 +size 16381517208 diff --git a/tokenizer.json b/tokenizer.json new file mode 100644 index 0000000..10c92fa --- /dev/null +++ b/tokenizer.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:476870a1f2fb6f6a2759a6ede2383bf9d5d738f17844563b65c91965b722ae09 +size 11422924 diff --git a/tokenizer_config.json b/tokenizer_config.json new file mode 100644 index 0000000..a29d656 --- /dev/null +++ b/tokenizer_config.json @@ -0,0 +1,221 @@ +{ + "add_prefix_space": null, + "backend": "tokenizers", + "bos_token": null, + "eos_token": "<|im_end|>", + "model_max_length": 1000000000000000019884624838656, + "pad_token": "<|endoftext|>", + "tokenizer_class": "Qwen2Tokenizer", + "unk_token": null, + "added_tokens_decoder": { + "151643": { + "content": "<|endoftext|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": true + }, + "151644": { + "content": "<|im_start|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": true + }, + "151645": { + "content": "<|im_end|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": true + }, + "151646": { + "content": "<|object_ref_start|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": true + }, + "151647": { + "content": "<|object_ref_end|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": true + }, + "151648": { + "content": "<|box_start|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": true + }, + "151649": { + "content": "<|box_end|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": true + }, + "151650": { + "content": "<|quad_start|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": true + }, + "151651": { + "content": "<|quad_end|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": true + }, + "151652": { + "content": "<|vision_start|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": true + }, + "151653": { + "content": "<|vision_end|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": true + }, + "151654": { + "content": "<|vision_pad|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": true + }, + "151655": { + "content": "<|image_pad|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": true + }, + "151656": { + "content": "<|video_pad|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": true + }, + "151657": { + "content": "", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": false + }, + "151658": { + "content": "", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": false + }, + "151659": { + "content": "<|fim_prefix|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": false + }, + "151660": { + "content": "<|fim_middle|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": false + }, + "151661": { + "content": "<|fim_suffix|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": false + }, + "151662": { + "content": "<|fim_pad|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": false + }, + "151663": { + "content": "<|repo_name|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": false + }, + "151664": { + "content": "<|file_sep|>", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": false + }, + "151665": { + "content": "", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": false + }, + "151666": { + "content": "", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": false + }, + "151667": { + "content": "", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": false + }, + "151668": { + "content": "", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false, + "special": false + } + }, + "chat_template": "{% for message in messages %}{% if message['role'] == 'user' %}{{'<|im_start|>user\n' + message['content'] + '<|im_end|>\n'}}{% elif message['role'] == 'assistant' %}{{'<|im_start|>assistant\n' + message['content'] + '<|im_end|>\n' }}{% else %}{{ '<|im_start|>system\n' + message['content'] + '<|im_end|>\n' }}{% endif %}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}" +} \ No newline at end of file