commit b0bf055b3ef7db55cb703a5d13d0cfa2be6d1566 Author: ModelHub XC Date: Sun May 24 05:50:15 2026 +0800 初始化项目,由ModelHub XC社区提供模型 Model: hadadxyz/OpenSonnet-Lite-MAX Source: Original Platform diff --git a/.eval_results/gsm8k.json b/.eval_results/gsm8k.json new file mode 100644 index 0000000..d537d3a --- /dev/null +++ b/.eval_results/gsm8k.json @@ -0,0 +1,160 @@ +{ + "results": { + "gsm8k": { + "alias": "gsm8k", + "exact_match,strict-match": 0.8521607278241091, + "exact_match_stderr,strict-match": 0.00977682767914391, + "exact_match,flexible-extract": 0.8529188779378317, + "exact_match_stderr,flexible-extract": 0.009756063660359896 + } + }, + "group_subtasks": { + "gsm8k": [] + }, + "configs": { + "gsm8k": { + "task": "gsm8k", + "tag": [ + "math_word_problems" + ], + "dataset_path": "openai/gsm8k", + "dataset_name": "main", + "training_split": "train", + "test_split": "test", + "fewshot_split": "train", + "doc_to_text": "Question: {{question}}\nAnswer:", + "doc_to_target": "{{answer}}", + "unsafe_code": false, + "description": "", + "target_delimiter": " ", + "fewshot_delimiter": "\n\n", + "fewshot_config": { + "sampler": "default", + "split": "train", + "process_docs": null, + "fewshot_indices": null, + "samples": null, + "doc_to_text": "Question: {{question}}\nAnswer:", + "doc_to_choice": null, + "doc_to_target": "{{answer}}", + "gen_prefix": null, + "fewshot_delimiter": "\n\n", + "target_delimiter": " " + }, + "num_fewshot": 8, + "metric_list": [ + { + "metric": "exact_match", + "aggregation": "mean", + "higher_is_better": true, + "ignore_case": true, + "ignore_punctuation": false, + "regexes_to_ignore": [ + ",", + "\\$", + "(?s).*#### ", + "\\.$" + ] + } + ], + "output_type": "generate_until", + "generation_kwargs": { + "until": [ + "Question:", + "", + "<|im_end|>" + ], + "do_sample": false, + "temperature": 0.6, + "max_gen_toks": 131072, + "max_tokens": 131072, + "top_p": 0.95, + "top_k": 20, + "min_p": 0, + "repeat_penalty": 1.0, + "presence_penalty": 1.0, + "num_ctx": 262144 + }, + "repeats": 1, + "filter_list": [ + { + "name": "strict-match", + "filter": [ + { + "function": "regex", + "regex_pattern": "#### (\\-?[0-9\\.\\,]+)" + }, + { + "function": "take_first" + } + ] + }, + { + "name": "flexible-extract", + "filter": [ + { + "function": "regex", + "group_select": -1, + "regex_pattern": "(-?[$0-9.,]{2,})|(-?[0-9]+)" + }, + { + "function": "take_first" + } + ] + } + ], + "should_decontaminate": false, + "metadata": { + "version": 3.0 + } + } + }, + "versions": { + "gsm8k": 3.0 + }, + "n-shot": { + "gsm8k": 8 + }, + "higher_is_better": { + "gsm8k": { + "exact_match": true + } + }, + "n-samples": { + "gsm8k": { + "original": 1319, + "effective": 1319 + } + }, + "config": { + "model": "LocalChatCompletion", + "model_args": null, + "batch_size": 1, + "batch_sizes": [], + "device": null, + "use_cache": null, + "limit": null, + "bootstrap_iters": 100000, + "gen_kwargs": { + "max_gen_toks": 131072, + "max_tokens": 131072, + "temperature": 0.6, + "top_p": 0.95, + "top_k": 20, + "min_p": 0, + "repeat_penalty": 1.0, + "presence_penalty": 1.0, + "num_ctx": 262144 + }, + "random_seed": 0, + "numpy_seed": 1234, + "torch_seed": 1234, + "fewshot_seed": 1234 + }, + "git_hash": null, + "date": 1778390867.1640942, + "pretty_env_info": "PyTorch version: 2.6.0+cpu\nIs debug build: False\nCUDA used to build PyTorch: Could not collect\nROCM used to build PyTorch: N/A\n\nOS: Debian GNU/Linux 12 (bookworm) (x86_64)\nGCC version: (Debian 12.2.0-14+deb12u1) 12.2.0\nClang version: Could not collect\nCMake version: version 3.25.1\nLibc version: glibc-2.36\n\nPython version: 3.11.5 (main, Aug 26 2023, 07:22:50) [Clang 16.0.3 ] (64-bit runtime)\nPython platform: Linux-4.4.0-x86_64-with-glibc2.36\nIs CUDA available: False\nCUDA runtime version: 12.8.93\nCUDA_MODULE_LOADING set to: N/A\nGPU models and configuration: GPU 0: NVIDIA B200\nNvidia driver version: 580.95.05\ncuDNN version: Probably one of the following:\n/usr/lib/x86_64-linux-gnu/libcudnn.so.9.22.0\n/usr/lib/x86_64-linux-gnu/libcudnn_adv.so.9.22.0\n/usr/lib/x86_64-linux-gnu/libcudnn_cnn.so.9.22.0\n/usr/lib/x86_64-linux-gnu/libcudnn_engines_precompiled.so.9.22.0\n/usr/lib/x86_64-linux-gnu/libcudnn_engines_runtime_compiled.so.9.22.0\n/usr/lib/x86_64-linux-gnu/libcudnn_engines_tensor_ir.so.9.22.0\n/usr/lib/x86_64-linux-gnu/libcudnn_ext.so.9.22.0\n/usr/lib/x86_64-linux-gnu/libcudnn_graph.so.9.22.0\n/usr/lib/x86_64-linux-gnu/libcudnn_heuristic.so.9.22.0\n/usr/lib/x86_64-linux-gnu/libcudnn_ops.so.9.22.0\nHIP runtime version: N/A\nMIOpen runtime version: N/A\nIs XNNPACK available: True\n\nCPU:\nArchitecture: x86_64\nCPU op-mode(s): 32-bit, 64-bit\nAddress sizes: 46 bits physical, 48 bits virtual\nByte Order: Little Endian\nCPU(s): 17\nOn-line CPU(s) list: 0-16\nVendor ID: AuthenticAMD\nModel name: unknown\nCPU family: 191\nModel: 2\nThread(s) per core: 1\nCore(s) per socket: 17\nSocket(s): 1\nStepping: unknown\nBogoMIPS: 5035.66\nFlags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm pni pclmulqdq monitor ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq la57 rdpid movdiri movdir64b fsrm avx512_vp2intersect flush_l1d\nVirtualization: AMD-V\n\nVersions of relevant libraries:\n[pip3] numpy==1.26.4\n[pip3] torch==2.6.0+cpu\n[conda] Could not collect", + "transformers_version": "5.5.1", + "lm_eval_version": "0.4.11", + "upper_git_hash": null +} \ No newline at end of file diff --git a/.eval_results/gsm8k.md b/.eval_results/gsm8k.md new file mode 100644 index 0000000..9fa617b --- /dev/null +++ b/.eval_results/gsm8k.md @@ -0,0 +1,148 @@ +# Instruction + +````md +You are OpenSonnet, a large language model trained by the Open Source community. You are based on the Qwen3 architecture. + +You are a highly careful mathematical reasoning assistant. + +Your task is to solve grade-school math word problems with maximum accuracy. + +--- + +# Goals + +* Read the problem carefully. + +* Identify all relevant numbers, entities, and relationships. + +* Solve the problem step by step. + +* Avoid mistakes caused by missing details, distraction, or rushed arithmetic. + +* Give the final answer in the exact required format. + +--- + +# Core Reasoning Rules + +* Always parse the question before calculating. + +* Determine what the question is asking for. + +* Translate words into mathematical operations: + + - 'total', 'altogether', 'in all' --> addition + + - 'left', 'remain', 'difference' --> subtraction + + - 'each', 'per', 'every' --> multiplication or division depending on context + + - 'half as many' --> divide by 2 + + - 'twice as many' --> multiply by 2 + + - 'shared equally' --> division + +- Track each entity separately when multiple people, objects, or time periods are involved. + +- Ignore irrelevant information. + +- Use exact arithmetic whenever possible. + +- Re-check every intermediate result before producing the final answer. + +- If the problem involves multiple steps, solve them in a logical order. + +- If a number is expressed in words, convert it correctly. + +- If a fraction, decimal, or ratio appears, handle it carefully. + +- If the result should be a whole number, verify that the interpretation is consistent. + +- If there are multiple possible interpretations, choose the one most directly supported by the wording. + +--- + +# Robustness Rules + +* Do not guess. + +* Do not skip steps. + +* Do not let earlier mistakes propagate. + +* Recompute suspicious calculations. + +* Sanity-check the answer against the question. + +* Be especially careful with: + + - multi-step arithmetic + + - rates and ratios + + - fractions and percentages + + - time-based changes + + - repeated operations + + - comparisons like 'more than', 'less than', and 'how many left' + +--- + +# Internal Reasoning Policy + +* Think step by step internally. + +* Keep intermediate values consistent. + +* Verify the final result before answering. + +--- + +# Output Format + +* Return only the final answer in exactly this format: + + ``` + #### {final_answer} + ``` + +--- + +# Output Constraints + +* Do not include any explanation. + +* Do not include any extra text before or after the final answer. + +* Do not use bullets, numbering, or markdown outside the required final-answer format. + +* The final answer should usually be a single integer or number. + +* Preserve the exact required format strictly. + +--- + +# Example Behavior + +* Question: + + ``` + Natalia sold clips to 48 of her friends in April, and then she sold half as many clips in May. How many clips did Natalia sell altogether in April and May? + ``` + +* Your internal reasoning/thinking step-by-step (example only): + + ``` + Natalia sold 48/2 = <<48/2=24>>24 clips in May. + Natalia sold 48+24 = <<48+24=72>>72 clips altogether in April and May. + ``` + +* Output: + + ``` + #### 72 + ``` +```` \ No newline at end of file diff --git a/.eval_results/gsm8k.yaml b/.eval_results/gsm8k.yaml new file mode 100644 index 0000000..4a9decb --- /dev/null +++ b/.eval_results/gsm8k.yaml @@ -0,0 +1,24 @@ +- dataset: + id: openai/gsm8k + task_id: gsm8k + value: 85.22 + date: "2026-05-10" + source: + url: https://huggingface.co/hadadxyz/OpenSonnet-Lite-MAX + name: Model Card + user: hadadxyz + notes: | + framework: lm-evaluation-harness + n-shot: 8 + batch_size: 1 + generation_kwargs: + num_ctx: 262144 + max_tokens: 131072 + temperature: 0.6 + top_p: 0.95 + top_k: 20 + min_p: 0 + repeat_penalty: 1.0 + presence_penalty: 1.0 + metric: exact_match + match_type: strict-match \ No newline at end of file diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..b362a68 --- /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 \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..9e1fecc --- /dev/null +++ b/LICENSE @@ -0,0 +1,203 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2024 Alibaba Cloud + Copyright 2026 Hadad + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..16355af --- /dev/null +++ b/README.md @@ -0,0 +1,154 @@ +--- +base_model: + - Qwen/Qwen3-4B-Thinking-2507 + +datasets: + - Roman1111111/claude-sonnet-4.6-120000x + - Roman1111111/claude-sonnet-4.6-100000X-filtered + - TeichAI/lordx64-claude-opus-4.7-max-cleaned + - Crownelius/Opus-4.6-Reasoning-3300x + - TeichAI/claude-4.5-opus-high-reasoning-250x + - TeichAI/claude-haiku-4.5-high-reasoning-1700x + - TeichAI/claude-sonnet-4.5-high-reasoning-250x + - TeichAI/deepseek-v3.2-speciale-openr1-math-3k + - TeichAI/deepseek-v3.2-speciale-1000x + - Roman1111111/gemini-3-pro-10000x-hard-high-reasoning + - Roman1111111/gemini-3.1-pro-hard-high-reasoning + - Jackrong/DeepSeek-V4-Distill-8000x + +tags: + - opensonnet + - claude-sonnet + - sonnet + +pipeline_tag: text-generation +library_name: transformers +license: apache-2.0 +license_link: https://huggingface.co/hadadxyz/OpenSonnet-Lite-MAX/blob/main/LICENSE +--- + +# Comparison + +| Model | Training Approach | Developer Role | Context Length | Training Epochs | Transformers Version | Notes | +|------------------------------------------------------------------------------|--------------------------|------------------------|----------------|------------------|------------------------|-------------------------------------------------------------------------------------| +| [OpenSonnet-Lite-MAX](https://huggingface.co/hadadxyz/OpenSonnet-Lite-MAX) | Multi-Stage Fine-Tuning | Supported | 262,144 | 2 | `transformers>=5.0.0` | Latest version with improved training efficiency and enhanced instruction alignment | +| [OpenSonnet-Lite](https://huggingface.co/hadadxyz/OpenSonnet-Lite) | Single-Stage Fine-Tuning | Not supported | 262,144 | 3 | `transformers>=4.51.0` | Previous version with simpler training pipeline | +| [Qwen3-4B-Thinking-2507](https://huggingface.co/Qwen/Qwen3-4B-Thinking-2507) | N/A | Not supported | 262,144 | N/A | `transformers>=4.51.0` | Base model | + +> [OpenSonnet-Lite-MAX quick demo](https://www.kaggle.com/code/hadadrjt/opensonnet-lite-max) with tool calling. + +### Benchmark Evaluation + +| Dataset | Score | Source | Framework | +|-------------------------------------------------------|--------|---------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------| +| [GSM8K](https://huggingface.co/datasets/openai/gsm8k) | 85.22 | [Evaluation Results](https://huggingface.co/hadadxyz/OpenSonnet-Lite-MAX/tree/main/.eval_results) | [lm-evaluation-harness](https://github.com/EleutherAI/lm-evaluation-harness) | +| MMLU-Pro | - | - | - | +| GPQA (Diamond) | - | - | - | + + +# Inference Parameters + +For best results, the following sampling configuration is recommended: + +| Parameter | Recommended Value | Description | +|---------------------|---------------------|------------------------------------------| +| temperature | 0.6 (default) - 1.0 | Controls randomness in generation | +| top_p | 0.95 (default) | Nucleus sampling threshold | +| top_k | 20 (default) - 40 | Top-k sampling parameter | +| min_p | 0.0 (default) | Minimum probability threshold | +| repetition_penalty | 1.0 (default) - 1.2 | Penalizes repeated tokens | +| presence_penalty | 1.0 - 1.5 | Encourages introducing new topics | + + +# Max Tokens + +| Small Tasks | Medium Tasks | Large Tasks | Complex Tasks | +|-------------|--------------|-------------|---------------| +| 4096/8192 | 16384 | 32768/81920 | 131072 | + + +# Instruction + +```md +You are OpenSonnet, a large language model trained by the Open Source community. You are based on the Qwen3 architecture. + +You are an AI assistant designed to provide accurate, helpful, and context-aware responses. Your reasoning style must dynamically adapt based on the complexity of the user’s request. + +--- + +# Adaptive Thinking Mode + +* Automatically assess the complexity of each user request before responding. + +* If the task is complex, multi-step, analytical, or requires planning, reasoning, or explanation: + - Use structured, step-by-step reasoning internally before responding. + - Provide a clear, well-organized, and thorough answer. + +* If the task is simple, factual, or straightforward: + - Use fast, minimal reasoning. + - Respond concisely without unnecessary elaboration. + +--- + +# Complexity Detection Guidelines + +* Treat a request as COMPLEX if it involves: + - Multi-step problem solving + - Logic, mathematics, coding, or debugging + - Planning, strategy, or decision making + - Deep explanation or comparison + - Ambiguous or multi-part instructions + +* Treat a request as SIMPLE if it involves: + - Direct factual questions + - Basic definitions + - Short instructions + - Common knowledge retrieval + - Single-step tasks + +--- + +# Response Style Rules + +* Always prioritize correctness and clarity. + +* For complex tasks: structure answers clearly using sections or bullet points when helpful. + +* For simple tasks: keep responses short and direct. + +* Avoid unnecessary verbosity in all cases. + +--- + +# Quality Principles + +* Be accurate, logical, and consistent. + +* Do not hallucinate information. + +* If uncertain, clearly state limitations. + +* Optimize responses for usefulness and readability. + +--- + +# User Intent Focus + +* Always prioritize the user’s intent over literal interpretation. + +* If the request is ambiguous, make reasonable assumptions or ask a clarifying question when necessary. +``` + + +# Citation + +If you use this model in your research or applications, please cite both this model and the base model: + +```bibtex +@misc{opensonnet-lite-max, + author = {hadadxyz}, + title = {OpenSonnet-Lite-MAX}, + year = {2026}, + url = {https://huggingface.co/hadadxyz/OpenSonnet-Lite-MAX} +} +``` \ No newline at end of file diff --git a/chat_template.jinja b/chat_template.jinja new file mode 100644 index 0000000..a9c9fc3 --- /dev/null +++ b/chat_template.jinja @@ -0,0 +1,106 @@ +{%- set ns_sys = namespace(system_content='', developer_content='') %} +{%- for message in messages %} + {%- if message.role == 'system' and ns_sys.system_content == '' %} + {%- set ns_sys.system_content = message.content if message.content is string else '' %} + {%- elif message.role == 'developer' and ns_sys.developer_content == '' %} + {%- set ns_sys.developer_content = message.content if message.content is string else '' %} + {%- endif %} +{%- endfor %} +{%- if ns_sys.system_content and ns_sys.developer_content %} + {%- set instructions = ns_sys.system_content + '\n\n\n' + ns_sys.developer_content %} +{%- elif ns_sys.system_content %} + {%- set instructions = ns_sys.system_content %} +{%- elif ns_sys.developer_content %} + {%- set instructions = ns_sys.developer_content %} +{%- else %} + {%- set instructions = '' %} +{%- endif %} +{%- if tools %} + {{- '<|im_start|>system\n' }} + {%- if instructions %} + {{- instructions + '\n\n' }} + {%- endif %} + {{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within XML tags:\n" }} + {%- for tool in tools %} + {{- "\n" }} + {{- tool | tojson }} + {%- endfor %} + {{- "\n\n\nFor each function call, return a json object with function name and arguments within XML tags:\n\n{\"name\": , \"arguments\": }\n<|im_end|>\n" }} +{%- else %} + {%- if instructions %} + {{- '<|im_start|>system\n' + instructions + '<|im_end|>\n' }} + {%- endif %} +{%- endif %} +{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %} +{%- for message in messages[::-1] %} + {%- set index = (messages|length - 1) - loop.index0 %} + {%- if ns.multi_step_tool and message.role == "user" and message.content is string and not(message.content.startswith('') and message.content.endswith('')) %} + {%- set ns.multi_step_tool = false %} + {%- set ns.last_query_index = index %} + {%- endif %} +{%- endfor %} +{%- for message in messages %} + {%- if message.content is string %} + {%- set content = message.content %} + {%- else %} + {%- set content = '' %} + {%- endif %} + {%- if (message.role == "user") or (message.role == "system" and not loop.first) %} + {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }} + {%- elif message.role == "developer" %} + {%- elif message.role == "assistant" %} + {%- set reasoning_content = '' %} + {%- if message.reasoning_content is string %} + {%- set reasoning_content = message.reasoning_content %} + {%- elif message.reasoning is string %} + {%- set reasoning_content = message.reasoning %} + {%- else %} + {%- if '' in content %} + {%- set reasoning_content = content.split('')[0].rstrip('\n').split('')[-1].lstrip('\n') %} + {%- set content = content.split('')[-1].lstrip('\n') %} + {%- endif %} + {%- endif %} + {%- if loop.index0 > ns.last_query_index %} + {%- if loop.last or (not loop.last and reasoning_content) %} + {{- '<|im_start|>' + message.role + '\n\n' + reasoning_content.strip('\n') + '\n\n\n' + content.lstrip('\n') }} + {%- else %} + {{- '<|im_start|>' + message.role + '\n' + content }} + {%- endif %} + {%- else %} + {{- '<|im_start|>' + message.role + '\n' + content }} + {%- endif %} + {%- if message.tool_calls %} + {%- for tool_call in message.tool_calls %} + {%- if (loop.first and content) or (not loop.first) %} + {{- '\n' }} + {%- endif %} + {%- if tool_call.function %} + {%- set tool_call = tool_call.function %} + {%- endif %} + {{- '\n{"name": "' }} + {{- tool_call.name }} + {{- '", "arguments": ' }} + {%- if tool_call.arguments is string %} + {{- tool_call.arguments }} + {%- else %} + {{- tool_call.arguments | tojson }} + {%- endif %} + {{- '}\n' }} + {%- endfor %} + {%- endif %} + {{- '<|im_end|>\n' }} + {%- elif message.role == "tool" %} + {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %} + {{- '<|im_start|>user' }} + {%- endif %} + {{- '\n\n' }} + {{- content }} + {{- '\n' }} + {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %} + {{- '<|im_end|>\n' }} + {%- endif %} + {%- endif %} +{%- endfor %} +{%- if add_generation_prompt %} + {{- '<|im_start|>assistant\n' }} +{%- endif %} \ No newline at end of file diff --git a/config.json b/config.json new file mode 100644 index 0000000..aba37a7 --- /dev/null +++ b/config.json @@ -0,0 +1,71 @@ +{ + "architectures": [ + "Qwen3ForCausalLM" + ], + "attention_bias": false, + "attention_dropout": 0.0, + "bos_token_id": 151643, + "dtype": "bfloat16", + "eos_token_id": 151645, + "head_dim": 128, + "hidden_act": "silu", + "hidden_size": 2560, + "initializer_range": 0.02, + "intermediate_size": 9728, + "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": 262144, + "max_window_layers": 36, + "model_type": "qwen3", + "num_attention_heads": 32, + "num_hidden_layers": 36, + "num_key_value_heads": 8, + "pad_token_id": null, + "rms_norm_eps": 1e-06, + "rope_parameters": { + "rope_theta": 5000000, + "rope_type": "default" + }, + "sliding_window": null, + "tie_word_embeddings": true, + "transformers_version": "5.8.0", + "use_cache": true, + "use_sliding_window": false, + "vocab_size": 151936 +} diff --git a/generation_config.json b/generation_config.json new file mode 100644 index 0000000..405b517 --- /dev/null +++ b/generation_config.json @@ -0,0 +1,13 @@ +{ + "bos_token_id": 151643, + "do_sample": true, + "eos_token_id": [ + 151645, + 151643 + ], + "pad_token_id": 151643, + "temperature": 0.6, + "top_k": 20, + "top_p": 0.95, + "transformers_version": "5.8.0" +} diff --git a/model.safetensors b/model.safetensors new file mode 100644 index 0000000..ca54748 --- /dev/null +++ b/model.safetensors @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cc2282c1591c32cefbc53c2f115e7b6ad7ecd39c90653059fc024bd9963c3911 +size 8044982080 diff --git a/tokenizer.json b/tokenizer.json new file mode 100644 index 0000000..c7afbed --- /dev/null +++ b/tokenizer.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:be75606093db2094d7cd20f3c2f385c212750648bd6ea4fb2bf507a6a4c55506 +size 11422650 diff --git a/tokenizer_config.json b/tokenizer_config.json new file mode 100644 index 0000000..05c4a28 --- /dev/null +++ b/tokenizer_config.json @@ -0,0 +1,16 @@ +{ + "add_prefix_space": false, + "backend": "tokenizers", + "bos_token": null, + "clean_up_tokenization_spaces": false, + "eos_token": "<|im_end|>", + "errors": "replace", + "is_local": true, + "local_files_only": true, + "model_max_length": 262144, + "pad_token": "<|endoftext|>", + "padding_side": "left", + "split_special_tokens": false, + "tokenizer_class": "Qwen2Tokenizer", + "unk_token": null +}