AvoCahDoe commited on
Commit
5353270
·
verified ·
1 Parent(s): 2da29fe

RL-MPQ Balanced — 2026-06-11T20:29:45.309427

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: gemma
3
+ base_model: google/gemma-2-9b
4
+ pipeline_tag: text-generation
5
+ language:
6
+ - en
7
+ tags:
8
+ - gemma
9
+ - text-generation
10
+ - rl-mpq
11
+ - mixed-precision
12
+ - quantization
13
+ - fake-quantization
14
+ - balanced
15
+ library_name: transformers
16
+ datasets:
17
+ - wikitext
18
+ widget:
19
+ - text: "The capital of France is"
20
+ ---
21
+
22
+ # Gemma 2 9B — RL-MPQ Balanced
23
+
24
+ Standalone **RL-MPQ** (Reinforcement Learning Mixed-Precision Quantization) checkpoint for the
25
+ **Balanced** scenario — a quantized variant of
26
+ [google/gemma-2-9b](https://huggingface.co/google/gemma-2-9b).
27
+
28
+ | Field | Value |
29
+ |-------|-------|
30
+ | **Base model** | [google/gemma-2-9b](https://huggingface.co/google/gemma-2-9b) |
31
+ | **Scenario** | Balanced |
32
+ | **Avg bits / weight** | 4.2857 |
33
+ | **Compression vs FP16** | 3.7333× |
34
+ | **WikiText-2 PPL** | 127.0798 |
35
+ | **Layers** | 42 |
36
+ | **Bit distribution** | `{'4': 39, '8': 3}` |
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/gemma-2-9b-rlmpq-balanced"
46
+
47
+ model = AutoModelForCausalLM.from_pretrained(repo, torch_dtype="float16")
48
+ tokenizer = AutoTokenizer.from_pretrained(repo)
49
+ ```
50
+
51
+ ## Other Gemma 2 9B scenarios
52
+
53
+ | Scenario | Avg bits | Compression | WikiText-2 PPL |
54
+ |----------|----------|-------------|----------------|
55
+ | [Aggressive](https://huggingface.co/AvoCahDoe/gemma-2-9b-rlmpq-aggressive) | 3.6667 | 4.3636x | 162.8437 |
56
+ | [Conservative](https://huggingface.co/AvoCahDoe/gemma-2-9b-rlmpq-conservative) | 5.1429 | 3.1111x | 116.5244 |
57
+ | [Extreme Survival](https://huggingface.co/AvoCahDoe/gemma-2-9b-rlmpq-extreme-survival) | 2.7857 | 5.7436x | 424.7991 |
58
+ | [High Fidelity](https://huggingface.co/AvoCahDoe/gemma-2-9b-rlmpq-high-fidelity) | 7.0476 | 2.2703x | 104.8098 |
59
+
60
+ Grouped archive (all scenarios in one repo):
61
+ [AvoCahDoe/gemma-2-9b-rlmpq](https://huggingface.co/AvoCahDoe/gemma-2-9b-rlmpq)
62
+
63
+ ## Method
64
+
65
+ 1. **Phase 3** — PPO agent assigns per-layer bit widths under the Balanced 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_gemma_2_9b_balanced_2026,
82
+ title = {RL-MPQ Balanced: Gemma 2 9B Mixed-Precision Quantization},
83
+ author = {AvoCahDoe},
84
+ year = {2026},
85
+ url = {https://huggingface.co/AvoCahDoe/gemma-2-9b-rlmpq-balanced}
86
+ }
87
+ ```
config.json ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Gemma2ForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "attn_logit_softcapping": 50.0,
8
+ "bos_token_id": 2,
9
+ "cache_implementation": "hybrid",
10
+ "dtype": "bfloat16",
11
+ "eos_token_id": 1,
12
+ "final_logit_softcapping": 30.0,
13
+ "head_dim": 256,
14
+ "hidden_act": "gelu_pytorch_tanh",
15
+ "hidden_activation": "gelu_pytorch_tanh",
16
+ "hidden_size": 3584,
17
+ "initializer_range": 0.02,
18
+ "intermediate_size": 14336,
19
+ "layer_types": [
20
+ "sliding_attention",
21
+ "full_attention",
22
+ "sliding_attention",
23
+ "full_attention",
24
+ "sliding_attention",
25
+ "full_attention",
26
+ "sliding_attention",
27
+ "full_attention",
28
+ "sliding_attention",
29
+ "full_attention",
30
+ "sliding_attention",
31
+ "full_attention",
32
+ "sliding_attention",
33
+ "full_attention",
34
+ "sliding_attention",
35
+ "full_attention",
36
+ "sliding_attention",
37
+ "full_attention",
38
+ "sliding_attention",
39
+ "full_attention",
40
+ "sliding_attention",
41
+ "full_attention",
42
+ "sliding_attention",
43
+ "full_attention",
44
+ "sliding_attention",
45
+ "full_attention",
46
+ "sliding_attention",
47
+ "full_attention",
48
+ "sliding_attention",
49
+ "full_attention",
50
+ "sliding_attention",
51
+ "full_attention",
52
+ "sliding_attention",
53
+ "full_attention",
54
+ "sliding_attention",
55
+ "full_attention",
56
+ "sliding_attention",
57
+ "full_attention",
58
+ "sliding_attention",
59
+ "full_attention",
60
+ "sliding_attention",
61
+ "full_attention"
62
+ ],
63
+ "max_position_embeddings": 8192,
64
+ "model_type": "gemma2",
65
+ "num_attention_heads": 16,
66
+ "num_hidden_layers": 42,
67
+ "num_key_value_heads": 8,
68
+ "pad_token_id": 0,
69
+ "query_pre_attn_scalar": 256,
70
+ "rms_norm_eps": 1e-06,
71
+ "rope_parameters": {
72
+ "rope_theta": 10000.0,
73
+ "rope_type": "default",
74
+ "type": "default"
75
+ },
76
+ "sliding_window": 4096,
77
+ "sliding_window_size": 4096,
78
+ "tie_word_embeddings": true,
79
+ "transformers_version": "5.11.0",
80
+ "use_bidirectional_attention": null,
81
+ "use_cache": true,
82
+ "vocab_size": 256000,
83
+ "base_model": "google/gemma-2-9b",
84
+ "quantization": {
85
+ "method": "rl-mpq",
86
+ "format": "fake-quant-fp16",
87
+ "scenario": "Balanced",
88
+ "avg_bits": 4.2857,
89
+ "description": "Per-layer mixed bit-width via PPO-trained policy (not GPTQ/AWQ)"
90
+ },
91
+ "rlmpq": {
92
+ "framework": "RL-NMP-Model-Quantasation",
93
+ "scenario": "Balanced",
94
+ "scenario_label": "Balanced",
95
+ "repo_id": "AvoCahDoe/gemma-2-9b-rlmpq-balanced",
96
+ "grouped_repo": "AvoCahDoe/gemma-2-9b-rlmpq",
97
+ "collection_title": "RL-MPQ \u2014 Gemma 2 9B"
98
+ }
99
+ }
generation_config.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 2,
4
+ "cache_implementation": "hybrid",
5
+ "eos_token_id": 1,
6
+ "pad_token_id": 0,
7
+ "transformers_version": "5.11.0"
8
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:76d0b084b91649e0ae30aa79e829ff7cec6901d8f9c7b15ae33bc9a226201788
3
+ size 18483467000
rlmpq_metrics.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "framework": "RL-NMP-Model-Quantasation",
3
+ "method": "RL-MPQ",
4
+ "repo_id": "AvoCahDoe/gemma-2-9b-rlmpq-balanced",
5
+ "base_model": "google/gemma-2-9b",
6
+ "model_slug": "gemma_2_9b",
7
+ "scenario": "Balanced",
8
+ "scenario_label": "Balanced",
9
+ "avg_bits_per_weight": 4.2857,
10
+ "compression_vs_fp16": 3.7333,
11
+ "wikitext2_perplexity": 127.0798,
12
+ "bit_distribution": {
13
+ "4": 39,
14
+ "8": 3
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-11T20:29:44.975370",
23
+ "policy_source": "/workspace/RL-NMP-Model-Quantasation/phase3/models/gemma_2_9b/results/Balanced_policy.json",
24
+ "policy_path": "/workspace/RL-NMP-Model-Quantasation/phase3/models/gemma_2_9b/results/Balanced_policy.json",
25
+ "training_run": "20260610_202902"
26
+ }
rlmpq_policy.json ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "slug": "gemma_2_9b",
3
+ "hf_id": "google/gemma-2-9b",
4
+ "scenario": "Balanced",
5
+ "params": {
6
+ "lambda_mse": 1.0,
7
+ "lambda_bit": 0.25,
8
+ "max_mse_clip": 1.0,
9
+ "target_bits": 4.5,
10
+ "lambda_budget": 5.0
11
+ },
12
+ "policy": [
13
+ 4,
14
+ 4,
15
+ 4,
16
+ 4,
17
+ 4,
18
+ 4,
19
+ 4,
20
+ 4,
21
+ 4,
22
+ 4,
23
+ 4,
24
+ 4,
25
+ 4,
26
+ 4,
27
+ 4,
28
+ 4,
29
+ 4,
30
+ 4,
31
+ 4,
32
+ 4,
33
+ 4,
34
+ 4,
35
+ 4,
36
+ 4,
37
+ 4,
38
+ 4,
39
+ 4,
40
+ 4,
41
+ 4,
42
+ 4,
43
+ 4,
44
+ 4,
45
+ 4,
46
+ 4,
47
+ 4,
48
+ 4,
49
+ 4,
50
+ 4,
51
+ 4,
52
+ 8,
53
+ 8,
54
+ 8
55
+ ],
56
+ "num_layers": 42,
57
+ "avg_bits": 4.2857,
58
+ "total_reward": -6.244206,
59
+ "compression_ratio": 3.7333,
60
+ "approx_size_gb": 4.821,
61
+ "bit_distribution": {
62
+ "4": 39,
63
+ "8": 3
64
+ },
65
+ "avg_mse_per_bit": {
66
+ "4": 0.02916564,
67
+ "8": 4.197e-05
68
+ },
69
+ "validation_elapsed_s": 0.034,
70
+ "policy_source": "/workspace/RL-NMP-Model-Quantasation/phase3/models/gemma_2_9b/results/Balanced_policy.json",
71
+ "policy_path": "/workspace/RL-NMP-Model-Quantasation/phase3/models/gemma_2_9b/results/Balanced_policy.json",
72
+ "training_run": "20260610_202902"
73
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:487cee8724215dcd2dde8888539e8b1bf844ceb5dbbe27f7845abda69eeb060f
3
+ size 34362872
tokenizer_config.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "backend": "tokenizers",
3
+ "bos_token": "<bos>",
4
+ "clean_up_tokenization_spaces": false,
5
+ "eos_token": "<eos>",
6
+ "extra_special_tokens": [
7
+ "<start_of_turn>",
8
+ "<end_of_turn>"
9
+ ],
10
+ "is_local": false,
11
+ "local_files_only": false,
12
+ "mask_token": "<mask>",
13
+ "model_max_length": 1000000000000000019884624838656,
14
+ "pad_token": "<pad>",
15
+ "sp_model_kwargs": {},
16
+ "spaces_between_special_tokens": false,
17
+ "tokenizer_class": "GemmaTokenizer",
18
+ "unk_token": "<unk>",
19
+ "use_default_system_prompt": false
20
+ }