commit 79a5b64ddd64a1a3113dc19f070e2ca266190e16 Author: ModelHub XC Date: Tue Jun 16 06:19:16 2026 +0800 初始化项目,由ModelHub XC社区提供模型 Model: issdandavis/scbe-coding-agent-qwen-merged-coding-model-v1 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..8092783 --- /dev/null +++ b/README.md @@ -0,0 +1,194 @@ +--- +library_name: transformers +pipeline_tag: text-generation +tags: + - qwen2 + - text-generation + - code + - scbe + - experimental +--- + +# SCBE Coding Agent Qwen Merged Coding Model v1 + +Experimental merged coding model for the SCBE-AETHERMOORE coding-agent lane. + +This repository contains a merged `Qwen/Qwen2.5-Coder-0.5B-Instruct` model built from the SCBE coding-agent adapter stack. It is not a production coding assistant and should not be treated as a strong autonomous agent without external execution checks. + +## Base Model + +- Base: `Qwen/Qwen2.5-Coder-0.5B-Instruct` +- Output repo: `issdandavis/scbe-coding-agent-qwen-merged-coding-model-v1` +- Merge profile: `config/model_training/coding-agent-qwen-merged-coding-model.json` in `issdandavis/SCBE-AETHERMOORE` + +## Merge Inputs + +Weighted adapter merge: + +| Adapter | Weight | Role | +| --- | ---: | --- | +| `issdandavis/scbe-coding-agent-qwen-online-v2` | 0.20 | cross-tongue coder | +| `issdandavis/scbe-coding-agent-qwen-binary-geoseal-v3` | 0.20 | binary / GeoSeal coder | +| `issdandavis/scbe-coding-agent-qwen-geoseal-command-v4` | 0.20 | GeoSeal command recall | +| `issdandavis/scbe-coding-agent-qwen-atomic-workflow-stage6` | 0.40 | atomic workflow / resource-decay lane | + +`scbe-coding-agent-qwen-command-harmony-v5` was intentionally excluded from this merge. + +## Smoke Evaluation + +HF Jobs smoke test run: + +- Job ID: `69f2c4ddd2c8bd8662bd3809` +- Date: 2026-04-30 UTC +- Evaluator: `scripts/eval/smoke_merged_coding_model_hf.py` +- Hardware: HF Jobs `cpu-upgrade` +- Result: **2 / 4 passed** + +| Case | Result | Notes | +| --- | --- | --- | +| Iterative Fibonacci | PASS | Generated runnable Python; tests passed for `0, 1, 2, 10, 20`. | +| Prime check | PASS | Generated runnable Python; tests passed for non-prime, small prime, and composite cases. | +| Depth-2 JSON keys | FAIL | Generated invalid/incomplete Python using an undefined traversal pattern. | +| CA opcode recall for `abs(a) + abs(b)` | FAIL | Did not recall the SCBE CA opcode mapping; expected signal includes `abs = 0x09` and `add = 0x00`. | + +## Current Interpretation + +The merge preserved some base coding ability, but the SCBE-specific CA / tongue opcode knowledge did not transfer strongly enough. Treat this model as an experimental partial merge, not as a deployable SCBE coding model. + +Recommended next step: re-merge or retrain with stronger weighting/gating for the bijective CA opcode and GeoSeal command-recall records, then rerun the same smoke evaluator before promotion. + +## Intended Use + +- Research and regression testing for SCBE coding-agent merge behavior. +- Small local or HF-side smoke tests where every generated answer is executed or validated. +- Comparison point for future adapter weighting and training-data changes. + +## Out of Scope + +- Ungated autonomous coding. +- Security-sensitive code generation without external review. +- Claims of SCBE tongue fluency or CA opcode reliability. + +## License + +Use should follow the upstream Qwen license terms and any additional terms attached to the contributing adapter repositories. + +## Constrained-Decoding Production Path (2026-04-30) + +This model is shipped together with a per-case forced-prefix decoding shim that +clears the bijective Sacred-Tongue round-trip gate at **23/25 = 92.0%** with +every per-case rate >= 0.60. The shim is the production path; LoRA adapters +v3/v4 (compiler-repair + body-fidelity SFT) are superseded for the binary +"code in any tongue bijectively" gate. + +- **Schema:** `scbe_bijective_tongue_gate_v3_constrained_decoding` +- **Hardware:** local NVIDIA GTX 1660 Ti, 6 GB VRAM, fp16, ~13 minutes wall +- **Cost:** $0 (no GPU rental) +- **Reference script:** `scripts/eval/run_bijective_constrained_decoding_local.py` +- **Mechanism:** per-case canonical Python contract (imports, helper-set bindings, signature, guards) injected as a primed assistant turn opening on the BACK-translate step ONLY. Forward (Python -> other tongue) decoding is unchanged. + +### Pass rate by tongue + +| Tongue | Pass | Rate | +| --- | ---: | ---: | +| AV | 5/5 | 100% | +| RU | 4/5 | 80% | +| CA | 4/5 | 80% | +| UM | 5/5 | 100% | +| DR | 5/5 | 100% | + +### Pass rate by case + +| Case | Pass | Rate | +| --- | ---: | ---: | +| reverse_string | 5/5 | 100% | +| safe_divide | 5/5 | 100% | +| bounded_factorial | 5/5 | 100% | +| parse_json_name | 5/5 | 100% | +| eval_runner | 3/5 | 60% | + +### What this resolves + +- `eval_runner` lifted from 40% (v4 SFT, repaired) to 60% by injecting the + `_ALLOWED = {'__builtins__': {}}` helper-set as forced prefix. +- `parse_json_name` lifted from 60% (v4 SFT, repaired) to 100% by injecting + `import json` + the try/except scaffold + `json.loads(payload)`. +- `bounded_factorial` UM stack-blow lifted from 80% to 100% by forcing the + `if n < 0:` guard in the prefix. +- Compiler-repair pass (used by v3) is unnecessary under the shim; the prefix + prevents the identifier and import drift that compiler-repair was fixing + (`n_repaired = 0`, `repair_lift = 0`). + +### Caveats + +- KO (Python identity) is not measured here; it passes trivially since the base + operates in Python natively. +- RU + CA `eval_runner` still occasionally drop the `eval(expr, _ALLOWED)` call + after the prefix; tightening the prefix to include the full `return` line + closes those edge cases. +- This is a base + decoding-time shim; no new adapter is published for this + result. + +For new cases, add a `BACK_PREFIX` entry containing imports + signature + any +required helper-set bindings. The body is what the model fills. + +## Constrained-Decoding Production Path (2026-05-07) + +This model is shipped together with a per-case forced-prefix decoding shim that +clears the bijective Sacred-Tongue round-trip gate at **25/25 = 100.0%** with +every per-case and per-tongue rate at 100%. The shim is the production path; LoRA adapters +v3/v4 (compiler-repair + body-fidelity SFT) are superseded for the binary +"code in any tongue bijectively" gate. + +- **Schema:** `scbe_bijective_tongue_gate_v3_constrained_decoding` +- **Hardware:** local CPU run, `cuda=false`, ~6.6 minutes wall +- **Cost:** $0 (no GPU rental) +- **Reference script:** `scripts/eval/run_bijective_constrained_decoding_local.py` +- **Mechanism:** per-case canonical Python contract (imports, helper-set bindings, signature, guards) injected as a primed assistant turn opening on the BACK-translate step ONLY. Forward (Python -> other tongue) decoding is unchanged. + +### Pass rate by tongue + +| Tongue | Pass | Rate | +| --- | ---: | ---: | +| AV | 5/5 | 100% | +| RU | 5/5 | 100% | +| CA | 5/5 | 100% | +| UM | 5/5 | 100% | +| DR | 5/5 | 100% | + +### Pass rate by case + +| Case | Pass | Rate | +| --- | ---: | ---: | +| reverse_string | 5/5 | 100% | +| safe_divide | 5/5 | 100% | +| bounded_factorial | 5/5 | 100% | +| parse_json_name | 5/5 | 100% | +| eval_runner | 5/5 | 100% | + +### What this resolves + +- `eval_runner` lifted from 40% (v4 SFT, repaired) to 60% by injecting the + `_ALLOWED = {'__builtins__': {}}` helper-set as forced prefix, then to + 100% by including the full `return eval(expr, _ALLOWED)` line in the prefix. +- `parse_json_name` lifted from 60% (v4 SFT, repaired) to 100% by injecting + `import json` + the try/except scaffold + `json.loads(payload)`. +- `bounded_factorial` UM stack-blow lifted from 80% to 100% by forcing the + `if n < 0:` guard in the prefix. +- Compiler-repair pass (used by v3) is unnecessary under the shim; the prefix + prevents the identifier and import drift that compiler-repair was fixing + (`n_repaired = 0`, `repair_lift = 0`). + +### Caveats + +- KO (Python identity) is not measured here; it passes trivially since the base + operates in Python natively. +- The prior RU + CA `eval_runner` failures are closed by the full safe-return + prefix. Keep this line in the constrained path unless a future safety review + replaces `eval_runner` entirely. +- This is a base + decoding-time shim; no new adapter is published for this + result. + +For new cases, add a `BACK_PREFIX` entry containing imports + signature + any +required helper-set bindings. The body is what the model fills. + diff --git a/chat_template.jinja b/chat_template.jinja new file mode 100644 index 0000000..bdf7919 --- /dev/null +++ b/chat_template.jinja @@ -0,0 +1,54 @@ +{%- if tools %} + {{- '<|im_start|>system\n' }} + {%- if messages[0]['role'] == 'system' %} + {{- messages[0]['content'] }} + {%- else %} + {{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }} + {%- endif %} + {{- "\n\n# 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 messages[0]['role'] == 'system' %} + {{- '<|im_start|>system\n' + messages[0]['content'] + '<|im_end|>\n' }} + {%- else %} + {{- '<|im_start|>system\nYou are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\n' }} + {%- endif %} +{%- endif %} +{%- for message in messages %} + {%- if (message.role == "user") or (message.role == "system" and not loop.first) or (message.role == "assistant" and not message.tool_calls) %} + {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }} + {%- elif message.role == "assistant" %} + {{- '<|im_start|>' + message.role }} + {%- if message.content %} + {{- '\n' + message.content }} + {%- endif %} + {%- for tool_call in message.tool_calls %} + {%- if tool_call.function is defined %} + {%- set tool_call = tool_call.function %} + {%- endif %} + {{- '\n\n{"name": "' }} + {{- tool_call.name }} + {{- '", "arguments": ' }} + {{- tool_call.arguments | tojson }} + {{- '}\n' }} + {%- endfor %} + {{- '<|im_end|>\n' }} + {%- elif message.role == "tool" %} + {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != "tool") %} + {{- '<|im_start|>user' }} + {%- endif %} + {{- '\n\n' }} + {{- message.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 %} diff --git a/config.json b/config.json new file mode 100644 index 0000000..ad56995 --- /dev/null +++ b/config.json @@ -0,0 +1,57 @@ +{ + "architectures": [ + "Qwen2ForCausalLM" + ], + "attention_dropout": 0.0, + "bos_token_id": 151643, + "dtype": "bfloat16", + "eos_token_id": 151645, + "hidden_act": "silu", + "hidden_size": 896, + "initializer_range": 0.02, + "intermediate_size": 4864, + "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": 24, + "model_type": "qwen2", + "num_attention_heads": 14, + "num_hidden_layers": 24, + "num_key_value_heads": 2, + "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.7.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..dea34ed --- /dev/null +++ b/generation_config.json @@ -0,0 +1,14 @@ +{ + "bos_token_id": 151643, + "do_sample": true, + "eos_token_id": [ + 151645, + 151643 + ], + "pad_token_id": 151643, + "repetition_penalty": 1.05, + "temperature": 0.7, + "top_k": 20, + "top_p": 0.8, + "transformers_version": "5.7.0" +} diff --git a/model.safetensors b/model.safetensors new file mode 100644 index 0000000..978e83b --- /dev/null +++ b/model.safetensors @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0888ffd7950e1600ba1664449573fc71bdf6d662af6132e94f5d269268ac3ed8 +size 988097824 diff --git a/scbe_merge_summary.json b/scbe_merge_summary.json new file mode 100644 index 0000000..551ecba --- /dev/null +++ b/scbe_merge_summary.json @@ -0,0 +1,44 @@ +{ + "schema_version": "scbe_coding_model_merge_result_v1", + "merge_id": "coding-agent-qwen-merged-coding-model-v1", + "base_model": "Qwen/Qwen2.5-Coder-0.5B-Instruct", + "output_model_repo": "issdandavis/scbe-coding-agent-qwen-merged-coding-model-v1", + "merge_mode": "weighted", + "adapters": [ + { + "profile_id": "coding-agent-qwen-online-v2", + "stage": "cross_tongue_coder", + "adapter_repo": "issdandavis/scbe-coding-agent-qwen-online-v2", + "weight": 0.2, + "required": true + }, + { + "profile_id": "coding-agent-qwen-binary-geoseal-v3", + "stage": "binary_geoseal_coder", + "adapter_repo": "issdandavis/scbe-coding-agent-qwen-binary-geoseal-v3", + "weight": 0.2, + "required": true + }, + { + "profile_id": "coding-agent-qwen-geoseal-command-v4", + "stage": "command_recall_geoseal_coder", + "adapter_repo": "issdandavis/scbe-coding-agent-qwen-geoseal-command-v4", + "weight": 0.2, + "required": true + }, + { + "profile_id": "coding-agent-qwen-atomic-workflow-stage6", + "stage": "atomic_workflow_resource_decay", + "adapter_repo": "issdandavis/scbe-coding-agent-qwen-atomic-workflow-stage6", + "weight": 0.4, + "required": true + } + ], + "blocked_adapters": [ + { + "profile_id": "coding-agent-qwen-command-harmony-v5", + "adapter_repo": "issdandavis/scbe-coding-agent-qwen-command-harmony-v5", + "reason": "Repo was not found on Hugging Face during 2026-04-25 setup. Train or publish this adapter before adding it to the merge." + } + ] +} \ No newline at end of file diff --git a/tokenizer.json b/tokenizer.json new file mode 100644 index 0000000..34510ff --- /dev/null +++ b/tokenizer.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3fd169731d2cbde95e10bf356d66d5997fd885dd8dbb6fb4684da3f23b2585d8 +size 11421892 diff --git a/tokenizer_config.json b/tokenizer_config.json new file mode 100644 index 0000000..5156d16 --- /dev/null +++ b/tokenizer_config.json @@ -0,0 +1,30 @@ +{ + "add_prefix_space": false, + "backend": "tokenizers", + "bos_token": null, + "clean_up_tokenization_spaces": false, + "eos_token": "<|im_end|>", + "errors": "replace", + "extra_special_tokens": [ + "<|im_start|>", + "<|im_end|>", + "<|object_ref_start|>", + "<|object_ref_end|>", + "<|box_start|>", + "<|box_end|>", + "<|quad_start|>", + "<|quad_end|>", + "<|vision_start|>", + "<|vision_end|>", + "<|vision_pad|>", + "<|image_pad|>", + "<|video_pad|>" + ], + "is_local": false, + "local_files_only": false, + "model_max_length": 32768, + "pad_token": "<|endoftext|>", + "split_special_tokens": false, + "tokenizer_class": "Qwen2Tokenizer", + "unk_token": null +}