Mohammed-Altaf commited on
Commit
112e90e
Β·
1 Parent(s): 77e6bd1

updated readme

Browse files
Files changed (2) hide show
  1. README.md +28 -11
  2. neural_tuner_trl_mac.ipynb +1 -1
README.md CHANGED
@@ -152,10 +152,10 @@ A per-layer float in [0.0, 1.0] that quantifies how much that layer's output deg
152
  Sensitivity scores are **hidden from the agent at episode start** β€” they must be revealed layer-by-layer using `profile_layer()`. This is the core information asymmetry that makes the task non-trivial.
153
 
154
  ### Oracle Ceiling
155
- The best reward achievable by a perfect agent that knows all layer sensitivities in advance and makes optimal quantization decisions to satisfy constraints. For the inception_v3 medium scenario: **oracle ceiling = 0.6428**. This is computed offline by running the heuristic policy (profile all β†’ assign dtype by sensitivity threshold β†’ benchmark β†’ submit). The oracle is not the theoretical maximum reward of 1.0 β€” it represents what a knowledgeable human engineer would achieve, providing a realistic upper bound for RL training.
156
 
157
  ### Random Baseline
158
- The mean reward of a fully random policy (random action type, random layer, random dtype) averaged over 20 seeds. For inception_v3 medium: **random baseline = 0.465**. Somewhat counter-intuitively, the random baseline is not near zero β€” the binary memory_reward (0.30) and partial latency improvement from random quantizations push it above chance. The RL agent must meaningfully exceed this to demonstrate genuine policy learning.
159
 
160
  ### Lift vs Random / Lift vs Oracle
161
  Two derived metrics used to track training progress:
@@ -183,7 +183,7 @@ Step 12: submit() β†’ reward = 0.3037, constraints_met
183
 
184
  The random agent never profiles. It applies dtypes without knowledge of sensitivity, frequently leaves high-sensitivity layers under-protected and low-sensitivity layers under-compressed simultaneously.
185
 
186
- ### Heuristic Agent (reward: 0.64 β€” oracle ceiling)
187
  ```
188
  Step 1: profile_layer(conv_stem) β†’ sensitivity=0.040 [low risk β€” INT4 safe]
189
  Step 2: profile_layer(conv_bn_1) β†’ sensitivity=0.020 [low risk β€” INT4 safe]
@@ -198,7 +198,7 @@ Step 10: quantize_layer(mixed_4a, INT8) ← protects medium-sensitivity layer
198
  Step 11: quantize_layer(mixed_5a, INT4)
199
  Step 12: quantize_layer(mixed_6a, INT8) ← protects medium-sensitivity layer
200
  Step 13: benchmark()
201
- Step 14: submit() β†’ reward = 0.6428, constraints_met = False
202
  ```
203
 
204
  The heuristic agent profiles first, builds a sensitivity map, then assigns dtypes proportional to each layer's risk tolerance. The RL agent's goal is to learn this pattern from reward signals alone β€” without being told the strategy.
@@ -211,7 +211,7 @@ The heuristic agent profiles first, builds a sensitivity map, then assigns dtype
211
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
212
  β”‚ Training Pipeline β”‚
213
  β”‚ β”‚
214
- β”‚ Base LLM (Qwen-2.5-0.5B-Instruct) β”‚
215
  β”‚ β”‚ β”‚
216
  β”‚ β–Ό β”‚
217
  β”‚ SFT Warm-up ── heuristic trajectories ── 20 steps, LoRA β”‚
@@ -230,19 +230,19 @@ The heuristic agent profiles first, builds a sensitivity map, then assigns dtype
230
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
231
  ```
232
 
233
- ### Baseline Metrics (pre-training)
234
 
235
  | Metric | Value |
236
  |--------|-------|
237
- | Random policy reward (mean, n=20) | 0.465 |
238
- | Random policy reward (std) | 0.188 |
239
- | Oracle ceiling (heuristic) | 0.643 |
240
- | Lift from random β†’ oracle | 0.178 |
241
 
242
  ### Training Results
243
 
244
  ![Post-training evaluation](artifacts/plots/post_training_eval.png)
245
- *GRPO training reward trajectory vs random baseline (0.465) and oracle ceiling (0.643)*
246
 
247
  ![Pre-training reward distribution](artifacts/plots/pre_training_reward_distribution.png)
248
  *Pre-training random policy reward distribution β€” inception_v3 medium, n=20 seeds*
@@ -358,6 +358,17 @@ python rollout_eval.py --trace --model-id inception_v3 --difficulty medium
358
  pytest -q
359
  ```
360
 
 
 
 
 
 
 
 
 
 
 
 
361
  ---
362
 
363
  ## OpenEnv Deployment
@@ -394,3 +405,9 @@ Current test suite covers:
394
  - Invalid layer handling: unknown layer IDs, missing dtype/sparsity arguments
395
  - Terminal state: submit() terminates episode; subsequent steps return episode_complete
396
  - Training metrics schema: eval_metrics.json structure validation
 
 
 
 
 
 
 
152
  Sensitivity scores are **hidden from the agent at episode start** β€” they must be revealed layer-by-layer using `profile_layer()`. This is the core information asymmetry that makes the task non-trivial.
153
 
154
  ### Oracle Ceiling
155
+ The best reward achievable by a strong reference policy that knows all layer sensitivities in advance and makes near-optimal quantization decisions for this setup. For the inception_v3 medium scenario used in training diagnostics: **oracle ceiling = 0.6428**. This is computed offline by running a heuristic policy (profile all β†’ assign dtype by sensitivity threshold β†’ benchmark β†’ submit). The oracle is not the theoretical maximum reward of 1.0; it is a practical upper bound for this environment configuration.
156
 
157
  ### Random Baseline
158
+ The mean reward of a random policy (random action type, random layer, random dtype) averaged over 20 seeds. For inception_v3 medium: **random baseline = 0.4650**. This value is not near zero because the reward has non-zero floor components (especially memory satisfaction in many trajectories) and random compression can still yield partial latency gains.
159
 
160
  ### Lift vs Random / Lift vs Oracle
161
  Two derived metrics used to track training progress:
 
183
 
184
  The random agent never profiles. It applies dtypes without knowledge of sensitivity, frequently leaves high-sensitivity layers under-protected and low-sensitivity layers under-compressed simultaneously.
185
 
186
+ ### Heuristic Agent (representative trace)
187
  ```
188
  Step 1: profile_layer(conv_stem) β†’ sensitivity=0.040 [low risk β€” INT4 safe]
189
  Step 2: profile_layer(conv_bn_1) β†’ sensitivity=0.020 [low risk β€” INT4 safe]
 
198
  Step 11: quantize_layer(mixed_5a, INT4)
199
  Step 12: quantize_layer(mixed_6a, INT8) ← protects medium-sensitivity layer
200
  Step 13: benchmark()
201
+ Step 14: submit() β†’ reward = 0.6428
202
  ```
203
 
204
  The heuristic agent profiles first, builds a sensitivity map, then assigns dtypes proportional to each layer's risk tolerance. The RL agent's goal is to learn this pattern from reward signals alone β€” without being told the strategy.
 
211
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
212
  β”‚ Training Pipeline β”‚
213
  β”‚ β”‚
214
+ β”‚ Base LLM (Qwen2.5/DeepSeek-Qwen family; configurable) β”‚
215
  β”‚ β”‚ β”‚
216
  β”‚ β–Ό β”‚
217
  β”‚ SFT Warm-up ── heuristic trajectories ── 20 steps, LoRA β”‚
 
230
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
231
  ```
232
 
233
+ ### Baseline and Reference Metrics
234
 
235
  | Metric | Value |
236
  |--------|-------|
237
+ | Random policy reward (mean, n=20) | 0.4650 |
238
+ | Random policy reward (std) | 0.1883 |
239
+ | Oracle ceiling (heuristic reference) | 0.6428 |
240
+ | Headroom (oracle - random) | 0.1778 |
241
 
242
  ### Training Results
243
 
244
  ![Post-training evaluation](artifacts/plots/post_training_eval.png)
245
+ *GRPO training reward trajectory vs random baseline (0.4650) and oracle ceiling (0.6428)*
246
 
247
  ![Pre-training reward distribution](artifacts/plots/pre_training_reward_distribution.png)
248
  *Pre-training random policy reward distribution β€” inception_v3 medium, n=20 seeds*
 
358
  pytest -q
359
  ```
360
 
361
+ ## Reproducibility Checklist
362
+
363
+ - Fixed random seeds for splits and evaluation where possible.
364
+ - Baselines computed before training and stored in artifacts.
365
+ - Training/eval metrics written to JSON:
366
+ - `artifacts/training/train_metrics.json`
367
+ - `artifacts/training/eval_metrics.json`
368
+ - `artifacts/training/comparison_metrics.json`
369
+ - Notebook and script paths are both supported, with script-first evaluation recommended for final reporting:
370
+ - `python scripts/run_training_eval.py`
371
+
372
  ---
373
 
374
  ## OpenEnv Deployment
 
405
  - Invalid layer handling: unknown layer IDs, missing dtype/sparsity arguments
406
  - Terminal state: submit() terminates episode; subsequent steps return episode_complete
407
  - Training metrics schema: eval_metrics.json structure validation
408
+
409
+ ## Ethics and Reporting Policy
410
+
411
+ - No baseline manipulation or metric tampering is used.
412
+ - All reported values are loaded from saved artifacts in this repository.
413
+ - "Oracle" is reported as a heuristic reference bound, not a proof of global optimality.
neural_tuner_trl_mac.ipynb CHANGED
@@ -1725,7 +1725,7 @@
1725
  ],
1726
  "metadata": {
1727
  "kernelspec": {
1728
- "display_name": "round-2 (3.13.12)",
1729
  "language": "python",
1730
  "name": "python3"
1731
  },
 
1725
  ],
1726
  "metadata": {
1727
  "kernelspec": {
1728
+ "display_name": ".venv (3.13.12)",
1729
  "language": "python",
1730
  "name": "python3"
1731
  },