AvoCahDoe commited on
Commit
83951ed
·
verified ·
1 Parent(s): 423c23a

RL-MPQ Aggressive — 2026-06-11T21:10:07.790343

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: Qwen/Qwen2.5-7B
4
+ pipeline_tag: text-generation
5
+ language:
6
+ - en
7
+ tags:
8
+ - qwen2
9
+ - text-generation
10
+ - rl-mpq
11
+ - mixed-precision
12
+ - quantization
13
+ - fake-quantization
14
+ - aggressive
15
+ library_name: transformers
16
+ datasets:
17
+ - wikitext
18
+ widget:
19
+ - text: "The capital of France is"
20
+ ---
21
+
22
+ # Qwen 2.5 7B — RL-MPQ Aggressive
23
+
24
+ Standalone **RL-MPQ** (Reinforcement Learning Mixed-Precision Quantization) checkpoint for the
25
+ **Aggressive** scenario — a quantized variant of
26
+ [Qwen/Qwen2.5-7B](https://huggingface.co/Qwen/Qwen2.5-7B).
27
+
28
+ | Field | Value |
29
+ |-------|-------|
30
+ | **Base model** | [Qwen/Qwen2.5-7B](https://huggingface.co/Qwen/Qwen2.5-7B) |
31
+ | **Scenario** | Aggressive |
32
+ | **Avg bits / weight** | 3.1429 |
33
+ | **Compression vs FP16** | 5.0909× |
34
+ | **WikiText-2 PPL** | 9.3678 |
35
+ | **Layers** | 28 |
36
+ | **Bit distribution** | `{'3': 24, '4': 4}` |
37
+ | **Format** | Fake-quant FP16 + `rlmpq_policy.json` |
38
+
39
+
40
+ ## Usage
41
+
42
+ ```python
43
+ from transformers import AutoModelForCausalLM, AutoTokenizer
44
+
45
+ repo = "AvoCahDoe/qwen2-5-7b-rlmpq-aggressive"
46
+
47
+ model = AutoModelForCausalLM.from_pretrained(repo, torch_dtype="float16")
48
+ tokenizer = AutoTokenizer.from_pretrained(repo)
49
+ ```
50
+
51
+ ## Other Qwen 2.5 7B scenarios
52
+
53
+ | Scenario | Avg bits | Compression | WikiText-2 PPL |
54
+ |----------|----------|-------------|----------------|
55
+ | [Balanced](https://huggingface.co/AvoCahDoe/qwen2-5-7b-rlmpq-balanced) | 3.3929 | 4.7158x | 8.9305 |
56
+ | [Conservative](https://huggingface.co/AvoCahDoe/qwen2-5-7b-rlmpq-conservative) | 3.6786 | 4.3495x | 8.4114 |
57
+ | [Extreme Survival](https://huggingface.co/AvoCahDoe/qwen2-5-7b-rlmpq-extreme-survival) | 2.4643 | 6.4928x | 497.4791 |
58
+ | [High Fidelity](https://huggingface.co/AvoCahDoe/qwen2-5-7b-rlmpq-high-fidelity) | 3.75 | 4.2667x | 8.208 |
59
+
60
+ Grouped archive (all scenarios in one repo):
61
+ [AvoCahDoe/qwen2-5-7b-rlmpq](https://huggingface.co/AvoCahDoe/qwen2-5-7b-rlmpq)
62
+
63
+ ## Method
64
+
65
+ 1. **Phase 3** — PPO agent assigns per-layer bit widths under the Aggressive reward target.
66
+ 2. **Phase 4** — Policy replayed on real weights; WikiText-2 perplexity validates quality.
67
+ 3. **Export** — Fake-quantized FP16 weights compatible with Hugging Face Transformers.
68
+
69
+ ## Files
70
+
71
+ | File | Description |
72
+ |------|-------------|
73
+ | `config.json` | Llama architecture + RL-MPQ metadata |
74
+ | `model.safetensors` | Fake-quantized weights |
75
+ | `rlmpq_policy.json` | Per-layer bit-width policy |
76
+ | `rlmpq_metrics.json` | Validation & PPL summary |
77
+
78
+ ## Citation
79
+
80
+ ```bibtex
81
+ @misc{rlmpq_qwen2_5_7b_aggressive_2026,
82
+ title = {RL-MPQ Aggressive: Qwen 2.5 7B Mixed-Precision Quantization},
83
+ author = {AvoCahDoe},
84
+ year = {2026},
85
+ url = {https://huggingface.co/AvoCahDoe/qwen2-5-7b-rlmpq-aggressive}
86
+ }
87
+ ```
chat_template.jinja ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0]['role'] == 'system' %}
4
+ {{- messages[0]['content'] }}
5
+ {%- else %}
6
+ {{- 'You are a helpful assistant.' }}
7
+ {%- endif %}
8
+ {{- "\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 <tools></tools> XML tags:\n<tools>" }}
9
+ {%- for tool in tools %}
10
+ {{- "\n" }}
11
+ {{- tool | tojson }}
12
+ {%- endfor %}
13
+ {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
14
+ {%- else %}
15
+ {%- if messages[0]['role'] == 'system' %}
16
+ {{- '<|im_start|>system\n' + messages[0]['content'] + '<|im_end|>\n' }}
17
+ {%- else %}
18
+ {{- '<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n' }}
19
+ {%- endif %}
20
+ {%- endif %}
21
+ {%- for message in messages %}
22
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) or (message.role == "assistant" and not message.tool_calls) %}
23
+ {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
24
+ {%- elif message.role == "assistant" %}
25
+ {{- '<|im_start|>' + message.role }}
26
+ {%- if message.content %}
27
+ {{- '\n' + message.content }}
28
+ {%- endif %}
29
+ {%- for tool_call in message.tool_calls %}
30
+ {%- if tool_call.function is defined %}
31
+ {%- set tool_call = tool_call.function %}
32
+ {%- endif %}
33
+ {{- '\n<tool_call>\n{"name": "' }}
34
+ {{- tool_call.name }}
35
+ {{- '", "arguments": ' }}
36
+ {{- tool_call.arguments | tojson }}
37
+ {{- '}\n</tool_call>' }}
38
+ {%- endfor %}
39
+ {{- '<|im_end|>\n' }}
40
+ {%- elif message.role == "tool" %}
41
+ {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != "tool") %}
42
+ {{- '<|im_start|>user' }}
43
+ {%- endif %}
44
+ {{- '\n<tool_response>\n' }}
45
+ {{- message.content }}
46
+ {{- '\n</tool_response>' }}
47
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
48
+ {{- '<|im_end|>\n' }}
49
+ {%- endif %}
50
+ {%- endif %}
51
+ {%- endfor %}
52
+ {%- if add_generation_prompt %}
53
+ {{- '<|im_start|>assistant\n' }}
54
+ {%- endif %}
config.json ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen2ForCausalLM"
4
+ ],
5
+ "attention_dropout": 0.0,
6
+ "bos_token_id": 151643,
7
+ "dtype": "bfloat16",
8
+ "eos_token_id": 151643,
9
+ "hidden_act": "silu",
10
+ "hidden_size": 3584,
11
+ "initializer_range": 0.02,
12
+ "intermediate_size": 18944,
13
+ "layer_types": [
14
+ "full_attention",
15
+ "full_attention",
16
+ "full_attention",
17
+ "full_attention",
18
+ "full_attention",
19
+ "full_attention",
20
+ "full_attention",
21
+ "full_attention",
22
+ "full_attention",
23
+ "full_attention",
24
+ "full_attention",
25
+ "full_attention",
26
+ "full_attention",
27
+ "full_attention",
28
+ "full_attention",
29
+ "full_attention",
30
+ "full_attention",
31
+ "full_attention",
32
+ "full_attention",
33
+ "full_attention",
34
+ "full_attention",
35
+ "full_attention",
36
+ "full_attention",
37
+ "full_attention",
38
+ "full_attention",
39
+ "full_attention",
40
+ "full_attention",
41
+ "full_attention"
42
+ ],
43
+ "max_position_embeddings": 131072,
44
+ "max_window_layers": 28,
45
+ "model_type": "qwen2",
46
+ "num_attention_heads": 28,
47
+ "num_hidden_layers": 28,
48
+ "num_key_value_heads": 4,
49
+ "pad_token_id": null,
50
+ "rms_norm_eps": 1e-06,
51
+ "rope_parameters": {
52
+ "rope_theta": 1000000.0,
53
+ "rope_type": "default",
54
+ "type": "default"
55
+ },
56
+ "sliding_window": null,
57
+ "tie_word_embeddings": false,
58
+ "transformers_version": "5.11.0",
59
+ "use_cache": true,
60
+ "use_mrope": false,
61
+ "use_sliding_window": false,
62
+ "vocab_size": 152064,
63
+ "base_model": "Qwen/Qwen2.5-7B",
64
+ "quantization": {
65
+ "method": "rl-mpq",
66
+ "format": "fake-quant-fp16",
67
+ "scenario": "Aggressive",
68
+ "avg_bits": 3.1429,
69
+ "description": "Per-layer mixed bit-width via PPO-trained policy (not GPTQ/AWQ)"
70
+ },
71
+ "rlmpq": {
72
+ "framework": "RL-NMP-Model-Quantasation",
73
+ "scenario": "Aggressive",
74
+ "scenario_label": "Aggressive",
75
+ "repo_id": "AvoCahDoe/qwen2-5-7b-rlmpq-aggressive",
76
+ "grouped_repo": "AvoCahDoe/qwen2-5-7b-rlmpq",
77
+ "collection_title": "RL-MPQ \u2014 Qwen 2.5 7B"
78
+ }
79
+ }
generation_config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 151643,
3
+ "do_sample": false,
4
+ "eos_token_id": 151643,
5
+ "max_new_tokens": 2048,
6
+ "transformers_version": "5.11.0"
7
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dde7f689c1f870dfb8b32cc4558858324c70e36b27429dfc2846b829cd1e3b4f
3
+ size 15231272152
rlmpq_metrics.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "framework": "RL-NMP-Model-Quantasation",
3
+ "method": "RL-MPQ",
4
+ "repo_id": "AvoCahDoe/qwen2-5-7b-rlmpq-aggressive",
5
+ "base_model": "Qwen/Qwen2.5-7B",
6
+ "model_slug": "qwen2_5_7b",
7
+ "scenario": "Aggressive",
8
+ "scenario_label": "Aggressive",
9
+ "avg_bits_per_weight": 3.1429,
10
+ "compression_vs_fp16": 5.0909,
11
+ "wikitext2_perplexity": 9.3678,
12
+ "bit_distribution": {
13
+ "3": 24,
14
+ "4": 4
15
+ },
16
+ "quantization": {
17
+ "type": "fake-quant-fp16",
18
+ "group_size": 128,
19
+ "scheme": "per-layer asymmetric group-wise",
20
+ "packed_format": false
21
+ },
22
+ "exported_at": "2026-06-11T21:10:06.436057",
23
+ "policy_source": "/workspace/RL-NMP-Model-Quantasation/phase3/models/qwen2_5_7b/results/Aggressive_policy.json",
24
+ "policy_path": "/workspace/RL-NMP-Model-Quantasation/phase3/models/qwen2_5_7b/results/Aggressive_policy.json",
25
+ "training_run": "20260610_202902"
26
+ }
rlmpq_policy.json ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "slug": "qwen2_5_7b",
3
+ "hf_id": "Qwen/Qwen2.5-7B",
4
+ "scenario": "Aggressive",
5
+ "params": {
6
+ "target_bits": 2.75,
7
+ "lambda_lag": 30,
8
+ "lambda_mse": 1.2,
9
+ "lambda_bit": 0.85
10
+ },
11
+ "policy": [
12
+ 4,
13
+ 4,
14
+ 4,
15
+ 3,
16
+ 4,
17
+ 3,
18
+ 3,
19
+ 3,
20
+ 3,
21
+ 3,
22
+ 3,
23
+ 3,
24
+ 3,
25
+ 3,
26
+ 3,
27
+ 3,
28
+ 3,
29
+ 3,
30
+ 3,
31
+ 3,
32
+ 3,
33
+ 3,
34
+ 3,
35
+ 3,
36
+ 3,
37
+ 3,
38
+ 3,
39
+ 3
40
+ ],
41
+ "num_layers": 28,
42
+ "avg_bits": 3.1429,
43
+ "total_reward": -28.020284,
44
+ "compression_ratio": 5.0909,
45
+ "approx_size_gb": 2.75,
46
+ "bit_distribution": {
47
+ "3": 24,
48
+ "4": 4
49
+ },
50
+ "avg_mse_per_bit": {
51
+ "4": 1.165e-05,
52
+ "3": 5.632e-05
53
+ },
54
+ "validation_elapsed_s": 0.0479,
55
+ "policy_source": "/workspace/RL-NMP-Model-Quantasation/phase3/models/qwen2_5_7b/results/Aggressive_policy.json",
56
+ "policy_path": "/workspace/RL-NMP-Model-Quantasation/phase3/models/qwen2_5_7b/results/Aggressive_policy.json",
57
+ "training_run": "20260610_202902"
58
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3fd169731d2cbde95e10bf356d66d5997fd885dd8dbb6fb4684da3f23b2585d8
3
+ size 11421892
tokenizer_config.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": null,
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|endoftext|>",
7
+ "errors": "replace",
8
+ "extra_special_tokens": [
9
+ "<|im_start|>",
10
+ "<|im_end|>",
11
+ "<|object_ref_start|>",
12
+ "<|object_ref_end|>",
13
+ "<|box_start|>",
14
+ "<|box_end|>",
15
+ "<|quad_start|>",
16
+ "<|quad_end|>",
17
+ "<|vision_start|>",
18
+ "<|vision_end|>",
19
+ "<|vision_pad|>",
20
+ "<|image_pad|>",
21
+ "<|video_pad|>"
22
+ ],
23
+ "is_local": false,
24
+ "local_files_only": false,
25
+ "model_max_length": 131072,
26
+ "pad_token": "<|endoftext|>",
27
+ "split_special_tokens": false,
28
+ "tokenizer_class": "Qwen2Tokenizer",
29
+ "unk_token": null
30
+ }