From af77d9648717c120d991cd1fcb538a37bc124880 Mon Sep 17 00:00:00 2001 From: ModelHub XC Date: Sun, 26 Jul 2026 07:29:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=EF=BC=8C=E7=94=B1ModelHub=20XC=E7=A4=BE=E5=8C=BA=E6=8F=90?= =?UTF-8?q?=E4=BE=9B=E6=A8=A1=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Model: PursuitOfDataScience/Argonne-Qwen1.5-0.5B-think Source: Original Platform --- .gitattributes | 36 +++++++++++++ README.md | 114 +++++++++++++++++++++++++++++++++++++++++ chat_template.jinja | 4 ++ config.json | 58 +++++++++++++++++++++ generation_config.json | 11 ++++ model.safetensors | 3 ++ tokenizer.json | 3 ++ tokenizer_config.json | 20 ++++++++ 8 files changed, 249 insertions(+) create mode 100644 .gitattributes create mode 100644 README.md create mode 100644 chat_template.jinja create mode 100644 config.json create mode 100644 generation_config.json create mode 100644 model.safetensors create mode 100644 tokenizer.json create mode 100644 tokenizer_config.json 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..63dadb4 --- /dev/null +++ b/README.md @@ -0,0 +1,114 @@ +--- +license: apache-2.0 +base_model: Qwen/Qwen1.5-0.5B +library_name: transformers +pipeline_tag: text-generation +language: +- en +tags: +- reasoning +- chain-of-thought +- math +- rlvr +- qwen2 +--- + +# Argonne-Qwen1.5-0.5B-think + +A **0.46B-parameter chain-of-thought reasoner**: the base model **Qwen1.5-0.5B** fine-tuned with a fully +open five-stage reasoning recipe — general SFT → DPO → CoT-SFT → **STaR** self-improvement → **GRPO/RLVR** +(verifiable reward). It produces an explicit ` … ` reasoning trace followed by a final +`\boxed{}` answer on math word problems. + +The point of this model is to show how much math-reasoning ability a **well-pretrained sub-1B base** can be +given by a light, fully open post-training recipe. It is a compact research reasoner — useful for studying +test-time compute on small models — **not** a production-grade or competition-math solver. + +## Benchmarks (honest, held-out) + +Evaluated on **contamination-free** elementary math-word-problem benchmarks — SVAMP, ASDiv, MAWPS (clean) +and GSM-Plus (semi-clean, adversarial) — that appear in **none** of the training stages. `n=500/set`, +with-think decoding. Metrics: **greedy / +budget-forcing / self-consistency@32 / pass@32** (%). + +| set | greedy | +budget | self-cons@32 | pass@32 | +|---|:---:|:---:|:---:|:---:| +| SVAMP | 33.4 | 33.4 | 44.4 | 83.6 | +| ASDiv | 49.2 | 48.6 | 58.4 | 83.8 | +| MAWPS | 39.8 | 39.6 | 47.4 | 78.4 | +| GSM-Plus (adversarial) | 16.8 | 16.8 | 21.2 | 60.2 | +| **mean (SVAMP/ASDiv/MAWPS)** | **40.8** | 40.5 | **50.1** | **81.9** | + +Read plainly: single-shot greedy is ~41% on the clean sets, self-consistency lifts it to ~50%, and the +model **can** solve far more than it reliably answers in one pass — **pass@32 ≈ 82%**. These are +absolute-modest numbers for a 0.46B model; it is a small reasoner, and the greedy→pass@K headroom is the +interesting part. + +> **Note on GSM8K:** the CoT/STaR/GRPO training overlaps GSM8K, so GSM8K is **not** a valid held-out +> benchmark for this model. Use the clean SVAMP / ASDiv / MAWPS numbers above as the honest signal. + +## How it was trained + +Base **Qwen1.5-0.5B** → five stages (base-agnostic harness `reasoning/reason_control/` + RLVR in the +[training repo](https://github.com/PursuitOfDataScience/ArgonneAI)): + +1. **General SFT** on [HuggingFaceH4/ultrachat_200k](https://huggingface.co/datasets/HuggingFaceH4/ultrachat_200k) (LR 2e-5). +2. **DPO** preference alignment on [argilla/dpo-mix-7k](https://huggingface.co/datasets/argilla/dpo-mix-7k) (LR 5e-6, β 0.1). +3. **CoT-SFT** on a `…` + `\boxed{}` math-reasoning mix (LR 1e-5, 1 epoch). +4. **STaR** — self-distillation on the model's own verified-correct, concise (terminating) traces on + GSM8K-train + MATH-L1-3 (two rounds; fixes the non-termination that caps greedy). +5. **GRPO / RLVR** — group-relative policy optimization with a verifiable reward (correct `\boxed` on + GSM8K-train), early-stopped to avoid over-optimization. + +Cumulatively, greedy accuracy on the clean sets rose from ~24% (after stage 3) to ~41% (after stage 5) — +STaR and RLVR mostly **convert** the large latent pass@K ceiling into single-shot answers rather than +raising the ceiling itself. + +## Inference + +```python +from transformers import AutoModelForCausalLM, AutoTokenizer +import torch + +mid = "PursuitOfDataScience/Argonne-Qwen1.5-0.5B-think" +tok = AutoTokenizer.from_pretrained(mid) +model = AutoModelForCausalLM.from_pretrained(mid, dtype=torch.bfloat16).to("cuda").eval() + +msgs = [{"role": "user", "content": "Ana has 3 boxes with 12 pencils each. She gives away 8. How many are left?"}] +ids = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt").to("cuda") +out = model.generate(ids, max_new_tokens=512, do_sample=False) +print(tok.decode(out[0][ids.shape[1]:], skip_special_tokens=True)) +# -> 3 * 12 = 36 ... 36 - 8 = 28 ... The answer is $\boxed{28}$. +``` + +Uses the standard ChatML format (`<|im_start|>` / `<|im_end|>`). For the best accuracy, sample `K≈16–32` +traces (`temperature 0.8, top_p 0.95`) and majority-vote the `\boxed{}` answers (self-consistency ≈ 50%). + +## Limitations + +- **0.46B parameters** — a small reasoner. Absolute accuracy on clean grade-school math is ~41% greedy / + ~50% self-consistency; expect errors, especially on multi-step or adversarial problems (GSM-Plus greedy + ~17%). +- **Scope:** trained and evaluated on English elementary math word problems + general chat. Not a + general-purpose or competition-math model. +- **GSM8K is not a valid benchmark here** (train-mix overlap) — use the clean numbers above. + +## Base model & license + +Fine-tuned from [Qwen/Qwen1.5-0.5B](https://huggingface.co/Qwen/Qwen1.5-0.5B) (Apache-2.0) and released under +Apache-2.0; please also observe the base model's terms. + +## Provenance + +Training + evaluation code: [PursuitOfDataScience/ArgonneAI](https://github.com/PursuitOfDataScience/ArgonneAI) +(`reasoning/reason_control/` recipe, `reasoning/grpo.py` RLVR, `reasoning/clean_eval.py` honest evaluator). + +## Citation + +```bibtex +@misc{argonne_qwen05b_think_2026, + title = {Argonne-Qwen1.5-0.5B-think: a compact chain-of-thought reasoner (SFT->DPO->CoT->STaR->RLVR)}, + author = {PursuitOfDataScience}, + year = {2026}, + url = {https://huggingface.co/PursuitOfDataScience/Argonne-Qwen1.5-0.5B-think} +} +``` diff --git a/chat_template.jinja b/chat_template.jinja new file mode 100644 index 0000000..fe7c983 --- /dev/null +++ b/chat_template.jinja @@ -0,0 +1,4 @@ +{% for m in messages %}{{ '<|im_start|>' + m['role'] + ' +' + (m['content'] | trim) + '<|im_end|>' + ' +' }}{% 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..320478b --- /dev/null +++ b/config.json @@ -0,0 +1,58 @@ +{ + "architectures": [ + "Qwen2ForCausalLM" + ], + "attention_dropout": 0.0, + "bos_token_id": 151643, + "dtype": "bfloat16", + "eos_token_id": 151645, + "hidden_act": "silu", + "hidden_size": 1024, + "initializer_range": 0.02, + "intermediate_size": 2816, + "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" + ], + "max_position_embeddings": 32768, + "max_window_layers": 21, + "model_type": "qwen2", + "num_attention_heads": 16, + "num_hidden_layers": 24, + "num_key_value_heads": 16, + "pad_token_id": null, + "rms_norm_eps": 1e-06, + "rope_parameters": { + "rope_theta": 1000000.0, + "rope_type": "default" + }, + "sliding_window": null, + "tie_word_embeddings": true, + "transformers_version": "5.6.2", + "use_cache": false, + "use_sliding_window": false, + "vocab_size": 151936, + "torch_dtype": "bfloat16" +} \ No newline at end of file diff --git a/generation_config.json b/generation_config.json new file mode 100644 index 0000000..69df8b7 --- /dev/null +++ b/generation_config.json @@ -0,0 +1,11 @@ +{ + "bos_token_id": 151643, + "do_sample": false, + "eos_token_id": [ + 151645, + 151643 + ], + "max_new_tokens": 2048, + "pad_token_id": 151643, + "transformers_version": "5.6.2" +} \ No newline at end of file diff --git a/model.safetensors b/model.safetensors new file mode 100644 index 0000000..375afa1 --- /dev/null +++ b/model.safetensors @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3909e75050f15fed9b0b1c77f9b8d6c8f75a648e8e39c19ffbebb56670fc88c8 +size 928008104 diff --git a/tokenizer.json b/tokenizer.json new file mode 100644 index 0000000..408c9fb --- /dev/null +++ b/tokenizer.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:48f722bc04c884e2fe1525fdcd85a1293a8499b6e620c1ac7c083c49632305fb +size 11418262 diff --git a/tokenizer_config.json b/tokenizer_config.json new file mode 100644 index 0000000..a3cdfcf --- /dev/null +++ b/tokenizer_config.json @@ -0,0 +1,20 @@ +{ + "add_prefix_space": false, + "backend": "tokenizers", + "bos_token": null, + "clean_up_tokenization_spaces": false, + "eos_token": "<|endoftext|>", + "errors": "replace", + "extra_special_tokens": [ + "<|im_start|>", + "<|im_end|>" + ], + "is_local": true, + "local_files_only": true, + "model_max_length": 32768, + "pad_token": "<|endoftext|>", + "split_special_tokens": false, + "tokenizer_class": "Qwen2Tokenizer", + "unk_token": null, + "chat_template": "{% for m in messages %}{{ '<|im_start|>' + m['role'] + '\n' + (m['content'] | trim) + '<|im_end|>' + '\n' }}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}" +} \ No newline at end of file