Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- lm-quant-toolkit/data-vis/endeavors/milp/data/stor/mxq/mxq2/result-eval_model_stor_dense-6bit-gap-mxq-20241021182655.csv +103 -0
- lm-quant-toolkit/data-vis/endeavors/milp/data/stor/mxq/sensi-milp-3/result-sensi-milp-3_stor-20250106081842.csv +61 -0
- lm-quant-toolkit/data-vis/functions/allocation.R +136 -0
- lm-quant-toolkit/docs/make.bat +35 -0
- lm-quant-toolkit/docs/source/_static/.gitkeep +0 -0
- lm-quant-toolkit/docs/source/modules/index.rst +12 -0
- lm-quant-toolkit/kurtosis_means/kurtosis_means-Llama-2-13b-hf.json +42 -0
- lm-quant-toolkit/kurtosis_means/kurtosis_means-Llama-2-7b-hf.json +34 -0
- lm-quant-toolkit/kurtosis_means/kurtosis_means-Llama-3.1-70B-Instruct.json +82 -0
- lm-quant-toolkit/kurtosis_means/kurtosis_means-Llama-3.2-3B-Instruct.json +30 -0
- lm-quant-toolkit/kurtosis_means/kurtosis_means-Mistral-7B-Instruct-v0.3.json +34 -0
- lm-quant-toolkit/kurtosis_means/kurtosis_means-Qwen3-4B.json +38 -0
- lm-quant-toolkit/kurtosis_means/kurtosis_means-Qwen3-8B.json +38 -0
- lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/.coveragerc +3 -0
- lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/.editorconfig +29 -0
- lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/.github/workflows/ci.yml +29 -0
- lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/.gitignore +26 -0
- lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/LICENSE +17 -0
- lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/MANIFEST.in +5 -0
- lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/README.md +431 -0
- lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/archived/check-quant-mem.R +142 -0
- lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/archived/kurt.R +4 -0
- lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/archived/llm-3d.R +98 -0
- lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/archived/plot-mxq-gap.R +165 -0
- lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/archived/plot-mxq-kurt.R +124 -0
- lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/archived/plot-ppl-vs-bit.R +39 -0
- lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/archived/plot-quant-cfg-all.R +208 -0
- lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/archived/plot-quant-cfg-diff.R +215 -0
- lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/archived/plot-quantiles-laplacian.R +101 -0
- lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/check-lowbits-allot.R +223 -0
- lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/check-mem.R +28 -0
- lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/check-mxq-allocation.R +260 -0
- lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/check-normality.R +239 -0
- lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/combine-vit.R +77 -0
- lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/combine.R +148 -0
- lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/data-vis.Rproj +14 -0
- lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/data/allot/mxq/kurt-scaled/quant-cfg-allot-kurt-scaled.csv +0 -0
- lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/data/allot/mxq/mxq1/quant-cfg-allot-mxq1.csv +0 -0
- lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/data/allot/mxq/mxq2/quant-cfg-allot-mxq1.csv +0 -0
- lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/data/allot/quant-cfg-allot-hqq.csv +0 -0
- lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/data/combined.csv +0 -0
- lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/data/fnorm/fnorm-Llama-2-13b-hf.csv +0 -0
- lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/data/fnorm/fnorm-Llama-2-70b-hf.csv +0 -0
- lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/data/fnorm/fnorm-Llama-2-7b-hf.csv +0 -0
- lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/data/fnorm/fnorm-Llama-3-70B.csv +0 -0
- lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/data/fnorm/fnorm-Meta-Llama-3-8B.csv +0 -0
- lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/data/fnorm/fnorm-Meta-Llama-3.1-405B-Instruct.csv +0 -0
- lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/data/llama-mxq-cfgs.csv +0 -0
- lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/data/llama-sensitivity.csv +0 -0
- lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/data/mistral-sensi.csv +0 -0
lm-quant-toolkit/data-vis/endeavors/milp/data/stor/mxq/mxq2/result-eval_model_stor_dense-6bit-gap-mxq-20241021182655.csv
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
model,algo,config,config_detail,quant_duration,model_storage_size,load_mem_allot,load_mem_reserved,ppl_mem_allot,ppl_mem_reserved,leaderboard_mem_allot,leaderboard_mem_reserved,ppl_wikitext,ppl_c4,duration_wikitext,duration_c4,duration_leaderboard,ifeval,bbh,mathlevel5,gpqa,musr,mmlupro
|
| 2 |
+
Meta-Llama-3-8B,mxq,6_17,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.17}",27.897204399108887,7485183508,8516087808,8652849152,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 3 |
+
Meta-Llama-3-8B,mxq,6_13,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.13}",27.16243457794189,7450298516,8481203200,8600420352,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 4 |
+
Llama-2-13b-hf,mxq,6_43,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.43}",46.30563282966614,10854440732,12097200128,12243173376,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 5 |
+
Llama-2-7b-hf,mxq,6_51,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.51}",23.463457584381104,5795111612,6586642432,6677331968,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 6 |
+
Llama-2-13b-hf,mxq,6_61,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.61}",46.43784809112549,11140123292,12344225792,12501123072,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 7 |
+
Llama-2-13b-hf,mxq,6_03,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.03}",46.71054410934448,10252303460,11495066624,11641290752,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 8 |
+
Llama-2-7b-hf,mxq,6_53,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.53}",24.52638339996338,5811356540,6602887168,6698303488,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 9 |
+
Meta-Llama-3-8B,mxq,6_19,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.19}",27.111940145492557,7502629012,8533533696,8665432064,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 10 |
+
Llama-2-7b-hf,mxq,6_57,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.57}",23.907305002212524,5843763920,6610669568,6616514560,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 11 |
+
Meta-Llama-3-8B,mxq,6_21,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.21}",29.018717288970947,7520072852,8550977536,8686403584,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 12 |
+
Llama-2-13b-hf,mxq,6_65,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.65}",47.17227268218994,11203349872,12407448576,12570329088,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 13 |
+
Meta-Llama-3-8B,mxq,6_25,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.25}",27.41607975959778,7555026132,8553861120,8562671616,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 14 |
+
Meta-Llama-3-8B,mxq,6_05,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.05}",28.85113024711609,7380525204,8411429888,8537505792,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 15 |
+
Meta-Llama-3-8B,mxq,6_37,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.37}",27.54041886329651,7659687060,8658522112,8669626368,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 16 |
+
Llama-2-13b-hf,mxq,6_15,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.15}",46.54898977279663,10410322876,11653085184,11813257216,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 17 |
+
Llama-2-7b-hf,mxq,6_39,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.39}",23.91982316970825,5698050076,6489579520,6587154432,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 18 |
+
Llama-2-7b-hf,mxq,6_45,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.45}",24.38323426246643,5746566620,6538096640,6637486080,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 19 |
+
Llama-2-7b-hf,mxq,6_65,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.65}",23.886759757995605,5908418792,6675324928,6685720576,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 20 |
+
Llama-2-13b-hf,mxq,6_21,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.21}",46.40047907829285,10505550492,11748312064,11899240448,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 21 |
+
Meta-Llama-3-8B,mxq,6_15,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.15}",28.569599866867065,7467742420,8498647040,8621391872,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 22 |
+
Llama-2-13b-hf,mxq,6_63,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.63}",51.29404067993164,11171746032,12375844864,12526288896,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 23 |
+
Meta-Llama-3-8B,mxq,6_33,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.33}",29.371028900146484,7624662548,8623497216,8644460544,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 24 |
+
Llama-2-7b-hf,mxq,6_47,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.47}",23.96006774902344,5762704604,6554234880,6656360448,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 25 |
+
Llama-2-7b-hf,mxq,6_09,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.09}",24.21409010887146,5455138928,6246666240,6350176256,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 26 |
+
Llama-2-7b-hf,mxq,6_13,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.13}",24.36617374420166,5487279632,6278807552,6373244928,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 27 |
+
Llama-2-13b-hf,mxq,6_11,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.11}",46.670965909957886,10347115076,11589877760,11748245504,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 28 |
+
Meta-Llama-3-8B,mxq,6_47,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.47}",27.116548538208008,7746902228,8745737216,8763998208,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 29 |
+
Llama-2-7b-hf,mxq,6_69,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.69}",24.80796194076538,5940428680,6707335168,6719275008,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 30 |
+
Meta-Llama-3-8B,mxq,6_61,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.61}",29.123441696166992,7869073556,8867908608,8870952960,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 31 |
+
Meta-Llama-3-8B,mxq,6_07,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.07}",27.529273986816406,7397968020,8428872704,8558477312,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 32 |
+
Llama-2-13b-hf,mxq,6_13,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.13}",46.043402433395386,10378719036,11621481472,11771314176,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 33 |
+
Meta-Llama-3-8B,mxq,6_11,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.11}",27.27446722984314,7432853012,8463757312,8587837440,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 34 |
+
Llama-2-13b-hf,mxq,6_49,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.49}",44.7487268447876,10949668252,12192427008,12350128128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 35 |
+
Llama-2-7b-hf,mxq,6_15,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.15}",25.13091397285461,5503790864,6295318528,6392119296,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 36 |
+
Meta-Llama-3-8B,mxq,6_43,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.43}",27.96074366569519,7712017556,8710852608,8713666560,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 37 |
+
Llama-2-13b-hf,mxq,6_27,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.27}",46.58305263519287,10600778012,11843538944,12006195200,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 38 |
+
Llama-2-13b-hf,mxq,6_35,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.35}",46.339200496673584,10727609372,11970369536,12115247104,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 39 |
+
Llama-2-7b-hf,mxq,6_21,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.21}",24.08426403999329,5552336352,6343864320,6452936704,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 40 |
+
Llama-2-7b-hf,mxq,6_29,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.29}",24.09642219543457,5616991176,6408519680,6501171200,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 41 |
+
Llama-2-13b-hf,mxq,6_45,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.45}",45.24050569534302,10917648412,12160407552,12308185088,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 42 |
+
Meta-Llama-3-8B,mxq,6_69,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.69}",27.3878173828125,7938845204,8937679872,8944353280,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 43 |
+
Llama-2-13b-hf,mxq,6_07,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.07}",47.23086571693421,10283491300,11526254592,11683233792,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 44 |
+
Llama-2-13b-hf,mxq,6_09,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.09}",46.82144212722778,10315095236,11557858304,11706302464,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 45 |
+
Meta-Llama-3-8B,mxq,6_41,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.41}",27.16965675354004,7694571796,8693406720,8701083648,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 46 |
+
Llama-2-13b-hf,mxq,6_69,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.69}",45.28328275680542,11266973552,12471071744,12633243648,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 47 |
+
Llama-2-13b-hf,mxq,6_19,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.19}",46.14694428443909,10473530652,11716292608,11878268928,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 48 |
+
Meta-Llama-3-8B,mxq,6_27,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.27}",30.074626445770264,7572469908,8571304960,8583643136,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 49 |
+
Llama-2-7b-hf,mxq,6_43,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.43}",24.210262775421143,5730297564,6521827328,6633291776,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 50 |
+
Llama-2-7b-hf,mxq,6_41,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.41}",24.192405939102173,5713786396,6505316352,6612320256,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 51 |
+
Llama-2-13b-hf,mxq,6_59,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.59}",45.60878252983093,11152398832,12356501504,12499025920,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 52 |
+
Llama-2-7b-hf,mxq,6_25,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.25}",24.591004371643063,5584583964,6376112128,6478102528,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 53 |
+
Meta-Llama-3-8B,mxq,6_23,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.23}",27.064818620681763,7537580564,8568484864,8694792192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 54 |
+
Llama-2-7b-hf,mxq,6_49,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.49}",24.080952882766724,5778842664,6570373120,6673137664,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 55 |
+
Llama-2-7b-hf,mxq,6_68,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.68}",23.62924098968506,5932679304,6699585536,6702497792,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 56 |
+
Meta-Llama-3-8B,mxq,6_35,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.35}",27.602447509765625,7642241492,8641076224,8657043456,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 57 |
+
Meta-Llama-3-8B,mxq,6_57,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.57}",27.97939896583557,7834184148,8833018880,8837398528,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 58 |
+
Llama-2-13b-hf,mxq,6_41,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.41}",45.59808659553528,10854024732,12096784384,12243173376,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 59 |
+
Llama-2-7b-hf,mxq,6_63,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.63}",24.080676555633545,5892149676,6659055616,6681526272,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 60 |
+
Llama-2-13b-hf,mxq,6_47,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.47}",45.750229835510254,10918064412,12160823296,12308185088,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 61 |
+
Llama-2-13b-hf,mxq,6_68,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.68}",46.11861920356751,11250954352,12455054336,12610174976,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 62 |
+
Llama-2-7b-hf,mxq,6_33,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.33}",24.90421175956726,5648439944,6439968768,6547308544,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 63 |
+
Llama-2-13b-hf,mxq,6_53,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.53}",45.79045748710632,11012875932,12255634432,12415139840,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 64 |
+
Llama-2-7b-hf,mxq,6_59,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.59}",24.248290300369263,5859902076,6626807808,6635388928,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 65 |
+
Llama-2-13b-hf,mxq,6_05,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.05}",46.85809111595154,10251887364,11494650880,11641290752,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 66 |
+
Llama-2-7b-hf,mxq,6_27,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.27}",24.460438013076782,5599521820,6391050240,6482296832,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 67 |
+
Llama-2-7b-hf,mxq,6_31,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.31}",24.840145111083984,5633259976,6424788992,6526337024,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 68 |
+
Meta-Llama-3-8B,mxq,6_39,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.39}",29.38673424720764,7676993044,8675827712,8686403584,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 69 |
+
Llama-2-13b-hf,mxq,6_55,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.55}",45.49933552742005,11076915612,12281018368,12436111360,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 70 |
+
Meta-Llama-3-8B,mxq,6_31,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.31}",27.537675857543945,7607356564,8606191616,8627683328,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 71 |
+
Llama-2-7b-hf,mxq,6_55,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.55}",25.690398454666138,5827359612,6618890240,6723469312,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 72 |
+
Llama-2-13b-hf,mxq,6_57,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.57}",45.246288537979126,11076499612,12280602624,12436111360,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 73 |
+
Meta-Llama-3-8B,mxq,6_63,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.63}",30.27182626724243,7886514708,8885349376,8900313088,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 74 |
+
Meta-Llama-3-8B,mxq,6_53,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.53}",27.4355046749115,7799299284,8798134272,8805941248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 75 |
+
Llama-2-7b-hf,mxq,6_35,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.35}",24.477025747299194,5665110556,6456639488,6564085760,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 76 |
+
Llama-2-13b-hf,mxq,6_17,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.17}",46.79585146903992,10441926812,11684688896,11834228736,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 77 |
+
Llama-2-7b-hf,mxq,6_61,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.61}",24.269190311431885,5875212936,6642118656,6662651904,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 78 |
+
Llama-2-7b-hf,mxq,6_23,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.23}",24.764508724212646,5588736796,6380265472,6480199680,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 79 |
+
Llama-2-13b-hf,mxq,6_51,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.51}",45.85496997833252,10981272092,12224030720,12371099648,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 80 |
+
Llama-2-13b-hf,mxq,6_23,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.23}",46.14421701431274,10537154332,11779915776,11941183488,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 81 |
+
Meta-Llama-3-8B,mxq,6_51,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.51}",28.430763483047485,7779856916,8778691584,8791261184,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 82 |
+
Meta-Llama-3-8B,mxq,6_09,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.09}",27.102176189422607,7415411924,8446316544,8579448832,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 83 |
+
Meta-Llama-3-8B,mxq,6_65,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.65}",27.244441032409668,7903960212,8902795264,8912896000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 84 |
+
Llama-2-7b-hf,mxq,6_19,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.19}",24.62096405029297,5535665752,6327193600,6436159488,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 85 |
+
Llama-2-13b-hf,mxq,6_25,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.25}",45.78133797645569,10569174172,11811935232,11964252160,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 86 |
+
Meta-Llama-3-8B,mxq,6_68,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.68}",27.15545630455017,7930125460,8928960512,8935964672,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 87 |
+
Meta-Llama-3-8B,mxq,6_49,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.49}",27.83776831626892,7764348052,8763183104,8776581120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 88 |
+
Meta-Llama-3-8B,mxq,6_45,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.45}",30.99274730682373,7729190420,8728025088,8745123840,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 89 |
+
Llama-2-7b-hf,mxq,6_07,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.07}",24.60170841217041,5439000944,6230528000,6333399040,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 90 |
+
Llama-2-7b-hf,mxq,6_11,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.11}",24.5038857460022,5471277072,6262804480,6366953472,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 91 |
+
Llama-2-13b-hf,mxq,6_39,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.39}",45.82449650764465,10791233052,12033992704,12178161664,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 92 |
+
Llama-2-7b-hf,mxq,6_17,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.17}",24.447831630706787,5519793776,6311321600,6419382272,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 93 |
+
Llama-2-13b-hf,mxq,6_37,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.37}",46.01576495170593,10854440732,12097200128,12243173376,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 94 |
+
Llama-2-13b-hf,mxq,6_29,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.29}",46.08929300308228,10632381852,11875142656,12027166720,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 95 |
+
Llama-2-7b-hf,mxq,6_05,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.05}",24.80493116378784,5422624880,6214152192,6325010432,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 96 |
+
Meta-Llama-3-8B,mxq,6_59,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.59}",27.27052044868469,7851629716,8850464768,8870952960,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 97 |
+
Meta-Llama-3-8B,mxq,6_55,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.55}",28.366496801376343,7816743124,8815578112,8829009920,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 98 |
+
Meta-Llama-3-8B,mxq,6_29,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.29}",27.177221298217773,7589911060,8588745728,8594128896,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 99 |
+
Llama-2-7b-hf,mxq,6_03,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.03}",24.71203875541687,5406486812,6198013952,6308233216,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 100 |
+
Meta-Llama-3-8B,mxq,6_03,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.03}",27.27998185157776,7363081428,8393986048,8516534272,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 101 |
+
Llama-2-7b-hf,mxq,6_37,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.37}",24.63621401786804,5681379548,6472908800,6568280064,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 102 |
+
Llama-2-13b-hf,mxq,6_33,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.33}",45.687920570373535,10696005532,11938765824,12092178432,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 103 |
+
Llama-2-13b-hf,mxq,6_31,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.31}",45.68218946456909,10663985692,11906746368,12050235392,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
lm-quant-toolkit/data-vis/endeavors/milp/data/stor/mxq/sensi-milp-3/result-sensi-milp-3_stor-20250106081842.csv
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
model,algo,config,config_detail,quant_duration,model_storage_size,load_mem_allot,load_mem_reserved,ppl_mem_allot,ppl_mem_reserved,leaderboard_mem_allot,leaderboard_mem_reserved,ppl_wikitext,ppl_c4,duration_wikitext,duration_c4,duration_leaderboard,ifeval,bbh,mathlevel5,gpqa,musr,mmlupro
|
| 2 |
+
Meta-Llama-3-8B,mxq,4_07,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 4.07}",0,5665689364,5672330752,5683281920,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 3 |
+
Llama-2-7b-hf,mxq,4_21,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 4.21}",0,3933259648,3983333888,4246732800,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 4 |
+
Llama-2-13b-hf,mxq,4_13,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 4.13}",0,7206854268,7239930368,7493124096,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 5 |
+
Llama-2-13b-hf,mxq,3_83,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 3.83}",0,6848708180,6895057408,7161774080,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 6 |
+
Llama-2-7b-hf,mxq,3_15,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 3.15}",0,3273463360,3347083776,3370123264,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 7 |
+
Llama-2-7b-hf,mxq,6_89,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.89}",0,6102748136,6179525120,6220152832,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 8 |
+
Llama-2-13b-hf,mxq,5_02,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 5.02}",0,8618365528,8669159936,8982102016,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 9 |
+
Meta-Llama-3-8B,mxq,3_51,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 3.51}",0,5299605384,5307035136,5402263552,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 10 |
+
Llama-2-13b-hf,mxq,3_07,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 3.07}",0,5899579716,5967231488,6299844608,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 11 |
+
Llama-2-13b-hf,mxq,3_11,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 3.11}",0,5978639192,6049927680,6369050624,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 12 |
+
Llama-2-13b-hf,mxq,3_25,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 3.25}",0,6158859908,6226196992,6534725632,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 13 |
+
Llama-2-13b-hf,mxq,3_13,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 3.13}",0,6019657796,6092518912,6404702208,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 14 |
+
Llama-2-13b-hf,mxq,3_15,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 3.15}",0,6039909380,6111377920,6425673728,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 15 |
+
Meta-Llama-3-8B,mxq,5_72,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 5.72}",0,7092639172,7097309696,7132413952,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 16 |
+
Llama-2-7b-hf,mxq,4_07,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 4.07}",0,3831531200,3885261312,4125097984,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 17 |
+
Meta-Llama-3-8B,mxq,4_51,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 4.51}",0,6036962348,6036654592,6052380672,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 18 |
+
Meta-Llama-3-8B,mxq,4_11,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 4.11}",0,5692629876,5694552576,5704253440,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 19 |
+
Meta-Llama-3-8B,mxq,3_15,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 3.15}",0,5063869648,5076544000,5205131264,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 20 |
+
Llama-2-7b-hf,mxq,3_51,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 3.51}",0,3491498560,3550765568,3755999232,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 21 |
+
Llama-2-7b-hf,mxq,3_19,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 3.19}",0,3299624512,3373048320,3416260608,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 22 |
+
Llama-2-13b-hf,mxq,3_95,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 3.95}",0,6991495112,7033371136,7291797504,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 23 |
+
Llama-2-7b-hf,mxq,3_83,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 3.83}",0,3685844480,3747897856,3898605568,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 24 |
+
Llama-2-7b-hf,mxq,3_11,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 3.11}",0,3241743936,3314315776,3338665984,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 25 |
+
Llama-2-13b-hf,mxq,4_21,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 4.21}",0,7333817276,7412638208,7511998464,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 26 |
+
Meta-Llama-3-8B,mxq,3_25,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 3.25}",0,5129737224,5141100032,5251268608,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 27 |
+
Llama-2-13b-hf,mxq,4_25,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 4.25}",0,7397215612,7502082560,7526678528,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 28 |
+
Llama-2-7b-hf,mxq,5_72,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 5.72}",0,5155431172,5228540416,5335154688,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 29 |
+
Meta-Llama-3-8B,mxq,3_95,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 3.95}",0,5587639348,5594804736,5616173056,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 30 |
+
Llama-2-13b-hf,mxq,6_89,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.89}",0,11583711144,11737826816,11865686016,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 31 |
+
Meta-Llama-3-8B,mxq,3_19,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 3.19}",0,5090810588,5102697984,5221908480,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 32 |
+
Meta-Llama-3-8B,mxq,3_07,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 3.07}",0,4986272796,4996850176,5135925248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 33 |
+
Llama-2-13b-hf,mxq,4_11,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 4.11}",0,7185160892,7217058304,7476346880,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 34 |
+
Llama-2-13b-hf,mxq,4_17,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 4.17}",0,7270086204,7315296768,7528775680,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 35 |
+
Meta-Llama-3-8B,mxq,4_17,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 4.17}",0,5740054792,5740797440,5760876544,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 36 |
+
Llama-2-7b-hf,mxq,4_51,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 4.51}",0,4176189184,4230466048,4502585344,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 37 |
+
Llama-2-7b-hf,mxq,3_65,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 3.65}",0,3576531264,3634651648,3835691008,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 38 |
+
Meta-Llama-3-8B,mxq,4_21,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 4.21}",0,5775065652,5775808000,5796528128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 39 |
+
Llama-2-7b-hf,mxq,3_95,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 3.95}",0,3758688128,3813958144,4041211904,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 40 |
+
Llama-2-7b-hf,mxq,4_25,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 4.25}",0,3965707584,4015784448,4265607168,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 41 |
+
Meta-Llama-3-8B,mxq,6_89,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 6.89}",0,8113314132,8119294464,8145338368,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 42 |
+
Llama-2-13b-hf,mxq,4_07,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 4.07}",0,7134282224,7168244224,7428112384,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 43 |
+
Llama-2-7b-hf,mxq,3_07,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 3.07}",0,3201336832,3267125760,3323985920,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 44 |
+
Meta-Llama-3-8B,mxq,3_65,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 3.65}",0,5391027996,5401471488,5465178112,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 45 |
+
Llama-2-7b-hf,mxq,5_02,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 5.02}",0,4589033720,4646408704,4737466368,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 46 |
+
Llama-2-7b-hf,mxq,3_25,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 3.25}",0,3334215232,3406852608,3449815040,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 47 |
+
Llama-2-13b-hf,mxq,4_51,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 4.51}",0,7809426496,7917962752,7925137408,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 48 |
+
Meta-Llama-3-8B,mxq,4_25,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 4.25}",0,5810142816,5810885120,5830082560,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 49 |
+
Meta-Llama-3-8B,mxq,3_11,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 3.11}",0,5029859376,5040043520,5184159744,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 50 |
+
Llama-2-13b-hf,mxq,3_65,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 3.65}",0,6634650660,6678592000,6983516160,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 51 |
+
Meta-Llama-3-8B,mxq,3_13,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 3.13}",0,5050498256,5063565824,5196742656,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 52 |
+
Llama-2-13b-hf,mxq,3_51,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 3.51}",0,6468025220,6523664896,6819938304,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 53 |
+
Meta-Llama-3-8B,mxq,3_83,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 3.83}",0,5509390868,5522323968,5561647104,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 54 |
+
Meta-Llama-3-8B,mxq,3_87,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 3.87}",0,5535143348,5540343296,5586812928,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 55 |
+
Llama-2-7b-hf,mxq,3_87,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 3.87}",0,3710126080,3766247936,3978297344,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 56 |
+
Llama-2-7b-hf,mxq,3_13,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 3.13}",0,3261371904,3336073728,3344957440,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 57 |
+
Llama-2-13b-hf,mxq,3_87,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 3.87}",0,6896385628,6942046720,7203717120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 58 |
+
Meta-Llama-3-8B,mxq,5_02,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 5.02}",0,6481917868,6496551424,6532628480,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 59 |
+
Meta-Llama-3-8B,mxq,4_13,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 4.13}",0,5705376564,5705071104,5706350592,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 60 |
+
Llama-2-13b-hf,mxq,3_19,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 3.19}",0,6089553072,6158957056,6471811072,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
| 61 |
+
Llama-2-13b-hf,mxq,5_72,"{'weight_quant_params': {'nbits': 4, 'channel_wise': True, 'group_size': 64, 'optimize': True, 'round_zero': True, 'axis': 0, 'view_as_float': False}, 'scale_quant_params': {'nbits': 8, 'channel_wise': True, 'group_size': 128, 'optimize': False}, 'zero_quant_params': {'nbits': 8, 'channel_wise': False, 'group_size': None, 'optimize': False}, 'offload_meta': False, 'mixed': True, 'budget': 5.72}",0,9728326428,9900586496,9997123584,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
lm-quant-toolkit/data-vis/functions/allocation.R
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
calc_mem_inc <- function(df_cfgs) {
|
| 2 |
+
df_cfg_mem <- df_cfgs |>
|
| 3 |
+
dplyr::mutate(
|
| 4 |
+
base_cfg = sapply(bit_budget, budget_to_cfg),
|
| 5 |
+
cfg = paste0("b", b1, "g", g1),
|
| 6 |
+
bpp = sapply(cfg, calc_bpp),
|
| 7 |
+
base_bpp = sapply(base_cfg, calc_bpp),
|
| 8 |
+
mem_orig = param_cnt * base_bpp,
|
| 9 |
+
mem_new = param_cnt * bpp
|
| 10 |
+
) |>
|
| 11 |
+
select(-c("b1", "g1", "b2", "g2", "base_bpp", "base_cfg", "memmb")) |>
|
| 12 |
+
dplyr::mutate(
|
| 13 |
+
cfg = factor(
|
| 14 |
+
cfg,
|
| 15 |
+
levels = c(
|
| 16 |
+
"b2g128", "b2g64", "b2g32",
|
| 17 |
+
"b3g128", "b3g64", "b3g32",
|
| 18 |
+
"b4g128", "b4g64", "b4g32",
|
| 19 |
+
"b8g128", "b8g64", "b8g32"
|
| 20 |
+
)
|
| 21 |
+
)
|
| 22 |
+
) |>
|
| 23 |
+
group_by(attempt, model, bit_budget) |>
|
| 24 |
+
summarise(
|
| 25 |
+
mem_orig = sum(mem_orig),
|
| 26 |
+
mem_new = sum(mem_new)
|
| 27 |
+
) |>
|
| 28 |
+
mutate(
|
| 29 |
+
mem_orig = mem_orig / 8 / 1024^2,
|
| 30 |
+
mem_new = mem_new / 8 / 1024^2,
|
| 31 |
+
increment = round(100 * (mem_new - mem_orig) / mem_orig, digits = 2)
|
| 32 |
+
)
|
| 33 |
+
return(df_cfg_mem)
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
load_ppl_mem_inc <- function(allot_cfg_csv_fp, combined_csv_fp) {
|
| 37 |
+
df_cfgs <- read_csv(allot_cfg_csv_fp) |>
|
| 38 |
+
mutate(
|
| 39 |
+
model = factor(
|
| 40 |
+
model,
|
| 41 |
+
levels = c("Llama-2-7b-hf", "Llama-2-13b-hf", "Meta-Llama-3-8B"),
|
| 42 |
+
labels = c("Llama-2-7B", "Llama-2-13B", "Llama-3-8B")
|
| 43 |
+
)
|
| 44 |
+
)
|
| 45 |
+
|
| 46 |
+
df_w_base <- read_csv(combined_csv_fp) |>
|
| 47 |
+
mutate(
|
| 48 |
+
model = factor(
|
| 49 |
+
model,
|
| 50 |
+
levels = c("Llama-2-7b-hf", "Llama-2-13b-hf", "Meta-Llama-3-8B"),
|
| 51 |
+
labels = c("Llama-2-7B", "Llama-2-13B", "Llama-3-8B")
|
| 52 |
+
)
|
| 53 |
+
)
|
| 54 |
+
|
| 55 |
+
df_hqq <- df_w_base |>
|
| 56 |
+
filter(
|
| 57 |
+
algo == "hqq"
|
| 58 |
+
)
|
| 59 |
+
|
| 60 |
+
df_cfg_mem <- calc_mem_inc(df_cfgs)
|
| 61 |
+
|
| 62 |
+
df_ppl_mem_inc <- df_cfg_mem |>
|
| 63 |
+
left_join(
|
| 64 |
+
df_hqq,
|
| 65 |
+
suffix = c("", "_h"),
|
| 66 |
+
by = join_by(model, bit_budget == bpp)
|
| 67 |
+
) |>
|
| 68 |
+
left_join(
|
| 69 |
+
df_w_base,
|
| 70 |
+
suffix = c("_hqq", ""),
|
| 71 |
+
by = join_by(model, attempt, bit_budget == bpp)
|
| 72 |
+
) |>
|
| 73 |
+
mutate(
|
| 74 |
+
ppl_wikitext_decr = round(
|
| 75 |
+
100 * (ppl_wikitext_hqq - ppl_wikitext) / ppl_wikitext_hqq,
|
| 76 |
+
digits = 2
|
| 77 |
+
),
|
| 78 |
+
ppl_c4_decr = round(
|
| 79 |
+
100 * (ppl_c4_hqq - ppl_c4) / ppl_c4_hqq,
|
| 80 |
+
digits = 2
|
| 81 |
+
),
|
| 82 |
+
mem_incr = round(
|
| 83 |
+
100 * (load_mem_allot - load_mem_allot_hqq) / load_mem_allot_hqq,
|
| 84 |
+
digits = 2
|
| 85 |
+
)
|
| 86 |
+
) |>
|
| 87 |
+
rename(bpp = bit_budget) |>
|
| 88 |
+
select(
|
| 89 |
+
c(
|
| 90 |
+
"model",
|
| 91 |
+
"attempt",
|
| 92 |
+
"bpp",
|
| 93 |
+
"increment",
|
| 94 |
+
"ppl_wikitext_decr",
|
| 95 |
+
"ppl_c4_decr",
|
| 96 |
+
"mem_incr",
|
| 97 |
+
"ppl_wikitext",
|
| 98 |
+
"ppl_c4",
|
| 99 |
+
"ppl_wikitext_hqq",
|
| 100 |
+
"ppl_c4_hqq",
|
| 101 |
+
"mem_orig",
|
| 102 |
+
"mem_new",
|
| 103 |
+
"load_mem_allot",
|
| 104 |
+
"load_mem_allot_hqq"
|
| 105 |
+
)
|
| 106 |
+
)
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
df_ppl_mem_inc <- df_ppl_mem_inc |>
|
| 110 |
+
filter(
|
| 111 |
+
!is.na(attempt) & attempt != "mxq1"
|
| 112 |
+
) |>
|
| 113 |
+
separate_wider_regex(
|
| 114 |
+
attempt,
|
| 115 |
+
c(method = "\\w+-\\w+", "-", stop_topm = "\\d-\\d")
|
| 116 |
+
) |>
|
| 117 |
+
mutate(
|
| 118 |
+
ablation = ifelse(grepl("-abl", method), TRUE, FALSE),
|
| 119 |
+
method1 = ifelse(grepl("sensi-", method), "SensiBoost", "KurtBoost")
|
| 120 |
+
) |>
|
| 121 |
+
mutate(method = method1) |>
|
| 122 |
+
select(!c("method1")) |>
|
| 123 |
+
pivot_longer(
|
| 124 |
+
cols = c("ppl_wikitext", "ppl_c4"),
|
| 125 |
+
names_to = c(".value", "dataset"),
|
| 126 |
+
names_sep = "_"
|
| 127 |
+
) |>
|
| 128 |
+
mutate(
|
| 129 |
+
dataset = factor(
|
| 130 |
+
dataset,
|
| 131 |
+
levels = c("wikitext", "c4"),
|
| 132 |
+
labels = c("WikiText2", "C4")
|
| 133 |
+
)
|
| 134 |
+
)
|
| 135 |
+
list(df_ppl_mem_inc, df_hqq)
|
| 136 |
+
}
|
lm-quant-toolkit/docs/make.bat
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@ECHO OFF
|
| 2 |
+
|
| 3 |
+
pushd %~dp0
|
| 4 |
+
|
| 5 |
+
REM Command file for Sphinx documentation
|
| 6 |
+
|
| 7 |
+
if "%SPHINXBUILD%" == "" (
|
| 8 |
+
set SPHINXBUILD=sphinx-build
|
| 9 |
+
)
|
| 10 |
+
set SOURCEDIR=source
|
| 11 |
+
set BUILDDIR=build
|
| 12 |
+
|
| 13 |
+
%SPHINXBUILD% >NUL 2>NUL
|
| 14 |
+
if errorlevel 9009 (
|
| 15 |
+
echo.
|
| 16 |
+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
| 17 |
+
echo.installed, then set the SPHINXBUILD environment variable to point
|
| 18 |
+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
| 19 |
+
echo.may add the Sphinx directory to PATH.
|
| 20 |
+
echo.
|
| 21 |
+
echo.If you don't have Sphinx installed, grab it from
|
| 22 |
+
echo.https://www.sphinx-doc.org/
|
| 23 |
+
exit /b 1
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
+
if "%1" == "" goto help
|
| 27 |
+
|
| 28 |
+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
| 29 |
+
goto end
|
| 30 |
+
|
| 31 |
+
:help
|
| 32 |
+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
| 33 |
+
|
| 34 |
+
:end
|
| 35 |
+
popd
|
lm-quant-toolkit/docs/source/_static/.gitkeep
ADDED
|
File without changes
|
lm-quant-toolkit/docs/source/modules/index.rst
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
References
|
| 2 |
+
==========
|
| 3 |
+
|
| 4 |
+
.. toctree::
|
| 5 |
+
:maxdepth: 2
|
| 6 |
+
|
| 7 |
+
.. automodule:: lm_quant_toolkit.sample
|
| 8 |
+
:members:
|
| 9 |
+
:show-inheritance:
|
| 10 |
+
:inherited-members:
|
| 11 |
+
|
| 12 |
+
.. ##### ToDo: Rewrite this automodule section. ####
|
lm-quant-toolkit/kurtosis_means/kurtosis_means-Llama-2-13b-hf.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
36.20831008807138,
|
| 3 |
+
7.823519104426895,
|
| 4 |
+
4.57285454452298,
|
| 5 |
+
11.66139070734061,
|
| 6 |
+
3.7957004334690256,
|
| 7 |
+
3.9195918369714966,
|
| 8 |
+
3.7107561965973104,
|
| 9 |
+
3.9457577834238253,
|
| 10 |
+
3.992051708248406,
|
| 11 |
+
3.884308367454504,
|
| 12 |
+
3.804151175413534,
|
| 13 |
+
3.642568993991929,
|
| 14 |
+
3.6768444199923187,
|
| 15 |
+
3.833314889549608,
|
| 16 |
+
3.7087770119583694,
|
| 17 |
+
3.5689030481157706,
|
| 18 |
+
3.895674855443858,
|
| 19 |
+
3.6698099334992196,
|
| 20 |
+
3.475518509415634,
|
| 21 |
+
3.52130188306068,
|
| 22 |
+
3.544863264474582,
|
| 23 |
+
3.5642771430648845,
|
| 24 |
+
3.3897143938516257,
|
| 25 |
+
3.451800717017767,
|
| 26 |
+
4.093931859378596,
|
| 27 |
+
3.3366966668352025,
|
| 28 |
+
3.549480595278694,
|
| 29 |
+
3.269760837204928,
|
| 30 |
+
4.8084622557618575,
|
| 31 |
+
3.2941855695384916,
|
| 32 |
+
3.305529210846003,
|
| 33 |
+
3.2812932089351454,
|
| 34 |
+
3.3166191443521007,
|
| 35 |
+
3.4042591456527385,
|
| 36 |
+
3.3108520134080686,
|
| 37 |
+
3.3126526305563324,
|
| 38 |
+
3.3527077393558455,
|
| 39 |
+
3.8512639493286045,
|
| 40 |
+
4.115996710505451,
|
| 41 |
+
13.436707735959104
|
| 42 |
+
]
|
lm-quant-toolkit/kurtosis_means/kurtosis_means-Llama-2-7b-hf.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
23.750941662715515,
|
| 3 |
+
9.754758646688346,
|
| 4 |
+
4.489708103070161,
|
| 5 |
+
4.307899799803371,
|
| 6 |
+
4.134903364110355,
|
| 7 |
+
3.8109315390173633,
|
| 8 |
+
4.267233350637998,
|
| 9 |
+
3.984766546770987,
|
| 10 |
+
4.0776846088548675,
|
| 11 |
+
3.8008830583153093,
|
| 12 |
+
3.7239733347674395,
|
| 13 |
+
4.209487872285522,
|
| 14 |
+
3.7220275775474825,
|
| 15 |
+
3.7661798202397536,
|
| 16 |
+
3.6907543450828304,
|
| 17 |
+
3.643265274418343,
|
| 18 |
+
3.730611370848792,
|
| 19 |
+
3.6938704535205438,
|
| 20 |
+
3.630159190984952,
|
| 21 |
+
3.6504818290692542,
|
| 22 |
+
4.032416548658124,
|
| 23 |
+
3.6864103494799423,
|
| 24 |
+
4.801484364422211,
|
| 25 |
+
3.613649856729061,
|
| 26 |
+
3.9682110582135897,
|
| 27 |
+
3.4403205415275635,
|
| 28 |
+
3.8085186082283937,
|
| 29 |
+
3.497261527630669,
|
| 30 |
+
3.6253774767814515,
|
| 31 |
+
3.9293211271702693,
|
| 32 |
+
5.672729160931163,
|
| 33 |
+
9.501241868007666
|
| 34 |
+
]
|
lm-quant-toolkit/kurtosis_means/kurtosis_means-Llama-3.1-70B-Instruct.json
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
53063.45402740366,
|
| 3 |
+
3342.181179449654,
|
| 4 |
+
2081.7632482564863,
|
| 5 |
+
11753.336138495708,
|
| 6 |
+
414.03846697392146,
|
| 7 |
+
5641.056010780408,
|
| 8 |
+
7.823610826713199,
|
| 9 |
+
4.339892054485288,
|
| 10 |
+
167.14031108165233,
|
| 11 |
+
12061.745698655564,
|
| 12 |
+
4.098053743442761,
|
| 13 |
+
42.68699696996061,
|
| 14 |
+
3.9637011105775657,
|
| 15 |
+
3.6544748472594017,
|
| 16 |
+
3.730024369940583,
|
| 17 |
+
3.6362512998670877,
|
| 18 |
+
3.537857942914126,
|
| 19 |
+
3.495559911389885,
|
| 20 |
+
3.5644461850399654,
|
| 21 |
+
3.54358306601304,
|
| 22 |
+
3.4216888140662647,
|
| 23 |
+
3.550985607994683,
|
| 24 |
+
3.505417436893508,
|
| 25 |
+
3.503980271437599,
|
| 26 |
+
3.9142086979482618,
|
| 27 |
+
3.7416219450373,
|
| 28 |
+
3.6778339412387444,
|
| 29 |
+
3.7443712053994003,
|
| 30 |
+
4.307864217071052,
|
| 31 |
+
4.176023161912435,
|
| 32 |
+
3.876727596504625,
|
| 33 |
+
3.8427027733645396,
|
| 34 |
+
4.062410494927533,
|
| 35 |
+
270978.05669001065,
|
| 36 |
+
4.402019468092642,
|
| 37 |
+
5.178935657740299,
|
| 38 |
+
3.9653492038684095,
|
| 39 |
+
4.324238802603547,
|
| 40 |
+
3.852622033293745,
|
| 41 |
+
5.526610586431951,
|
| 42 |
+
3.7952653016514724,
|
| 43 |
+
3.7373541036636193,
|
| 44 |
+
3.9691939392245823,
|
| 45 |
+
3.765759261254527,
|
| 46 |
+
3.567262761745046,
|
| 47 |
+
3.9047379938498303,
|
| 48 |
+
7.544739330581569,
|
| 49 |
+
4.036774840268133,
|
| 50 |
+
3.8654878047057104,
|
| 51 |
+
4.091803162244596,
|
| 52 |
+
4.456933452707032,
|
| 53 |
+
3.8976420307028765,
|
| 54 |
+
3.8403215416667087,
|
| 55 |
+
4.054892705638102,
|
| 56 |
+
4.72571710575852,
|
| 57 |
+
16.639336011805874,
|
| 58 |
+
3.6622431712284063,
|
| 59 |
+
3.6773246412604834,
|
| 60 |
+
4.32098139305053,
|
| 61 |
+
4.553058984807589,
|
| 62 |
+
3.7650378376021236,
|
| 63 |
+
4.276013031279869,
|
| 64 |
+
8.765210679699504,
|
| 65 |
+
4.767512685349912,
|
| 66 |
+
3.8136335090112423,
|
| 67 |
+
15.95616411587807,
|
| 68 |
+
4.458259860171344,
|
| 69 |
+
3.623488714534086,
|
| 70 |
+
3.698932380399143,
|
| 71 |
+
3.673273237411614,
|
| 72 |
+
4.015708914454165,
|
| 73 |
+
3.521997103013156,
|
| 74 |
+
5.951699512062454,
|
| 75 |
+
4.372105197612065,
|
| 76 |
+
4.439119247182768,
|
| 77 |
+
3.7763543828426913,
|
| 78 |
+
4.0997835563664955,
|
| 79 |
+
3.668155799821158,
|
| 80 |
+
3.7609906029885223,
|
| 81 |
+
4.410020397947809
|
| 82 |
+
]
|
lm-quant-toolkit/kurtosis_means/kurtosis_means-Llama-3.2-3B-Instruct.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
6.380387403127143,
|
| 3 |
+
4.996935489008055,
|
| 4 |
+
4.217842430472643,
|
| 5 |
+
3.635364216840857,
|
| 6 |
+
4.0020581014387036,
|
| 7 |
+
3.9586294647521334,
|
| 8 |
+
3.82805897926665,
|
| 9 |
+
3.781738763203021,
|
| 10 |
+
4.210585283339773,
|
| 11 |
+
4.28716368597334,
|
| 12 |
+
4.053615110952808,
|
| 13 |
+
4.008039481804297,
|
| 14 |
+
4.305022038962752,
|
| 15 |
+
4.2869863026189945,
|
| 16 |
+
4.349716585523822,
|
| 17 |
+
4.008920711034018,
|
| 18 |
+
3.769478277224827,
|
| 19 |
+
3.7233977015590023,
|
| 20 |
+
3.800766666196257,
|
| 21 |
+
3.8934628119079315,
|
| 22 |
+
3.5704264615536507,
|
| 23 |
+
3.6858217569686036,
|
| 24 |
+
3.751760085811232,
|
| 25 |
+
3.735995299421045,
|
| 26 |
+
3.9304267708590643,
|
| 27 |
+
3.8822650546247424,
|
| 28 |
+
4.531867260409812,
|
| 29 |
+
6.482571087273307
|
| 30 |
+
]
|
lm-quant-toolkit/kurtosis_means/kurtosis_means-Mistral-7B-Instruct-v0.3.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
16.460504305815885,
|
| 3 |
+
7.187038549640976,
|
| 4 |
+
4.107636651127377,
|
| 5 |
+
3.765479305474974,
|
| 6 |
+
4.059220089989684,
|
| 7 |
+
3.7023934640639036,
|
| 8 |
+
3.7942661449479074,
|
| 9 |
+
4.060693776298099,
|
| 10 |
+
3.855991268067664,
|
| 11 |
+
3.9196836774136807,
|
| 12 |
+
3.8445266482849503,
|
| 13 |
+
4.188764852386089,
|
| 14 |
+
4.3455285253391205,
|
| 15 |
+
3.78337562630337,
|
| 16 |
+
4.405495403803272,
|
| 17 |
+
4.318086055210194,
|
| 18 |
+
4.159880121566297,
|
| 19 |
+
3.993238131110016,
|
| 20 |
+
4.197957790194299,
|
| 21 |
+
4.1224334534552405,
|
| 22 |
+
3.810343543584633,
|
| 23 |
+
3.688142874985527,
|
| 24 |
+
3.6082568373491624,
|
| 25 |
+
3.5884034726567253,
|
| 26 |
+
3.5531233669963775,
|
| 27 |
+
3.5514360416969324,
|
| 28 |
+
3.5641116873458443,
|
| 29 |
+
3.6026778644408766,
|
| 30 |
+
3.8245389366294327,
|
| 31 |
+
3.952542353828331,
|
| 32 |
+
4.533290193525216,
|
| 33 |
+
12.99801915115412
|
| 34 |
+
]
|
lm-quant-toolkit/kurtosis_means/kurtosis_means-Qwen3-4B.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
3.941214274185061,
|
| 3 |
+
5.078223543750821,
|
| 4 |
+
5.5040014729504305,
|
| 5 |
+
4.4187494055443235,
|
| 6 |
+
4.131540173137397,
|
| 7 |
+
4.058857589765167,
|
| 8 |
+
4.556204159018312,
|
| 9 |
+
3.9008624797168525,
|
| 10 |
+
3.591748203179964,
|
| 11 |
+
4.520930576882916,
|
| 12 |
+
3.8404214322353254,
|
| 13 |
+
4.061617246411165,
|
| 14 |
+
4.496651499010889,
|
| 15 |
+
4.29267170119633,
|
| 16 |
+
4.031222914429401,
|
| 17 |
+
4.302503241213555,
|
| 18 |
+
4.923697631978792,
|
| 19 |
+
4.372245394381424,
|
| 20 |
+
4.244957300952266,
|
| 21 |
+
5.373340345659618,
|
| 22 |
+
4.500337386572579,
|
| 23 |
+
4.434050753617325,
|
| 24 |
+
5.773264024526944,
|
| 25 |
+
4.531866545464498,
|
| 26 |
+
4.631359530373318,
|
| 27 |
+
3.7935204081277254,
|
| 28 |
+
3.831062031443565,
|
| 29 |
+
3.8237048767592374,
|
| 30 |
+
3.9616608786753025,
|
| 31 |
+
4.082029214319279,
|
| 32 |
+
3.942790578059714,
|
| 33 |
+
3.9531150896079468,
|
| 34 |
+
4.080577440176306,
|
| 35 |
+
4.217049101774255,
|
| 36 |
+
4.521569765295479,
|
| 37 |
+
4.512058280020761
|
| 38 |
+
]
|
lm-quant-toolkit/kurtosis_means/kurtosis_means-Qwen3-8B.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
3.9610171447883085,
|
| 3 |
+
7.0953849648059855,
|
| 4 |
+
8.466322603075763,
|
| 5 |
+
5.091216045189526,
|
| 6 |
+
4.163305044535881,
|
| 7 |
+
4.0988320935460605,
|
| 8 |
+
4.534896277528611,
|
| 9 |
+
3.7783699434660756,
|
| 10 |
+
3.560819647489739,
|
| 11 |
+
4.307591821549381,
|
| 12 |
+
3.8605660480377435,
|
| 13 |
+
3.945428185859018,
|
| 14 |
+
4.350765471144204,
|
| 15 |
+
4.140039895466956,
|
| 16 |
+
3.9419497869536184,
|
| 17 |
+
4.097748298625853,
|
| 18 |
+
4.561058217856199,
|
| 19 |
+
4.186195807931895,
|
| 20 |
+
4.104755902482217,
|
| 21 |
+
5.184580406696518,
|
| 22 |
+
4.191647357330313,
|
| 23 |
+
4.224571060698712,
|
| 24 |
+
5.044024609743002,
|
| 25 |
+
4.200849959936389,
|
| 26 |
+
4.25483661629127,
|
| 27 |
+
3.6583809151866906,
|
| 28 |
+
3.662573331367063,
|
| 29 |
+
3.6654567768688326,
|
| 30 |
+
3.8012102754278927,
|
| 31 |
+
3.7908402547435074,
|
| 32 |
+
3.7708275351378515,
|
| 33 |
+
3.6929654079628165,
|
| 34 |
+
3.831359282716021,
|
| 35 |
+
3.8790146063635054,
|
| 36 |
+
4.414087869961951,
|
| 37 |
+
5.409119229712714
|
| 38 |
+
]
|
lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/.coveragerc
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[run]
|
| 2 |
+
omit =
|
| 3 |
+
src/llm_quant_eval/tests/*
|
lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/.editorconfig
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# EditorConfig: http://editorconfig.org/
|
| 2 |
+
|
| 3 |
+
root = true
|
| 4 |
+
|
| 5 |
+
[*]
|
| 6 |
+
charset = utf-8
|
| 7 |
+
trim_trailing_whitespace = true
|
| 8 |
+
insert_final_newline = true
|
| 9 |
+
indent_style = space
|
| 10 |
+
|
| 11 |
+
[*.py]
|
| 12 |
+
max_line_length = 80
|
| 13 |
+
indent_style = space
|
| 14 |
+
indent_size = 4
|
| 15 |
+
|
| 16 |
+
[*.md]
|
| 17 |
+
max_line_length = 80
|
| 18 |
+
|
| 19 |
+
[*.json]
|
| 20 |
+
indent_size = 2
|
| 21 |
+
|
| 22 |
+
[*.py]
|
| 23 |
+
indent_size = 4
|
| 24 |
+
|
| 25 |
+
[*.sh]
|
| 26 |
+
indent_size = 4
|
| 27 |
+
|
| 28 |
+
[*.{yml,yaml}]
|
| 29 |
+
indent_size = 2
|
lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/.github/workflows/ci.yml
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: CI
|
| 2 |
+
run-name: Run unit tests, code checker, build docs.
|
| 3 |
+
on: [push]
|
| 4 |
+
jobs:
|
| 5 |
+
build:
|
| 6 |
+
runs-on: ubuntu-latest
|
| 7 |
+
strategy:
|
| 8 |
+
matrix:
|
| 9 |
+
python-version: ['3.11']
|
| 10 |
+
steps:
|
| 11 |
+
- uses: actions/checkout@v3
|
| 12 |
+
- uses: actions/setup-python@v4.5.0
|
| 13 |
+
with:
|
| 14 |
+
python-version: ${{ matrix.python-version }}
|
| 15 |
+
- name: Install dependencies
|
| 16 |
+
run: |
|
| 17 |
+
python -m pip install --upgrade pip
|
| 18 |
+
python -m pip install --use-pep517 pytest-cov pytest-random pytest-remove-stale-bytecode flake8 pycodestyle pydocstyle Sphinx sphinx_rtd_theme
|
| 19 |
+
python -m pip install .
|
| 20 |
+
- name: Run unittest
|
| 21 |
+
run: pytest -v --random --cov=src/llm_quant_eval --cov-report=term
|
| 22 |
+
- name: flake8
|
| 23 |
+
run: flake8 src
|
| 24 |
+
- name: pycodestyle
|
| 25 |
+
run: pycodestyle -v --first src
|
| 26 |
+
- name: pydocstyle
|
| 27 |
+
run: pydocstyle -v --match='(?!test_|version)(.*)?\.py' src
|
| 28 |
+
- name: build docs
|
| 29 |
+
run: sphinx-build -M html docs/source doc/build
|
lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/.gitignore
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.DS_Store
|
| 2 |
+
credential.ini
|
| 3 |
+
*-debug.py
|
| 4 |
+
*.log
|
| 5 |
+
*.bak
|
| 6 |
+
*.swo
|
| 7 |
+
*.swp
|
| 8 |
+
*.egg
|
| 9 |
+
*.egg/
|
| 10 |
+
*.egg-info/
|
| 11 |
+
*.pyc
|
| 12 |
+
.tox/
|
| 13 |
+
_build/
|
| 14 |
+
build
|
| 15 |
+
dist/
|
| 16 |
+
.coverage
|
| 17 |
+
.cache
|
| 18 |
+
htmlcov
|
| 19 |
+
*requirement*.txt
|
| 20 |
+
*.pickle
|
| 21 |
+
*.parquet
|
| 22 |
+
.*venv/
|
| 23 |
+
# R related files
|
| 24 |
+
.Rproj.user
|
| 25 |
+
.Rhistory
|
| 26 |
+
Rplots.pdf
|
lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/LICENSE
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Copyright 2024 Justin Zhang
|
| 2 |
+
|
| 3 |
+
Permission is hereby granted, free of charge, to any person obtaining a
|
| 4 |
+
copy of this software and associated documentation files (the
|
| 5 |
+
“Software”), to deal in the Software without restriction, including
|
| 6 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
| 7 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
| 8 |
+
permit persons to whom the Software is furnished to do so, subject to
|
| 9 |
+
the following conditions:
|
| 10 |
+
|
| 11 |
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
| 12 |
+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 13 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
| 14 |
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
| 15 |
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
| 16 |
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
| 17 |
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/MANIFEST.in
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
include MANIFEST.in
|
| 2 |
+
include README.rst
|
| 3 |
+
include LICENSE
|
| 4 |
+
recursive-include docs *.rst conf.py Makefile
|
| 5 |
+
recursive-include src *.py
|
lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/README.md
ADDED
|
@@ -0,0 +1,431 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Overview
|
| 2 |
+
|
| 3 |
+
The **lm-quant-toolkit** is a suite of tools to facilitate large neural network
|
| 4 |
+
quantization research. It includes a quantization harness tool to drive
|
| 5 |
+
quantization experiments on large language models and vision models, to collect
|
| 6 |
+
and summarize experiment data for further analysis. It also includes tool to
|
| 7 |
+
prepare experiment meta data and visualization tools to interpret experiment
|
| 8 |
+
results. Specifically, lm-quant-toolkit consists of:
|
| 9 |
+
|
| 10 |
+
- LLM quantization harness tool
|
| 11 |
+
- ViT quantization harness tool
|
| 12 |
+
- FNorm Metadata Preparation Tool
|
| 13 |
+
- Kurtosis Metrics Measuring Tool
|
| 14 |
+
- Sensitivity Score Measuring Tool
|
| 15 |
+
- Calibration Dataset Generation Tool
|
| 16 |
+
- Visualization Tools
|
| 17 |
+
|
| 18 |
+
## Citation
|
| 19 |
+
|
| 20 |
+
~~~~
|
| 21 |
+
@inproceedings{zhang2025mxq,
|
| 22 |
+
title = {A Mixed Quantization Approach for Data-Free Quantization of LLMs},
|
| 23 |
+
author = {Feng Zhang and Yanbin Liu and Weihua Li and Xiaodan Wang and Quan Bai},
|
| 24 |
+
year = {2025},
|
| 25 |
+
url = {https://openreview.net/forum?id=M3Y74vmsMcY},
|
| 26 |
+
}
|
| 27 |
+
~~~~
|
| 28 |
+
|
| 29 |
+
## Setup test harness
|
| 30 |
+
|
| 31 |
+
Most tools are implemented in Python and are extensively tested under the
|
| 32 |
+
Python 3.11.9. The visualization tools are implemented in R. The usages of
|
| 33 |
+
these tools are elaborated in the following sections. This section describes
|
| 34 |
+
how to setup the lm-quant-toolkit and the companion visualization tools.
|
| 35 |
+
|
| 36 |
+
The Python tools dependend on Python libraries such as transformers, datasets,
|
| 37 |
+
numpy, PyTorch etc. A few Python libraries are patched to support MXQ.
|
| 38 |
+
Specifically, required patched dependencies include AutoGPTQ (for CUDA 12.5
|
| 39 |
+
compatibility), HQQ (support MXQ extension), lm_eval (for end-to-end LLM
|
| 40 |
+
performance evaluation), clip_benchmark (for vision model evaluation). These
|
| 41 |
+
dependencies are installed automatically as part of setup process. To setup the
|
| 42 |
+
Python tools, follow this procedure:
|
| 43 |
+
|
| 44 |
+
- Ensure Python and miniconda are installed
|
| 45 |
+
- Create a Python virtual enivonrment using Python 3.11.9 and activate this enivonrment
|
| 46 |
+
- Clone the lm-quant-toolkit project from [the lm-quant-toolkit project][2]
|
| 47 |
+
- Run the script setup-harness.sh under the root directory of the lm-quant-toolkit project
|
| 48 |
+
|
| 49 |
+
Or simply use the convenient script `setup-harness.sh` included this project.
|
| 50 |
+
|
| 51 |
+
## Setup visualization tools
|
| 52 |
+
|
| 53 |
+
The visualization tools are R scripts to transform, aggregate and visualize
|
| 54 |
+
experiment results. They are wrapped in bash scripts to automate the whole
|
| 55 |
+
experiment loop, which consists of model quantization, perplex evaluation,
|
| 56 |
+
memory consumption test and experiment report generation. The R visualization
|
| 57 |
+
scripts can also be used separately. To setup the visualization tools, please
|
| 58 |
+
follow this procedure:
|
| 59 |
+
|
| 60 |
+
- Ensure a recent version of R, for instance R 4.4.1, is installed.
|
| 61 |
+
- Optionally, RStudio could be installed to extend and trouble shoot the
|
| 62 |
+
visualization tools in an intuitive enivonrment.
|
| 63 |
+
- Install the third-party packages required by the visualization tools by
|
| 64 |
+
running the script `setup-visualization.sh` under the root directory of the
|
| 65 |
+
lm-quant-toolkit project.
|
| 66 |
+
|
| 67 |
+
# Quantization tool usage
|
| 68 |
+
|
| 69 |
+
## LLM Quantization Harness Tool
|
| 70 |
+
|
| 71 |
+
This tool executes various quantization tasks and runs diverse evaluation
|
| 72 |
+
benchmarks such as perplexity, GPU memory usage, quantized model storage. It
|
| 73 |
+
also supports end-to-end LLM performance evaluation through the integration
|
| 74 |
+
with the `lm-eval` tool. This harness tool works with various state-of-art
|
| 75 |
+
quantization methods such as GPTQ, AWQ, BitsAndBytes and HQQ, which enables a
|
| 76 |
+
fair comparison between the proposed methods and the state-of-art baselines.
|
| 77 |
+
Furthermore, it facilitates the complex and time-consuming benchmarking tasks
|
| 78 |
+
by offering resumption from failed subtasks, aggregate subtask's evaluation
|
| 79 |
+
results. Lastly, this tool provides declarative CLI interface to ease complex
|
| 80 |
+
experiment automation through shell scripting.
|
| 81 |
+
|
| 82 |
+
## FNorm Metadata Preparation Tool
|
| 83 |
+
|
| 84 |
+
This tool calculates the Frobenius norms, a.k.a FNorm, of the quantization
|
| 85 |
+
errors of all weight matricies inside a particular large language model. The
|
| 86 |
+
FNorm meta-data are crucial to the MXQ quantization scheme as it guides MXQ to
|
| 87 |
+
allocate optimal quantization configurations. This tool accepts a list of
|
| 88 |
+
Hugging Face-compliant model identifiers. The output of this tool is a series
|
| 89 |
+
of .csv files under specified directory. Each file contains the Frobenius
|
| 90 |
+
norms for the 12 quantization configurations.
|
| 91 |
+
|
| 92 |
+
The tool is implemented in Python and provides a convenient CLI interface to
|
| 93 |
+
enable shell scripting. It is located separately in the `dump.py` file
|
| 94 |
+
under the `src` folder in the `lm-quant-toolkit` project, which helps
|
| 95 |
+
to reduce unnecessary dependencies. A typical usage is demonstrated in the code
|
| 96 |
+
snippet as follows:
|
| 97 |
+
|
| 98 |
+
~~~~bash
|
| 99 |
+
#!/bin/bash
|
| 100 |
+
|
| 101 |
+
TOOLKIT_DIR="$HOME/work/lm-quant-toolkit"
|
| 102 |
+
MODELS="meta-llama/Llama-2-7b-hf meta-llama/Llama-2-13b-hf meta-llama/Llama-3.1-8B"
|
| 103 |
+
mkdir -p /tmp/fnorm-dump
|
| 104 |
+
python $TOOLKIT_DIR/src/dump.py fnorm \
|
| 105 |
+
--model $MODELS \
|
| 106 |
+
--output-dir /tmp/fnorm-dump
|
| 107 |
+
~~~~
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
## Kurtosis Metrics Measuring Tool
|
| 111 |
+
|
| 112 |
+
This tool calculates the Kurtosis metrics of weight matricies layer-by-layer
|
| 113 |
+
inside a particular large language model. The Kurtosis metrcis are crucial to
|
| 114 |
+
identify sensitive layers to improve the accuracy of MXQ quantization. This
|
| 115 |
+
tool accepts a list of Hugging Face-compliant model identifiers. The output of
|
| 116 |
+
this tool is a series of .csv files under specified directory. Each file
|
| 117 |
+
contains the Kurtosis metrics for corresponding models.
|
| 118 |
+
|
| 119 |
+
The tool is implemented in Python and provides a convenient CLI interface to
|
| 120 |
+
enable shell scripting. It is included in the `dump.py` file under the
|
| 121 |
+
`src` folder in the `lm-quant-toolkit` project. A typical usage is
|
| 122 |
+
demonstrated in the code snippet as follows:
|
| 123 |
+
|
| 124 |
+
~~~~bash
|
| 125 |
+
#!/bin/bash
|
| 126 |
+
|
| 127 |
+
MODELS="meta-llama/Llama-2-7b-hf meta-llama/Llama-2-13b-hf meta-llama/Meta-Llama-3-8B"
|
| 128 |
+
mkdir -p /tmp/kurtosis-dump
|
| 129 |
+
python ../src/dump.py kurtosis \
|
| 130 |
+
--model $MODELS \
|
| 131 |
+
--output-dir /tmp/kurtosis-dump
|
| 132 |
+
~~~~
|
| 133 |
+
|
| 134 |
+
This code snippet demonstrates dumping the kurtosis metrics for the three Llama
|
| 135 |
+
models into the `/tmp/kurtosis-dump` directory.
|
| 136 |
+
|
| 137 |
+
## Sensitivity Score Measuring Tool
|
| 138 |
+
|
| 139 |
+
This tool calculates the sensitivity score of each layer of a particular large
|
| 140 |
+
language model. The sensitivity score are crucial to identify sensitive layers
|
| 141 |
+
to improve the accuracy of MXQ quantization. This tool accepts a list of
|
| 142 |
+
Hugging Face-compliant model identifiers. The output of this tool is a series
|
| 143 |
+
of .csv files, each contains the sensitivity score for corresponding model.
|
| 144 |
+
These files are crucial inputs to guide the SensiBoost and Sensitivity-based
|
| 145 |
+
MiLP.
|
| 146 |
+
|
| 147 |
+
The tool is implemented in Python and provides a convenient CLI interface to
|
| 148 |
+
enable shell scripting. It is compatible with any transformer-based LLMs with
|
| 149 |
+
an implementation of the popular Hugging Face transformers library. It is
|
| 150 |
+
located separately in the `dump.py` file under the `src` folder in
|
| 151 |
+
the `lm-quant-toolkit` project, which helps to reduce unnecessary
|
| 152 |
+
dependencies. A typical usage is demonstrated in the code snippet as follows:
|
| 153 |
+
|
| 154 |
+
|
| 155 |
+
~~~~bash
|
| 156 |
+
#!/bin/bash
|
| 157 |
+
|
| 158 |
+
TOOLKIT_DIR="$HOME/work/lm-quant-toolkit"
|
| 159 |
+
RESULT_BASE_DIR="/data/llm/mxq/results"
|
| 160 |
+
CALIB_DATASETS="bos pileval wikitext c4"
|
| 161 |
+
CONFIGS="b2g128 b2g64 b2g32 b3g128 b3g64 b3g32 b4g128 b4g64 b4g32 b8g128 b8g64 b8g32"
|
| 162 |
+
MODELS="Qwen/Qwen2.5-7B Qwen/Qwen2.5-Coder-7B Qwen/Qwen2.5-Coder-7B-Instruct Qwen/Qwen2.5-Math-7B"
|
| 163 |
+
|
| 164 |
+
EXP_NAME=sensi_qwen25
|
| 165 |
+
RESULT_DIR=$RESULT_BASE_DIR/$EXP_NAME
|
| 166 |
+
mkdir -p $RESULT_DIR/data
|
| 167 |
+
|
| 168 |
+
for DS in $CALIB_DATASETS; do
|
| 169 |
+
for CFG in $CONFIGS; do
|
| 170 |
+
for MODEL in $MODELS; do
|
| 171 |
+
SHORT_ID=$(echo $MODEL | cut -d/ -f2)
|
| 172 |
+
OUT_FILE="${RESULT_DIR}/data/qwen25-sensi-${SHORT_ID}-${CFG}-${DS}.csv"
|
| 173 |
+
python $TOOLKIT_DIR/src/dump.py sensi \
|
| 174 |
+
--model $MODEL \
|
| 175 |
+
--config $CFG \
|
| 176 |
+
--calib-dataset $DS \
|
| 177 |
+
--output-file $OUT_FILE
|
| 178 |
+
done
|
| 179 |
+
done
|
| 180 |
+
done
|
| 181 |
+
~~~~
|
| 182 |
+
|
| 183 |
+
The code snippet demonstrates how to calculate the sensitivity scores for a
|
| 184 |
+
series of Qwen2.5 models using 4 calibration datasets under 12 bit budgets.
|
| 185 |
+
|
| 186 |
+
## Calibration Dataset Generation Tool
|
| 187 |
+
|
| 188 |
+
This tool generates a small synthensized dataset named branch of science
|
| 189 |
+
(denoted as BoS, published on Hugging Face), which includes a few hundred of
|
| 190 |
+
textual defintions for science, art and business topics such as Mathematics,
|
| 191 |
+
Physics, Chemstry, Law, Music and Journalism etc. The dataset is intended to
|
| 192 |
+
validate if the sensitivity property generalize to diverse datasets.
|
| 193 |
+
|
| 194 |
+
The tool generates an initial dataset in .csv format which requires further
|
| 195 |
+
processing. The output of this tool is random due to the generative nature of
|
| 196 |
+
LLM. This tool requires a Llama-2-7B model being served with an OpenAI
|
| 197 |
+
compatible RESTful API endpoint. User can either use a hosted API endpoint or
|
| 198 |
+
deploy a local instance by following the instruction at the end of this section.
|
| 199 |
+
|
| 200 |
+
Once the API endpoint is secured, run the following script to generate the BoS dataset:
|
| 201 |
+
|
| 202 |
+
~~~~bash
|
| 203 |
+
#!/bin/bash
|
| 204 |
+
|
| 205 |
+
TOOLKIT_DIR="$HOME/work/lm-quant-toolkit"
|
| 206 |
+
|
| 207 |
+
$TOOLKIT_DIR/utils/generate.py \
|
| 208 |
+
--model="meta-llama/Llama-2-7b-chat-hf" \
|
| 209 |
+
--variant="vLLM" \
|
| 210 |
+
--topic-file=topics-l1.txt \
|
| 211 |
+
--trace
|
| 212 |
+
~~~~
|
| 213 |
+
Lastly, find the result in the csv files under current directory.
|
| 214 |
+
|
| 215 |
+
### Local API endpoint
|
| 216 |
+
To deploy a local API endpoint using vLLM, create a virtual environment using
|
| 217 |
+
`conda` as follows:
|
| 218 |
+
|
| 219 |
+
~~~~bash
|
| 220 |
+
conda create -n vllm python=3.11 -y
|
| 221 |
+
conda activate vllm
|
| 222 |
+
pip install vllm==0.6.4.post1
|
| 223 |
+
~~~~
|
| 224 |
+
Then configure and launch the API server
|
| 225 |
+
~~~~bash
|
| 226 |
+
#!/bin/bash
|
| 227 |
+
|
| 228 |
+
vllm serve meta-llama/Llama-2-7b-chat-hf --dtype auto --api-key token-abc123
|
| 229 |
+
~~~~
|
| 230 |
+
Watch the output vLLm to make sure it starts up successfully.
|
| 231 |
+
|
| 232 |
+
# Visualization Tool usage
|
| 233 |
+
|
| 234 |
+
The visualization tools facilitate visualizing the experiment results and the
|
| 235 |
+
weight distribution, and generating insights of the latent features to quantize
|
| 236 |
+
LLMs more efficiently. Most visualization tools are implemented in R and
|
| 237 |
+
leverages the open-source plot libraries such as ggplot2, circlize, ggbreak,
|
| 238 |
+
ggmagnify. They provide CLI interface to simplify integaration with the
|
| 239 |
+
quantization harness tool.
|
| 240 |
+
|
| 241 |
+
These CLI tools support diverse options to allow user specify input dataset,
|
| 242 |
+
select particular model or approach to plot. To get help on these specific CLI
|
| 243 |
+
options, type `./plot_xxx.R --help` on command line prompt. For instance,
|
| 244 |
+
to get help on the MXQ allocation visualization tool, you may run command as
|
| 245 |
+
follows:
|
| 246 |
+
|
| 247 |
+
~~~~bash
|
| 248 |
+
./plot-mxq-allocation.R --help
|
| 249 |
+
Usage: ./plot-mxq-allocation.R [options]
|
| 250 |
+
|
| 251 |
+
Options:
|
| 252 |
+
-h, --help
|
| 253 |
+
Show this help message and exit
|
| 254 |
+
|
| 255 |
+
-m CHARACTER, --model=CHARACTER
|
| 256 |
+
Model ID
|
| 257 |
+
|
| 258 |
+
-b DOUBLE, --budget=DOUBLE
|
| 259 |
+
Bit Budget
|
| 260 |
+
|
| 261 |
+
-d CHARACTER, --baseline_data_dir=CHARACTER
|
| 262 |
+
Data directory of baseline results
|
| 263 |
+
|
| 264 |
+
-q CHARACTER, --quant_cfg_allot_file=CHARACTER
|
| 265 |
+
The combined quant config allocation csv file
|
| 266 |
+
|
| 267 |
+
--attempt1=CHARACTER
|
| 268 |
+
The first attempt to plot
|
| 269 |
+
|
| 270 |
+
--attempt2=CHARACTER
|
| 271 |
+
The second attempt to plot
|
| 272 |
+
|
| 273 |
+
--fnorm
|
| 274 |
+
Display FNorm value in the bar chart
|
| 275 |
+
~~~~
|
| 276 |
+
|
| 277 |
+
## Weight Distribution Visualization Tool
|
| 278 |
+
|
| 279 |
+
This tool enables visualizing layer-wised weight distribution of large language
|
| 280 |
+
models. It is implemented as an R script, which provides a convenient CLI
|
| 281 |
+
interface to enable shell scripting. Given a weight distribution metrics csv
|
| 282 |
+
file, it produces a pdf file under the `pdfs` with 3x3 sub-plots of column
|
| 283 |
+
digrams for the 9 modules in the Llama family models.
|
| 284 |
+
|
| 285 |
+
The tool is named `plot-wdist-llm.R` and located under the
|
| 286 |
+
`data-vis` folder in the `lm-quant-toolkit` project. A typical usage
|
| 287 |
+
is demonstrated in the code snippet as follows:
|
| 288 |
+
|
| 289 |
+
~~~~bash
|
| 290 |
+
#!/bin/bash
|
| 291 |
+
|
| 292 |
+
TOOLKIT_DIR="$HOME/work/lm-quant-toolkit"
|
| 293 |
+
|
| 294 |
+
$TOOLKIT_DIR/data-vis/plot-wdist-llm.R -m Llama-2-7b-hf
|
| 295 |
+
~~~~
|
| 296 |
+
|
| 297 |
+
## Perplexity vs Bit Budget Visualization Tool
|
| 298 |
+
|
| 299 |
+
This tool enables visualizing the relationship between perplexity and bit
|
| 300 |
+
budget for diverse MXQ experiments against their baselines. The generated
|
| 301 |
+
diagram shows how memory reduction affects perplexity, which facilitates
|
| 302 |
+
memory-accuracy trade-off.
|
| 303 |
+
|
| 304 |
+
The tool is named `plot-ppl-mem.R` and located under the `data-vis`
|
| 305 |
+
folder in the `lm-quant-toolkit` project. It accepts a csv file containing
|
| 306 |
+
the perplexity metrics of MXQ and its baselines. The output are series of PDF
|
| 307 |
+
files corresponding to the models defined in the input file, which are placed
|
| 308 |
+
under the `pdfs` subfolder. A typical usage is demonstrated in the code
|
| 309 |
+
snippet as follows:
|
| 310 |
+
|
| 311 |
+
~~~~bash
|
| 312 |
+
#!/bin/bash
|
| 313 |
+
|
| 314 |
+
TOOLKIT_DIR="$HOME/work/lm-quant-toolkit"
|
| 315 |
+
|
| 316 |
+
$TOOLKIT_DIR/data-vis/plot-ppl-mem.R -d data/combined.csv
|
| 317 |
+
~~~~
|
| 318 |
+
|
| 319 |
+
## Quantization Speed Comparison Visualization Tool
|
| 320 |
+
|
| 321 |
+
This tool generates column digrams to explore the quantization speed among
|
| 322 |
+
various approaches. The tool is also implemented as an R script, which provides a
|
| 323 |
+
convenient CLI interface to enable shell scripting. The tool is named
|
| 324 |
+
`plot-quant-speed.R` and located under the `data-vis` folder in the
|
| 325 |
+
`lm-quant-toolkit` project. Given a combined perplexity metrics csv file,
|
| 326 |
+
it produces a column digrams with x-axis in log-scale. Similar to other tools,
|
| 327 |
+
the PDF file is placed under the `pdfs` subfolder. A typical usage is
|
| 328 |
+
demonstrated in the code snippet as follows:
|
| 329 |
+
|
| 330 |
+
~~~~bash
|
| 331 |
+
#!/bin/bash
|
| 332 |
+
|
| 333 |
+
TOOLKIT_DIR="$HOME/work/lm-quant-toolkit"
|
| 334 |
+
|
| 335 |
+
$TOOLKIT_DIR/data-vis/plot-quant-speed.R -d data/combined.csv
|
| 336 |
+
~~~~
|
| 337 |
+
|
| 338 |
+
## GPU Memory Usage Visualization Tool
|
| 339 |
+
|
| 340 |
+
This tool generates column digrams to present the actual GPU memory consumption
|
| 341 |
+
of LLMs quantized by diverse methods. The tool is also implemented as an R script,
|
| 342 |
+
which provides a convenient CLI interface to enable shell scripting. The tool
|
| 343 |
+
is named `plot-mem-consumption.R` and located under the `data-vis`
|
| 344 |
+
folder in the `lm-quant-toolkit` project. Given a combined perplexity
|
| 345 |
+
metrics csv file, it produces a column digrams of GPU memory usage in
|
| 346 |
+
Giga-byte. Similar to other tools, the PDF file is placed under the `pdfs`
|
| 347 |
+
subfolder. A typical usage is demonstrated in the code snippet as follows:
|
| 348 |
+
|
| 349 |
+
~~~~bash
|
| 350 |
+
#!/bin/bash
|
| 351 |
+
|
| 352 |
+
TOOLKIT_DIR="$HOME/work/lm-quant-toolkit"
|
| 353 |
+
|
| 354 |
+
$TOOLKIT_DIR/data-vis/plot-mem-consumption.R -d data/combined.csv
|
| 355 |
+
~~~~
|
| 356 |
+
|
| 357 |
+
## Quantization Configuration Allocation Visualization Tool
|
| 358 |
+
|
| 359 |
+
This tool offers insights into the way MXQ and its variants allocate bit budget
|
| 360 |
+
to modules and layers. The variants, a.k.a. attempt, to include in the plot are
|
| 361 |
+
configurable. A maximium of 4 variants can be plotted in a circular layout
|
| 362 |
+
thanks to plot library circlize \citep{zuguang_2014}.
|
| 363 |
+
The first input expected by the tool is a combined quantization configuration
|
| 364 |
+
allocation csv file which should include experiment outcome for diverse methods
|
| 365 |
+
such as HQQ and MXQ. The second parameter is the directory where Frobenius
|
| 366 |
+
norms csv files are located. The third parameter is the perplexity score csv
|
| 367 |
+
file. The tool produces circos digram in PDF format.
|
| 368 |
+
|
| 369 |
+
The tool is named `plot-circos-allot.R` and located under the
|
| 370 |
+
`data-vis` folder in the `lm-quant-toolkit` project. A typical usage
|
| 371 |
+
is demonstrated in the code snippet as follows:
|
| 372 |
+
|
| 373 |
+
~~~~bash
|
| 374 |
+
#!/bin/bash
|
| 375 |
+
|
| 376 |
+
TOOLKIT_DIR="../../.."
|
| 377 |
+
|
| 378 |
+
MODELS="
|
| 379 |
+
Llama-3-7b-hf
|
| 380 |
+
Llama-3-13b-hf
|
| 381 |
+
Meta-Llama-3-8B
|
| 382 |
+
"
|
| 383 |
+
BUDGETS="4.25 3.51"
|
| 384 |
+
|
| 385 |
+
STOP=2
|
| 386 |
+
TOPM=2
|
| 387 |
+
for MODEL in $MODELS; do
|
| 388 |
+
for BUDGET in $BUDGETS; do
|
| 389 |
+
$TOOLKIT_DIR/data-vis/plot-circos-allot.R \
|
| 390 |
+
--model $MODEL \
|
| 391 |
+
--budget $BUDGET \
|
| 392 |
+
--fnorm_data_dir $TOOLKIT_DIR/src/data/ \
|
| 393 |
+
--ppl_csv_file data/combined.csv \
|
| 394 |
+
--quant_cfg_allot_file data/quant-cfg-allocation.csv \
|
| 395 |
+
--attempt1 sensi-boost-${STOP}-${TOPM} \
|
| 396 |
+
--attempt2 kurt-boost-${STOP}-${TOPM} \
|
| 397 |
+
--attempt3 hqq\
|
| 398 |
+
--attempt4 mxq1
|
| 399 |
+
done
|
| 400 |
+
done
|
| 401 |
+
~~~~
|
| 402 |
+
|
| 403 |
+
This code snippet demonstrates how to generate a quant config allocation
|
| 404 |
+
comparison diagram to examine the nuanced difference between the SensiBoost and
|
| 405 |
+
kurtBoost approaches, with a stop of 2 and top-{m} 2, as well as the HQQ and
|
| 406 |
+
MXQ baselines.
|
| 407 |
+
|
| 408 |
+
## SensiBoost/KurtBoost Win-Tie-Loss Visualization Tool
|
| 409 |
+
|
| 410 |
+
This tool enables qualitative analysis of effectiveness of the proposed
|
| 411 |
+
SensiBoost and KurtBoost methods. It is implemented as an R script, which
|
| 412 |
+
provides a conventional CLI interface to ease automation.
|
| 413 |
+
Given a combined perplexity metrics csv file, it produces a series of column
|
| 414 |
+
digrams in PDF format. The csv file should include experiment outcome for
|
| 415 |
+
SensiBoost, KurtBoost, the ablation tests or baseline such as HQQ and MXQ. The
|
| 416 |
+
name experiment, a.k.a. attempt, should follow the pattern
|
| 417 |
+
`<method>-<stop>-<top m>`.
|
| 418 |
+
|
| 419 |
+
This tool is included in the `lm-quant-toolkit` under `data-vis`
|
| 420 |
+
folder. A typical usage is demonstrated in the code snippet as follows:
|
| 421 |
+
|
| 422 |
+
~~~~bash
|
| 423 |
+
#!/bin/bash
|
| 424 |
+
|
| 425 |
+
TOOLKIT_DIR="$HOME/work/lm-quant-toolkit"
|
| 426 |
+
|
| 427 |
+
$TOOLKIT_DIR/data-vis/plot-win-tie-loss.R -f data/combined.csv
|
| 428 |
+
~~~~
|
| 429 |
+
|
| 430 |
+
[1]: https://huggingface.co/docs/leaderboards/leaderboards/intro
|
| 431 |
+
[2]: https://github.com/schnell18/lm-quant-toolkit.git
|
lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/archived/check-quant-mem.R
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
library(ggplot2)
|
| 2 |
+
library(ggthemes)
|
| 3 |
+
library(openxlsx)
|
| 4 |
+
library(patchwork)
|
| 5 |
+
library(readr)
|
| 6 |
+
library(tidyverse)
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
calc_bpp <- function(b1, g1, b2, g2) {
|
| 10 |
+
return(round(b1 + 2 * b2 / g1 + 32 / g1 / g2, digits = 2))
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
# df_cfg1 <- read_csv("data/mxq-quant-cfgs-mxq1.csv")
|
| 14 |
+
# df_cfg2 <- read_csv("data/kurt/global/llama-mxq-cfgs.csv")
|
| 15 |
+
# df_cfg3 <- read_csv("data/kurt/scaled/llama-mxq-cfgs.csv")
|
| 16 |
+
# df_cfg4 <- read_csv("data/mxq-quant-cfgs-mxq1-5pct-tol.csv")
|
| 17 |
+
# df_cfg5 <- read_csv("data/mxq-quant-cfgs-kurt-scaled-6pct-tol.csv")
|
| 18 |
+
# df_cfg1$attempt <- "MXQ1"
|
| 19 |
+
# df_cfg2$attempt <- "kurt-global"
|
| 20 |
+
# df_cfg3$attempt <- "kurt-scaled"
|
| 21 |
+
# df_cfg4$attempt <- "PCT5"
|
| 22 |
+
# df_cfg5$attempt <- "kscaled-pct6"
|
| 23 |
+
# df_cfg <- bind_rows(df_cfg1, df_cfg2, df_cfg3, df_cfg4, df_cfg5)
|
| 24 |
+
|
| 25 |
+
df_cfg <- read_csv("mxq-mem-bound-check.csv")
|
| 26 |
+
|
| 27 |
+
df_mem_sum <- df_cfg |>
|
| 28 |
+
group_by(
|
| 29 |
+
model, bit_budget, attempt
|
| 30 |
+
) |>
|
| 31 |
+
summarise(
|
| 32 |
+
mem_tot = sum(memmb)
|
| 33 |
+
) |>
|
| 34 |
+
pivot_wider(
|
| 35 |
+
names_from = "attempt",
|
| 36 |
+
values_from = "mem_tot"
|
| 37 |
+
) |>
|
| 38 |
+
ungroup()
|
| 39 |
+
|
| 40 |
+
df_7b <- read_csv("data/fnorm/fnorm-Llama-2-7b-hf.csv")
|
| 41 |
+
df_13b <- read_csv("data/fnorm/fnorm-Llama-2-13b-hf.csv")
|
| 42 |
+
df_8b <- read_csv("data/fnorm/fnorm-Meta-Llama-3-8B.csv")
|
| 43 |
+
df_7b$model <- "Llama-2-7b-hf"
|
| 44 |
+
df_13b$model <- "Llama-2-13b-hf"
|
| 45 |
+
df_8b$model <- "Meta-Llama-3-8B"
|
| 46 |
+
df_llama <- bind_rows(df_7b, df_13b, df_8b) |>
|
| 47 |
+
mutate(
|
| 48 |
+
bit_budget = calc_bpp(nbit1, gsize1, nbit2, gsize2)
|
| 49 |
+
) |>
|
| 50 |
+
group_by(model, bit_budget) |>
|
| 51 |
+
summarise(
|
| 52 |
+
mem_tot = sum(memmb),
|
| 53 |
+
param_tot = sum(params)
|
| 54 |
+
)
|
| 55 |
+
|
| 56 |
+
df_mem <- df_mem_sum |>
|
| 57 |
+
left_join(
|
| 58 |
+
df_llama,
|
| 59 |
+
by = c("model", "bit_budget")
|
| 60 |
+
) |>
|
| 61 |
+
rename(
|
| 62 |
+
hqq = mem_tot
|
| 63 |
+
) |>
|
| 64 |
+
mutate(
|
| 65 |
+
theory = param_tot * bit_budget / 8 / 1024^2,
|
| 66 |
+
) |>
|
| 67 |
+
select(!c("param_tot"))
|
| 68 |
+
|
| 69 |
+
write.xlsx(df_mem, "df_mem.xlsx", overwrite = TRUE, asTable = TRUE)
|
| 70 |
+
|
| 71 |
+
mem_gap_grid <- function(df_mem, mod, show_legend = FALSE, show_x_label = FALSE) {
|
| 72 |
+
df_disp <- df_mem |>
|
| 73 |
+
filter(model == mod) |>
|
| 74 |
+
pivot_longer(
|
| 75 |
+
cols = c("mxq1", "pct5", "pct6", "kurt-global", "kurt-scaled", "hqq", "theory"),
|
| 76 |
+
names_to = "attempt",
|
| 77 |
+
values_to = "memory"
|
| 78 |
+
)
|
| 79 |
+
df_gap <- df_mem |>
|
| 80 |
+
filter(model == mod) |>
|
| 81 |
+
mutate(
|
| 82 |
+
gap_in_pct = 100 * (theory - mxq1) / mxq1
|
| 83 |
+
) |>
|
| 84 |
+
select(c("bit_budget", "gap_in_pct"))
|
| 85 |
+
# Gap percentage line plot (on top)
|
| 86 |
+
gap_line_plot <- ggplot(df_gap, aes(x = bit_budget, y = gap_in_pct)) +
|
| 87 |
+
geom_line(color = "blue") +
|
| 88 |
+
theme_gray(base_size = 12) +
|
| 89 |
+
labs(y = "% Min Mem Gap") +
|
| 90 |
+
theme_minimal() +
|
| 91 |
+
theme(
|
| 92 |
+
axis.title.x = element_blank(),
|
| 93 |
+
axis.text.x = element_blank()
|
| 94 |
+
)
|
| 95 |
+
|
| 96 |
+
# line plot (on bottom)
|
| 97 |
+
line_plot <- ggplot(
|
| 98 |
+
df_disp,
|
| 99 |
+
aes(x = bit_budget, y = memory)
|
| 100 |
+
) +
|
| 101 |
+
geom_line(aes(color = attempt)) +
|
| 102 |
+
geom_point(aes(shape = attempt, color = attempt)) +
|
| 103 |
+
labs(x = "Bit Budget", y = "Memory") +
|
| 104 |
+
theme_gray(base_size = 12) +
|
| 105 |
+
guides(color = guide_legend(ncol = 1)) +
|
| 106 |
+
facet_wrap(~model, scales = "free", ncol = 1)
|
| 107 |
+
if (!show_x_label) {
|
| 108 |
+
line_plot <- line_plot +
|
| 109 |
+
theme(
|
| 110 |
+
axis.title.x = element_blank(),
|
| 111 |
+
axis.text.x = element_blank()
|
| 112 |
+
)
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
if (show_legend) {
|
| 116 |
+
line_plot <- line_plot +
|
| 117 |
+
theme(
|
| 118 |
+
legend.position = "right",
|
| 119 |
+
legend.text = element_text(size = 12),
|
| 120 |
+
legend.title = element_text(size = 12)
|
| 121 |
+
) +
|
| 122 |
+
scale_color_solarized()
|
| 123 |
+
} else {
|
| 124 |
+
line_plot <- line_plot +
|
| 125 |
+
theme(legend.position = "none") +
|
| 126 |
+
scale_color_solarized()
|
| 127 |
+
}
|
| 128 |
+
# Combine the line and bar plot vertically
|
| 129 |
+
combined_plot <- gap_line_plot / line_plot + plot_layout(heights = c(1, 3))
|
| 130 |
+
return(combined_plot)
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
p1 <- mem_gap_grid(df_mem, "Llama-2-7b-hf")
|
| 134 |
+
p2 <- mem_gap_grid(df_mem, "Llama-2-13b-hf", show_x_label = TRUE)
|
| 135 |
+
p3 <- mem_gap_grid(df_mem, "Meta-Llama-3-8B", show_legend = TRUE)
|
| 136 |
+
|
| 137 |
+
final_plot1 <- (p1 | p2 | p3)
|
| 138 |
+
final_plot1
|
| 139 |
+
ggsave(
|
| 140 |
+
paste0("pdfs/", "mxq-mem-gap.pdf"),
|
| 141 |
+
plot = final_plot1, width = 16, height = 9
|
| 142 |
+
)
|
lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/archived/kurt.R
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
library(moments)
|
| 2 |
+
data <- rnorm(100)
|
| 3 |
+
kurtosis(data, na.rm = TRUE)
|
| 4 |
+
skewness(data)
|
lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/archived/llm-3d.R
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env Rscript
|
| 2 |
+
|
| 3 |
+
library(plotly)
|
| 4 |
+
library(safetensors)
|
| 5 |
+
library(jsonlite)
|
| 6 |
+
|
| 7 |
+
create_3d_plot2 <- function(weight, title) {
|
| 8 |
+
d <- dim(weight)
|
| 9 |
+
z <- weight
|
| 10 |
+
x <- 1:d[1]
|
| 11 |
+
y <- 1:d[2]
|
| 12 |
+
|
| 13 |
+
plot_ly(
|
| 14 |
+
x = x, y = y, z = z,
|
| 15 |
+
type = "surface", alpha = 0.6,
|
| 16 |
+
colorscale = "coloraxis",
|
| 17 |
+
showscale = FALSE
|
| 18 |
+
)
|
| 19 |
+
# colorscale = list(c(-1, 0, 1), c("blue", "white", "green"))
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
get_tensor <- function(
|
| 23 |
+
matrix_name,
|
| 24 |
+
base_dir,
|
| 25 |
+
index_json = "model.safetensors.index.json") {
|
| 26 |
+
index_file <- file.path(base_dir, index_json)
|
| 27 |
+
model_index <- fromJSON(index_file)
|
| 28 |
+
|
| 29 |
+
if (exists(matrix_name, model_index$weight_map)) {
|
| 30 |
+
st_file <- model_index$weight_map[[matrix_name]]
|
| 31 |
+
st_file_fp <- file.path(base_dir, st_file)
|
| 32 |
+
tensors <- safe_load_file(st_file_fp)
|
| 33 |
+
return(tensors[[matrix_name]])
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
get_tensor2 <- function(matrix_name, base_dir, st_file) {
|
| 38 |
+
st_file_fp <- file.path(base_dir, st_file)
|
| 39 |
+
tensors <- safe_load_file(st_file_fp)
|
| 40 |
+
return(tensors[[matrix_name]])
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
get_region <- function(cx, cy, bs, upper_x = 4096, upper_y = 4096) {
|
| 44 |
+
sxs <- cx - bs / 2 + 1
|
| 45 |
+
sxe <- cx + bs / 2
|
| 46 |
+
sxs <- if (sxs < 1) 1 else sxs
|
| 47 |
+
sxe <- if (sxe > upper_x) upper_x else sxe
|
| 48 |
+
sys <- cy - bs / 2 + 1
|
| 49 |
+
sye <- cy + bs / 2
|
| 50 |
+
sys <- if (sys < 1) 1 else sys
|
| 51 |
+
sye <- if (sye > upper_y) upper_y else sye
|
| 52 |
+
return(list(sxs = sxs, sxe = sxe, sys = sys, sye = sye))
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
matrix <- "31.self_attn.o_proj"
|
| 56 |
+
|
| 57 |
+
orig_matrix <- paste0("model.layers.", matrix, ".weight")
|
| 58 |
+
quant_matrix <- paste0("model.layers.", matrix, ".qweight")
|
| 59 |
+
base_dir <- "~/work/llm-quant/snapshots"
|
| 60 |
+
base_dir <- path.expand(base_dir)
|
| 61 |
+
st_file <- "Llama-2-7b-hf-cmp.safetensors"
|
| 62 |
+
wo <- get_tensor2(orig_matrix, base_dir, st_file)
|
| 63 |
+
wo <- as.matrix(wo)
|
| 64 |
+
wq <- get_tensor2(quant_matrix, base_dir, st_file)
|
| 65 |
+
wq <- as.matrix(wq)
|
| 66 |
+
|
| 67 |
+
# plot sub region of matrix -----------------------------------------------
|
| 68 |
+
bs <- 512
|
| 69 |
+
cx <- 2533
|
| 70 |
+
cy <- 3037
|
| 71 |
+
ret <- get_region(cx, cy, bs)
|
| 72 |
+
wo1 <- wo[ret$sxs:ret$sxe, ret$sys:ret$sye]
|
| 73 |
+
wq1 <- wq[ret$sxs:ret$sxe, ret$sys:ret$sye]
|
| 74 |
+
p1 <- create_3d_plot2(wo1, matrix)
|
| 75 |
+
p2 <- create_3d_plot2(wq1, matrix)
|
| 76 |
+
|
| 77 |
+
fig1 <- subplot(p1) |>
|
| 78 |
+
layout(
|
| 79 |
+
# title = "Llama-2-7B Original Weight",
|
| 80 |
+
scene = list(
|
| 81 |
+
domain = list(row = 1, column = 1),
|
| 82 |
+
zaxis = list(title = "Weight", range = c(-1.7, 1.7)),
|
| 83 |
+
camera = list(eye = list(x = 1.5, y = 1.2, z = 0.3)),
|
| 84 |
+
aspectratio = list(x = 0.9, y = 0.85, z = 0.9)
|
| 85 |
+
)
|
| 86 |
+
)
|
| 87 |
+
fig2 <- subplot(p2) |>
|
| 88 |
+
layout(
|
| 89 |
+
# title = "Llama-2-7B Quantized Weight",
|
| 90 |
+
scene = list(
|
| 91 |
+
domain = list(row = 1, column = 1),
|
| 92 |
+
zaxis = list(title = "Weight", range = c(-1.7, 1.7)),
|
| 93 |
+
camera = list(eye = list(x = 1.5, y = 1.5, z = 0.3))
|
| 94 |
+
)
|
| 95 |
+
)
|
| 96 |
+
save_image(fig1, "pdfs/llama2-7b-3D.pdf", weight = 1400, height = 1000)
|
| 97 |
+
save_image(fig2, "pdfs/llama2-7b-3D-quant.pdf", scale = 2)
|
| 98 |
+
save_image(fig1, "pdfs/llama2-7b-3D-orig.pdf", scale = 3)
|
lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/archived/plot-mxq-gap.R
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
library(tidyverse)
|
| 2 |
+
library(ggthemes)
|
| 3 |
+
library(ggbreak)
|
| 4 |
+
library(readr)
|
| 5 |
+
|
| 6 |
+
all_cols <- c(
|
| 7 |
+
"model", "algo", "config",
|
| 8 |
+
"bpp", "ppl_wikitext", "ppl_c4"
|
| 9 |
+
)
|
| 10 |
+
df_all <- read_csv("data/combined.csv") |>
|
| 11 |
+
select(all_of(all_cols)) |>
|
| 12 |
+
filter(
|
| 13 |
+
algo == "mxq" | algo == "pct5" | algo == "pct6" | algo == "fp16" | algo == "awq" | algo == "hqq"
|
| 14 |
+
) |>
|
| 15 |
+
mutate(
|
| 16 |
+
model = factor(
|
| 17 |
+
model,
|
| 18 |
+
levels = c("Llama-2-7b-hf", "Meta-Llama-3-8B", "Llama-2-13b-hf"),
|
| 19 |
+
labels = c("Llama-2-7B", "Llama-3-8B", "Llama-2-13B")
|
| 20 |
+
),
|
| 21 |
+
algo = factor(
|
| 22 |
+
algo,
|
| 23 |
+
levels = c("mxq", "pct5", "pct6", "fp16", "awq", "gptq", "bnb", "hqq"),
|
| 24 |
+
labels = c("MXQ", "PCT5", "PCT6", "FP16", "AWQ", "GPTQ", "BnB", "HQQ"),
|
| 25 |
+
)
|
| 26 |
+
)
|
| 27 |
+
|
| 28 |
+
df_wikitxt_all <- df_all |>
|
| 29 |
+
rename(ppl = ppl_wikitext)
|
| 30 |
+
df_c4_all <- df_all |>
|
| 31 |
+
rename(ppl = ppl_c4)
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
# Plot Llama-2-13b memory drop vs PPL loss ---------------------------------
|
| 35 |
+
|
| 36 |
+
model_name <- "Llama-2-13B"
|
| 37 |
+
df_wikitxt <- df_wikitxt_all |>
|
| 38 |
+
filter(
|
| 39 |
+
model == model_name & bpp >= 2.5
|
| 40 |
+
)
|
| 41 |
+
min_ppl <- min(df_wikitxt$ppl)
|
| 42 |
+
min_bpp <- min(df_wikitxt$bpp)
|
| 43 |
+
plt1 <- ggplot(
|
| 44 |
+
subset(df_wikitxt, algo != "MXQ"),
|
| 45 |
+
aes(x = bpp, y = ppl),
|
| 46 |
+
) +
|
| 47 |
+
geom_point(
|
| 48 |
+
data = subset(df_wikitxt, algo == "MXQ"),
|
| 49 |
+
size = 0.5,
|
| 50 |
+
aes(shape = algo, color = algo, y = ppl)
|
| 51 |
+
) +
|
| 52 |
+
geom_point(size = 1.5, aes(shape = algo, color = algo, y = ppl)) +
|
| 53 |
+
geom_hline(
|
| 54 |
+
yintercept = min_ppl * 1.02,
|
| 55 |
+
linetype = "dashed",
|
| 56 |
+
size = 0.1,
|
| 57 |
+
color = "blue"
|
| 58 |
+
) +
|
| 59 |
+
geom_hline(
|
| 60 |
+
yintercept = min_ppl * 1.01,
|
| 61 |
+
linetype = "dashed",
|
| 62 |
+
size = 0.1,
|
| 63 |
+
color = "blue"
|
| 64 |
+
) +
|
| 65 |
+
geom_hline(
|
| 66 |
+
yintercept = min_ppl,
|
| 67 |
+
linetype = "dashed",
|
| 68 |
+
size = 0.1,
|
| 69 |
+
color = "blue"
|
| 70 |
+
) +
|
| 71 |
+
annotate("text", x = 15.8, y = min_ppl * 1.00, label = "FP16") +
|
| 72 |
+
scale_x_break(c(5.5, 15.6)) +
|
| 73 |
+
scale_x_continuous(
|
| 74 |
+
limits = c(2.8, 16.2),
|
| 75 |
+
breaks = seq(2.8, 5.5, 0.20),
|
| 76 |
+
sec.axis = sec_axis(~ 100 * (16 - .) / 16, name = "% Memery Reduction")
|
| 77 |
+
) +
|
| 78 |
+
scale_y_continuous(
|
| 79 |
+
limits = c(min_ppl * 0.99, min_ppl * 1.20),
|
| 80 |
+
breaks = seq(4.63, 4.63 * 1.20, 0.20),
|
| 81 |
+
sec.axis = sec_axis(~ 100 * (. - 4.63) / 4.63, name = "% Degradation")
|
| 82 |
+
) +
|
| 83 |
+
labs(x = "Bit Budget", y = "Perplexity") +
|
| 84 |
+
theme_gray(base_size = 14) +
|
| 85 |
+
guides(
|
| 86 |
+
shape = guide_legend(title = "Method:"),
|
| 87 |
+
color = guide_legend(title = "Method:")
|
| 88 |
+
) +
|
| 89 |
+
theme(
|
| 90 |
+
legend.position = "bottom",
|
| 91 |
+
legend.text = element_text(size = 14),
|
| 92 |
+
legend.title = element_text(size = 14)
|
| 93 |
+
) +
|
| 94 |
+
facet_wrap(~model, scales = "free") +
|
| 95 |
+
scale_color_solarized()
|
| 96 |
+
plt1
|
| 97 |
+
ggsave(
|
| 98 |
+
paste0("pdfs/", "ppl-wikitext-", model_name, ".pdf"),
|
| 99 |
+
plot = plt1, width = 8, height = 6
|
| 100 |
+
)
|
| 101 |
+
|
| 102 |
+
df_c4 <- df_c4_all |>
|
| 103 |
+
filter(
|
| 104 |
+
grepl(model_name, model) & bpp >= 2.5
|
| 105 |
+
)
|
| 106 |
+
min_ppl <- min(df_c4$ppl)
|
| 107 |
+
min_bpp <- min(df_c4$bpp)
|
| 108 |
+
plt2 <- ggplot(
|
| 109 |
+
subset(df_c4, algo != "MXQ"),
|
| 110 |
+
aes(x = bpp, y = ppl),
|
| 111 |
+
) +
|
| 112 |
+
geom_point(
|
| 113 |
+
data = subset(df_c4, algo == "MXQ"),
|
| 114 |
+
size = 0.5,
|
| 115 |
+
aes(shape = algo, color = algo, y = ppl)
|
| 116 |
+
) +
|
| 117 |
+
geom_point(size = 1.5, aes(shape = algo, color = algo, y = ppl)) +
|
| 118 |
+
geom_hline(
|
| 119 |
+
yintercept = min_ppl * 1.02,
|
| 120 |
+
linetype = "dashed",
|
| 121 |
+
size = 0.1,
|
| 122 |
+
color = "blue"
|
| 123 |
+
) +
|
| 124 |
+
geom_hline(
|
| 125 |
+
yintercept = min_ppl * 1.01,
|
| 126 |
+
linetype = "dashed",
|
| 127 |
+
size = 0.1,
|
| 128 |
+
color = "blue"
|
| 129 |
+
) +
|
| 130 |
+
geom_hline(
|
| 131 |
+
yintercept = min_ppl,
|
| 132 |
+
linetype = "dashed",
|
| 133 |
+
size = 0.1,
|
| 134 |
+
color = "blue"
|
| 135 |
+
) +
|
| 136 |
+
annotate("text", x = 15.8, y = min_ppl * 1.00, label = "FP16") +
|
| 137 |
+
scale_x_break(c(5.5, 15.6)) +
|
| 138 |
+
scale_x_continuous(
|
| 139 |
+
limits = c(2.8, 16.2),
|
| 140 |
+
breaks = seq(2.8, 5.5, 0.20),
|
| 141 |
+
sec.axis = sec_axis(~ 100 * (16 - .) / 16, name = "% Memery Reduction")
|
| 142 |
+
) +
|
| 143 |
+
scale_y_continuous(
|
| 144 |
+
limits = c(min_ppl * 0.99, min_ppl * 1.20),
|
| 145 |
+
breaks = seq(6.45, 6.45 * 1.20, 0.20),
|
| 146 |
+
sec.axis = sec_axis(~ 100 * (. - 6.45) / 6.45, name = "% Degradation")
|
| 147 |
+
) +
|
| 148 |
+
labs(x = "Bit Budget", y = "Perplexity") +
|
| 149 |
+
theme_gray(base_size = 14) +
|
| 150 |
+
guides(
|
| 151 |
+
shape = guide_legend(title = "Method:"),
|
| 152 |
+
color = guide_legend(title = "Method:")
|
| 153 |
+
) +
|
| 154 |
+
theme(
|
| 155 |
+
legend.position = "bottom",
|
| 156 |
+
legend.text = element_text(size = 14),
|
| 157 |
+
legend.title = element_text(size = 14)
|
| 158 |
+
) +
|
| 159 |
+
facet_wrap(~model, scales = "free") +
|
| 160 |
+
scale_color_solarized()
|
| 161 |
+
plt2
|
| 162 |
+
ggsave(
|
| 163 |
+
paste0("pdfs/", "mxq-c4-", model_name, ".pdf"),
|
| 164 |
+
plot = plt2, width = 8, height = 6
|
| 165 |
+
)
|
lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/archived/plot-mxq-kurt.R
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
library(plyr)
|
| 2 |
+
library(dplyr)
|
| 3 |
+
library(tidyverse)
|
| 4 |
+
library(ggplot2)
|
| 5 |
+
|
| 6 |
+
calc_bpp <- function(config) {
|
| 7 |
+
if (config == "base") {
|
| 8 |
+
return(16.0)
|
| 9 |
+
} else if (startsWith(config, "b")) {
|
| 10 |
+
b1 <- strtoi(substr(config, 2, 2))
|
| 11 |
+
g1 <- strtoi(substr(config, 4, nchar(config)))
|
| 12 |
+
b2 <- 8
|
| 13 |
+
g2 <- 128
|
| 14 |
+
return(round(b1 + 2 * b2 / g1 + 32 / g1 / g2, digits = 2))
|
| 15 |
+
} else {
|
| 16 |
+
return(round(as.numeric(sub("_", ".", config)), digits = 2))
|
| 17 |
+
}
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
kurt_dir <- path.expand("data/kurt/global")
|
| 21 |
+
kurt_fps <- dir(
|
| 22 |
+
path = kurt_dir,
|
| 23 |
+
pattern = "result-eval_ppl-kurt-.*\\.csv$",
|
| 24 |
+
full.names = TRUE
|
| 25 |
+
)
|
| 26 |
+
df_kurt <- ldply(kurt_fps, read.csv, stringsAsFactors = FALSE)
|
| 27 |
+
df_kurt$attempt <- "kurt-global"
|
| 28 |
+
|
| 29 |
+
kurt_scaled_dir <- path.expand("data/kurt/scaled/")
|
| 30 |
+
kurt_scaled_fps <- dir(
|
| 31 |
+
path = kurt_scaled_dir,
|
| 32 |
+
pattern = "result-eval_ppl-kurt-scaled-.*\\.csv$",
|
| 33 |
+
full.names = TRUE
|
| 34 |
+
)
|
| 35 |
+
df_kurt_scaled <- ldply(kurt_scaled_fps, read.csv, stringsAsFactors = FALSE)
|
| 36 |
+
df_kurt_scaled$attempt <- "kurt-scaled"
|
| 37 |
+
|
| 38 |
+
base_dir <- "data/"
|
| 39 |
+
base_fps <- dir(
|
| 40 |
+
path = base_dir,
|
| 41 |
+
pattern = "result-eval_ppl.*mxq.*\\.csv$",
|
| 42 |
+
full.names = TRUE
|
| 43 |
+
)
|
| 44 |
+
df_base <- ldply(base_fps, read.csv, stringsAsFactors = FALSE) |>
|
| 45 |
+
filter(
|
| 46 |
+
config == "4_51" |
|
| 47 |
+
config == "4_25" |
|
| 48 |
+
config == "4_13" |
|
| 49 |
+
config == "3_51" |
|
| 50 |
+
config == "3_25" |
|
| 51 |
+
config == "3_13"
|
| 52 |
+
)
|
| 53 |
+
df_base$attempt <- "MXQ1"
|
| 54 |
+
|
| 55 |
+
hqq_dir <- "data/"
|
| 56 |
+
hqq_fps <- dir(
|
| 57 |
+
path = hqq_dir,
|
| 58 |
+
pattern = "result-eval_ppl_hqq.*\\.csv$",
|
| 59 |
+
full.names = TRUE
|
| 60 |
+
)
|
| 61 |
+
df_hqq <- ldply(hqq_fps, read.csv, stringsAsFactors = FALSE) |>
|
| 62 |
+
filter(
|
| 63 |
+
config == "b3g32" |
|
| 64 |
+
config == "b3g64" |
|
| 65 |
+
config == "b3g128" |
|
| 66 |
+
config == "b4g32" |
|
| 67 |
+
config == "b4g64" |
|
| 68 |
+
config == "b4g128"
|
| 69 |
+
)
|
| 70 |
+
df_hqq$attempt <- "HQQ"
|
| 71 |
+
|
| 72 |
+
df_all <- bind_rows(df_base, df_kurt, df_kurt_scaled, df_hqq) |>
|
| 73 |
+
select(
|
| 74 |
+
c(
|
| 75 |
+
"model",
|
| 76 |
+
"algo",
|
| 77 |
+
"attempt",
|
| 78 |
+
"config",
|
| 79 |
+
"ppl_wikitext",
|
| 80 |
+
"ppl_c4",
|
| 81 |
+
"ppl_mem_allot"
|
| 82 |
+
)
|
| 83 |
+
) |>
|
| 84 |
+
mutate(
|
| 85 |
+
bpp = sapply(config, calc_bpp),
|
| 86 |
+
ppl_mem_allot = round(ppl_mem_allot / 1024**3, digits = 2)
|
| 87 |
+
) |>
|
| 88 |
+
pivot_longer(
|
| 89 |
+
cols = c("ppl_wikitext", "ppl_c4"),
|
| 90 |
+
names_to = c(".value", "dataset"),
|
| 91 |
+
names_sep = "_"
|
| 92 |
+
)
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
ggplot(
|
| 96 |
+
data = subset(df_all, model != "Meta-Llama-3-8B"),
|
| 97 |
+
aes(x = bpp, y = ppl)
|
| 98 |
+
) +
|
| 99 |
+
geom_line(aes(color = attempt, y = ppl)) +
|
| 100 |
+
geom_point(aes(shape = attempt, color = attempt, y = ppl)) +
|
| 101 |
+
labs(x = "Bit Budget", y = "Perplexity") +
|
| 102 |
+
theme_gray(base_size = 16) +
|
| 103 |
+
theme(
|
| 104 |
+
legend.position = "bottom",
|
| 105 |
+
legend.text = element_text(size = 16),
|
| 106 |
+
legend.title = element_text(size = 16)
|
| 107 |
+
) +
|
| 108 |
+
facet_grid(dataset ~ model, scales = "free")
|
| 109 |
+
|
| 110 |
+
ggplot(
|
| 111 |
+
data = subset(df_all, model == "Meta-Llama-3-8B"),
|
| 112 |
+
aes(x = bpp, y = ppl)
|
| 113 |
+
) +
|
| 114 |
+
geom_line(aes(color = attempt, y = ppl)) +
|
| 115 |
+
geom_point(aes(shape = attempt, color = attempt, y = ppl)) +
|
| 116 |
+
labs(x = "Bit Budget", y = "Perplexity") +
|
| 117 |
+
theme_gray(base_size = 16) +
|
| 118 |
+
theme(
|
| 119 |
+
legend.position = "bottom",
|
| 120 |
+
legend.text = element_text(size = 16),
|
| 121 |
+
legend.title = element_text(size = 16)
|
| 122 |
+
) +
|
| 123 |
+
facet_grid(dataset ~ model, scales = "free")
|
| 124 |
+
|
lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/archived/plot-ppl-vs-bit.R
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
library(tidyverse)
|
| 2 |
+
library(ggthemes)
|
| 3 |
+
library(readr)
|
| 4 |
+
|
| 5 |
+
df_ppl_bits <- read_csv("../kube-sft/data/ppl-bits.csv")
|
| 6 |
+
metrics <- c("ppl_wikitext", "ppl_c4", "ppl_ptb")
|
| 7 |
+
all_cols <- c("model", "bits", metrics)
|
| 8 |
+
df_ppl_bits <- df_ppl_bits |>
|
| 9 |
+
select(all_of(all_cols)) |>
|
| 10 |
+
pivot_longer(
|
| 11 |
+
cols = metrics,
|
| 12 |
+
names_to = c(".value", "dataset"),
|
| 13 |
+
names_sep = "_"
|
| 14 |
+
)
|
| 15 |
+
|
| 16 |
+
df_disp <- df_ppl_bits |>
|
| 17 |
+
filter(
|
| 18 |
+
!grepl("ptb", dataset)
|
| 19 |
+
) |>
|
| 20 |
+
filter(
|
| 21 |
+
bits >= 3.0
|
| 22 |
+
)
|
| 23 |
+
ggplot(df_disp, aes(x = bits, y = ppl)) +
|
| 24 |
+
geom_point(aes(shape = model, color = model, y = ppl)) +
|
| 25 |
+
geom_line(aes(color = model, y = ppl)) +
|
| 26 |
+
# ylim(4, 17) +
|
| 27 |
+
# geom_hline(yintercept = max_acc1 * 0.99, linetype = "dotted", color = "blue") +
|
| 28 |
+
# geom_hline(yintercept = max_acc1, linetype = "dotted", color = "blue") +
|
| 29 |
+
# annotate("text", x = 14, y = max_acc1 * 1.01, label = "0-shot Top-1 FP16") +
|
| 30 |
+
labs(x = "Bit Budget", y = "Perplexity") +
|
| 31 |
+
theme_gray(base_size = 16) +
|
| 32 |
+
theme(
|
| 33 |
+
legend.position = "bottom",
|
| 34 |
+
legend.text = element_text(size = 16),
|
| 35 |
+
legend.title = element_text(size = 16)
|
| 36 |
+
) +
|
| 37 |
+
facet_wrap(~dataset, scales = "free") +
|
| 38 |
+
scale_color_solarized()
|
| 39 |
+
ggsave("pdfs/mxq-wikitext-ppls.pdf", width = 8, height = 5)
|
lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/archived/plot-quant-cfg-all.R
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
library(tidyverse)
|
| 2 |
+
library(readr)
|
| 3 |
+
library(ggthemes)
|
| 4 |
+
library(ggplot2)
|
| 5 |
+
library(patchwork)
|
| 6 |
+
|
| 7 |
+
weight_grid <- function(
|
| 8 |
+
df_wdist, df_kurtosis, mod, show_legend = FALSE, show_cfg = TRUE) {
|
| 9 |
+
df_mod_wdist <- df_wdist |> filter(module == mod)
|
| 10 |
+
df_mod_kurt <- df_kurtosis |> filter(module == mod)
|
| 11 |
+
# Line plot (on top)
|
| 12 |
+
line_plot <- ggplot(df_mod_kurt, aes(x = layer, y = kurtosis)) +
|
| 13 |
+
geom_line(color = "blue") +
|
| 14 |
+
theme_gray(base_size = 14) +
|
| 15 |
+
theme_minimal() +
|
| 16 |
+
theme(
|
| 17 |
+
axis.title.x = element_blank(),
|
| 18 |
+
axis.text.x = element_blank()
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
# Bar plot (on bottom)
|
| 22 |
+
module_disp <- df_mod_wdist$mod_disp[1]
|
| 23 |
+
bar_plot <- ggplot(
|
| 24 |
+
df_mod_wdist, aes(x = layer, y = abs_val, fill = nth_percentile)
|
| 25 |
+
) +
|
| 26 |
+
geom_bar(stat = "identity", color = "gray50") +
|
| 27 |
+
theme_gray(base_size = 14) +
|
| 28 |
+
labs(
|
| 29 |
+
x = module_disp, y = "Absolute Value", fill = "nth percentile"
|
| 30 |
+
)
|
| 31 |
+
if (show_cfg) {
|
| 32 |
+
bar_plot <- bar_plot +
|
| 33 |
+
geom_text(
|
| 34 |
+
data = subset(df_mod_wdist, nth_percentile == 100),
|
| 35 |
+
aes(x = layer, label = quant_cfg),
|
| 36 |
+
angle = 90,
|
| 37 |
+
vjust = 0.20,
|
| 38 |
+
position = position_stack(vjust = 0.5),
|
| 39 |
+
colour = "white",
|
| 40 |
+
size = 2
|
| 41 |
+
)
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
if (show_legend) {
|
| 45 |
+
bar_plot <- bar_plot +
|
| 46 |
+
theme(
|
| 47 |
+
legend.position = "bottom",
|
| 48 |
+
legend.text = element_text(size = 16),
|
| 49 |
+
legend.title = element_text(size = 16)
|
| 50 |
+
) +
|
| 51 |
+
# coord_flip() +
|
| 52 |
+
scale_color_solarized()
|
| 53 |
+
} else {
|
| 54 |
+
bar_plot <- bar_plot +
|
| 55 |
+
theme(legend.position = "none") +
|
| 56 |
+
scale_color_solarized()
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
# Combine the line and bar plot vertically
|
| 60 |
+
combined_plot <- line_plot / bar_plot + plot_layout(heights = c(1, 3))
|
| 61 |
+
return(combined_plot)
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
weight_grid_only <- function(
|
| 65 |
+
df_wdist, df_kurtosis, mod, show_legend = FALSE) {
|
| 66 |
+
return(weight_grid(df_wdist, df_kurtosis, mod, show_legend, show_cfg = FALSE))
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
plot_quant_cfg <- function(model_id, budget, attempt, cfg_csv_fp) {
|
| 70 |
+
df_cfg_all <- read_csv(cfg_csv_fp)
|
| 71 |
+
df_cfg <- df_cfg_all |>
|
| 72 |
+
filter(bit_budget == budget) |>
|
| 73 |
+
mutate(
|
| 74 |
+
quant_cfg = paste0("b", b1, "g", g1)
|
| 75 |
+
) |>
|
| 76 |
+
select(-c("b1", "g1", "b2", "g2", "bit_budget"))
|
| 77 |
+
|
| 78 |
+
percentiles <- c("0", "99", "99.9", "99.99", "100")
|
| 79 |
+
all_cols <- c("module", "layer", percentiles)
|
| 80 |
+
df_wdist <- df_all |>
|
| 81 |
+
mutate(
|
| 82 |
+
`0` = percentile_0,
|
| 83 |
+
`99` = percentile_99 - percentile_0,
|
| 84 |
+
`99.9` = percentile_999 - percentile_99,
|
| 85 |
+
`99.99` = percentile_9999 - percentile_999,
|
| 86 |
+
`100` = percentile_100 - percentile_9999,
|
| 87 |
+
) |>
|
| 88 |
+
select(all_of(all_cols)) |>
|
| 89 |
+
pivot_longer(
|
| 90 |
+
cols = percentiles,
|
| 91 |
+
names_to = "nth_percentile",
|
| 92 |
+
names_transform = list(nth_percentile = as.numeric),
|
| 93 |
+
values_to = "abs_val"
|
| 94 |
+
) |>
|
| 95 |
+
mutate(
|
| 96 |
+
nth_percentile = factor(nth_percentile, levels = rev(percentiles))
|
| 97 |
+
) |>
|
| 98 |
+
left_join(df_module_param_count, by = c("module")) |>
|
| 99 |
+
left_join(df_cfg, by = c("module", "layer"))
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
k_cols <- c("module", "layer", "kurtosis")
|
| 103 |
+
df_kurtosis <- df_all |>
|
| 104 |
+
select(all_of(k_cols))
|
| 105 |
+
|
| 106 |
+
p1 <- weight_grid(df_wdist, df_kurtosis, "input_layernorm")
|
| 107 |
+
p2 <- weight_grid(df_wdist, df_kurtosis, "mlp.down_proj")
|
| 108 |
+
p3 <- weight_grid(df_wdist, df_kurtosis, "mlp.gate_proj")
|
| 109 |
+
p4 <- weight_grid(df_wdist, df_kurtosis, "mlp.up_proj")
|
| 110 |
+
p5 <- weight_grid(df_wdist, df_kurtosis, "post_attention_layernorm")
|
| 111 |
+
p6 <- weight_grid(df_wdist, df_kurtosis, "self_attn.k_proj")
|
| 112 |
+
p7 <- weight_grid(df_wdist, df_kurtosis, "self_attn.o_proj")
|
| 113 |
+
p8 <- weight_grid(df_wdist, df_kurtosis, "self_attn.q_proj", TRUE)
|
| 114 |
+
p9 <- weight_grid(df_wdist, df_kurtosis, "self_attn.v_proj")
|
| 115 |
+
|
| 116 |
+
# Create a 3x3 grid of combined plots
|
| 117 |
+
final_plot <- (p1 | p2 | p3) / (p4 | p5 | p6) / (p7 | p8 | p9)
|
| 118 |
+
ggsave(
|
| 119 |
+
paste0("pdfs/", model_id, "-mxq-cfgs-from-model-", attempt, ".pdf"),
|
| 120 |
+
width = 16,
|
| 121 |
+
height = 9
|
| 122 |
+
)
|
| 123 |
+
return(final_plot)
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
plot_wdist <- function(model_id, budget, cfg_csv_fp) {
|
| 127 |
+
df_cfg_all <- read_csv(cfg_csv_fp)
|
| 128 |
+
df_cfg <- df_cfg_all |>
|
| 129 |
+
filter(bit_budget == budget) |>
|
| 130 |
+
mutate(
|
| 131 |
+
quant_cfg = paste0("b", b1, "g", g1)
|
| 132 |
+
) |>
|
| 133 |
+
select(-c("b1", "g1", "b2", "g2", "bit_budget"))
|
| 134 |
+
|
| 135 |
+
percentiles <- c("0", "99", "99.9", "99.99", "100")
|
| 136 |
+
all_cols <- c("module", "layer", percentiles)
|
| 137 |
+
df_wdist <- df_all |>
|
| 138 |
+
mutate(
|
| 139 |
+
`0` = percentile_0,
|
| 140 |
+
`99` = percentile_99 - percentile_0,
|
| 141 |
+
`99.9` = percentile_999 - percentile_99,
|
| 142 |
+
`99.99` = percentile_9999 - percentile_999,
|
| 143 |
+
`100` = percentile_100 - percentile_9999,
|
| 144 |
+
) |>
|
| 145 |
+
select(all_of(all_cols)) |>
|
| 146 |
+
pivot_longer(
|
| 147 |
+
cols = percentiles,
|
| 148 |
+
names_to = "nth_percentile",
|
| 149 |
+
names_transform = list(nth_percentile = as.numeric),
|
| 150 |
+
values_to = "abs_val"
|
| 151 |
+
) |>
|
| 152 |
+
mutate(
|
| 153 |
+
nth_percentile = factor(nth_percentile, levels = rev(percentiles))
|
| 154 |
+
) |>
|
| 155 |
+
left_join(df_module_param_count, by = c("module")) |>
|
| 156 |
+
left_join(df_cfg, by = c("module", "layer"))
|
| 157 |
+
|
| 158 |
+
|
| 159 |
+
k_cols <- c("module", "layer", "kurtosis")
|
| 160 |
+
df_kurtosis <- df_all |>
|
| 161 |
+
select(all_of(k_cols))
|
| 162 |
+
|
| 163 |
+
p1 <- weight_grid_only(df_wdist, df_kurtosis, "input_layernorm")
|
| 164 |
+
p2 <- weight_grid_only(df_wdist, df_kurtosis, "mlp.down_proj")
|
| 165 |
+
p3 <- weight_grid_only(df_wdist, df_kurtosis, "mlp.gate_proj")
|
| 166 |
+
p4 <- weight_grid_only(df_wdist, df_kurtosis, "mlp.up_proj")
|
| 167 |
+
p5 <- weight_grid_only(df_wdist, df_kurtosis, "post_attention_layernorm")
|
| 168 |
+
p6 <- weight_grid_only(df_wdist, df_kurtosis, "self_attn.k_proj")
|
| 169 |
+
p7 <- weight_grid_only(df_wdist, df_kurtosis, "self_attn.o_proj")
|
| 170 |
+
p8 <- weight_grid_only(df_wdist, df_kurtosis, "self_attn.q_proj", TRUE)
|
| 171 |
+
p9 <- weight_grid_only(df_wdist, df_kurtosis, "self_attn.v_proj")
|
| 172 |
+
|
| 173 |
+
# Create a 3x3 grid of combined plots
|
| 174 |
+
final_plot <- (p1 | p2 | p3) / (p4 | p5 | p6) / (p7 | p8 | p9)
|
| 175 |
+
ggsave(
|
| 176 |
+
paste0("pdfs/", model_id, "-wdist-kurtosis.pdf"),
|
| 177 |
+
width = 16, height = 9
|
| 178 |
+
)
|
| 179 |
+
return(final_plot)
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
model_id <- "Llama-2-13b-hf"
|
| 184 |
+
df_all <- read_csv(paste0("data/wdist/wdist-", model_id, ".csv"))
|
| 185 |
+
df_module_param_count <- df_all |>
|
| 186 |
+
select(
|
| 187 |
+
module, param_count
|
| 188 |
+
) |>
|
| 189 |
+
group_by(module) |>
|
| 190 |
+
summarise(
|
| 191 |
+
param_count = sum(param_count)
|
| 192 |
+
) |>
|
| 193 |
+
mutate(
|
| 194 |
+
mod_disp = paste0(module, "(", formatC(param_count, big.mark = ","), ")")
|
| 195 |
+
)
|
| 196 |
+
|
| 197 |
+
budget <- 4.51
|
| 198 |
+
attempt <- "MXQ1"
|
| 199 |
+
cfg_csv_fp <- "data/llama-mxq-cfgs.csv"
|
| 200 |
+
plot_quant_cfg(model_id, budget, attempt, cfg_csv_fp)
|
| 201 |
+
|
| 202 |
+
attempt <- "kurt-global"
|
| 203 |
+
cfg_csv_fp <- "data/kurt/global/llama-mxq-cfgs.csv"
|
| 204 |
+
plot_quant_cfg(model_id, budget, attempt, cfg_csv_fp)
|
| 205 |
+
|
| 206 |
+
attempt <- "kurt-scaled"
|
| 207 |
+
cfg_csv_fp <- "data/kurt/scaled/llama-mxq-cfgs.csv"
|
| 208 |
+
plot_quant_cfg(model_id, budget, attempt, cfg_csv_fp)
|
lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/archived/plot-quant-cfg-diff.R
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
library(tidyverse)
|
| 2 |
+
library(readr)
|
| 3 |
+
library(ggthemes)
|
| 4 |
+
library(ggplot2)
|
| 5 |
+
library(patchwork)
|
| 6 |
+
library(plotly)
|
| 7 |
+
|
| 8 |
+
weight_grid <- function(
|
| 9 |
+
df_wdist, df_kurtosis, mod, show_legend = FALSE, show_cfg = TRUE) {
|
| 10 |
+
df_mod_wdist <- df_wdist |> filter(module == mod)
|
| 11 |
+
df_mod_kurt <- df_kurtosis |> filter(module == mod)
|
| 12 |
+
# Line plot (on top)
|
| 13 |
+
line_plot <- ggplot(df_mod_kurt, aes(x = layer, y = kurtosis)) +
|
| 14 |
+
geom_line(color = "blue") +
|
| 15 |
+
theme_gray(base_size = 14) +
|
| 16 |
+
theme_minimal() +
|
| 17 |
+
theme(
|
| 18 |
+
axis.title.x = element_blank(),
|
| 19 |
+
axis.text.x = element_blank()
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
+
# Bar plot (on bottom)
|
| 23 |
+
df_mod_wdist1 <- df_mod_wdist |> filter(attempt == "PCT5")
|
| 24 |
+
bar_plot1 <- ggplot(
|
| 25 |
+
df_mod_wdist1,
|
| 26 |
+
aes(x = layer, y = abs_val, fill = nth_percentile)
|
| 27 |
+
) +
|
| 28 |
+
geom_bar(stat = "identity", color = "gray50") +
|
| 29 |
+
theme_gray(base_size = 14) +
|
| 30 |
+
labs(
|
| 31 |
+
x = df_mod_wdist1$mod_disp[1],
|
| 32 |
+
y = "Absolute Value",
|
| 33 |
+
fill = "nth percentile"
|
| 34 |
+
) +
|
| 35 |
+
geom_text(
|
| 36 |
+
data = subset(df_mod_wdist1, nth_percentile == 100),
|
| 37 |
+
aes(x = layer, label = quant_cfg),
|
| 38 |
+
angle = 90,
|
| 39 |
+
vjust = 0.20,
|
| 40 |
+
position = position_stack(vjust = 0.5),
|
| 41 |
+
colour = "white",
|
| 42 |
+
size = 2
|
| 43 |
+
) +
|
| 44 |
+
theme(legend.position = "none") +
|
| 45 |
+
scale_color_solarized()
|
| 46 |
+
|
| 47 |
+
df_mod_wdist2 <- df_mod_wdist |> filter(attempt == "PCT6")
|
| 48 |
+
bar_plot2 <- ggplot(
|
| 49 |
+
df_mod_wdist2,
|
| 50 |
+
aes(x = layer, y = abs_val, fill = nth_percentile)
|
| 51 |
+
) +
|
| 52 |
+
geom_bar(stat = "identity", color = "gray50") +
|
| 53 |
+
theme_gray(base_size = 14) +
|
| 54 |
+
labs(
|
| 55 |
+
x = df_mod_wdist2$mod_disp[1],
|
| 56 |
+
y = "Absolute Value",
|
| 57 |
+
fill = "nth percentile"
|
| 58 |
+
) +
|
| 59 |
+
geom_text(
|
| 60 |
+
data = subset(df_mod_wdist2, nth_percentile == 100),
|
| 61 |
+
aes(x = layer, label = quant_cfg),
|
| 62 |
+
angle = 90,
|
| 63 |
+
vjust = 0.20,
|
| 64 |
+
position = position_stack(vjust = 0.5),
|
| 65 |
+
colour = "white",
|
| 66 |
+
size = 2
|
| 67 |
+
) +
|
| 68 |
+
theme(legend.position = "none") +
|
| 69 |
+
scale_color_solarized()
|
| 70 |
+
|
| 71 |
+
df_mod_wdist3 <- df_mod_wdist |> filter(attempt == "kurt-scaled")
|
| 72 |
+
bar_plot3 <- ggplot(
|
| 73 |
+
df_mod_wdist3,
|
| 74 |
+
aes(x = layer, y = abs_val, fill = nth_percentile)
|
| 75 |
+
) +
|
| 76 |
+
geom_bar(stat = "identity", color = "gray50") +
|
| 77 |
+
theme_gray(base_size = 14) +
|
| 78 |
+
labs(
|
| 79 |
+
x = df_mod_wdist3$mod_disp[1],
|
| 80 |
+
y = "Absolute Value",
|
| 81 |
+
fill = "nth percentile"
|
| 82 |
+
) +
|
| 83 |
+
geom_text(
|
| 84 |
+
data = subset(df_mod_wdist3, nth_percentile == 100),
|
| 85 |
+
aes(x = layer, label = quant_cfg),
|
| 86 |
+
angle = 90,
|
| 87 |
+
vjust = 0.20,
|
| 88 |
+
position = position_stack(vjust = 0.5),
|
| 89 |
+
colour = "white",
|
| 90 |
+
size = 2
|
| 91 |
+
)
|
| 92 |
+
if (show_legend) {
|
| 93 |
+
bar_plot3 <- bar_plot3 +
|
| 94 |
+
theme(
|
| 95 |
+
legend.position = "bottom",
|
| 96 |
+
legend.text = element_text(size = 16),
|
| 97 |
+
legend.title = element_text(size = 16)
|
| 98 |
+
) +
|
| 99 |
+
# coord_flip() +
|
| 100 |
+
scale_color_solarized()
|
| 101 |
+
} else {
|
| 102 |
+
bar_plot3 <- bar_plot3 +
|
| 103 |
+
theme(legend.position = "none") +
|
| 104 |
+
scale_color_solarized()
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
# Combine the line and bar plot vertically
|
| 108 |
+
combined_plot <- line_plot / bar_plot1 / bar_plot2 / bar_plot3 + plot_layout(heights = c(1, 3, 3, 3))
|
| 109 |
+
return(combined_plot)
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
weight_grid_only <- function(
|
| 113 |
+
df_wdist, df_kurtosis, mod, show_legend = FALSE) {
|
| 114 |
+
return(weight_grid(df_wdist, df_kurtosis, mod, show_legend, show_cfg = FALSE))
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
budget <- 4.51
|
| 118 |
+
model_id <- "Llama-2-13b-hf"
|
| 119 |
+
df_cfg1 <- read_csv("data/mxq-quant-cfgs-mxq1-5pct-tol.csv")
|
| 120 |
+
df_cfg2 <- read_csv("data/mxq-quant-cfgs-kurt-scaled-6pct-tol.csv")
|
| 121 |
+
df_cfg3 <- read_csv("data/kurt/scaled/llama-mxq-cfgs.csv")
|
| 122 |
+
df_cfg1$attempt <- "PCT5"
|
| 123 |
+
df_cfg2$attempt <- "PCT6"
|
| 124 |
+
df_cfg3$attempt <- "kurt-scaled"
|
| 125 |
+
df_cfg <- bind_rows(df_cfg1, df_cfg2, df_cfg3)
|
| 126 |
+
|
| 127 |
+
df_cfg_1 <- df_cfg |>
|
| 128 |
+
filter(bit_budget == budget & model == model_id) |>
|
| 129 |
+
mutate(
|
| 130 |
+
quant_cfg = paste0("b", b1, "g", g1)
|
| 131 |
+
) |>
|
| 132 |
+
select(-c("b1", "g1", "b2", "g2", "bit_budget"))
|
| 133 |
+
|
| 134 |
+
df_all <- read_csv(paste0("data/wdist/wdist-", model_id, ".csv"))
|
| 135 |
+
percentiles <- c("0", "99", "99.9", "99.99", "100")
|
| 136 |
+
df_module_param_count <- df_all |>
|
| 137 |
+
select(
|
| 138 |
+
module, param_count
|
| 139 |
+
) |>
|
| 140 |
+
group_by(module) |>
|
| 141 |
+
summarise(
|
| 142 |
+
param_count = sum(param_count)
|
| 143 |
+
) |>
|
| 144 |
+
mutate(
|
| 145 |
+
mod_disp = paste0(module, "(", formatC(param_count, big.mark = ","), ")")
|
| 146 |
+
)
|
| 147 |
+
|
| 148 |
+
df_cfg_1 <- df_cfg_1 |>
|
| 149 |
+
left_join(df_module_param_count, by = c("module")) |>
|
| 150 |
+
mutate(
|
| 151 |
+
mod_disp = paste0(attempt, " ", mod_disp)
|
| 152 |
+
)
|
| 153 |
+
|
| 154 |
+
all_cols <- c("module", "layer", percentiles)
|
| 155 |
+
df_wdist <- df_all |>
|
| 156 |
+
mutate(
|
| 157 |
+
`0` = percentile_0,
|
| 158 |
+
`99` = percentile_99 - percentile_0,
|
| 159 |
+
`99.9` = percentile_999 - percentile_99,
|
| 160 |
+
`99.99` = percentile_9999 - percentile_999,
|
| 161 |
+
`100` = percentile_100 - percentile_9999,
|
| 162 |
+
) |>
|
| 163 |
+
select(all_of(all_cols)) |>
|
| 164 |
+
pivot_longer(
|
| 165 |
+
cols = percentiles,
|
| 166 |
+
names_to = "nth_percentile",
|
| 167 |
+
names_transform = list(nth_percentile = as.numeric),
|
| 168 |
+
values_to = "abs_val"
|
| 169 |
+
) |>
|
| 170 |
+
mutate(
|
| 171 |
+
nth_percentile = factor(nth_percentile, levels = rev(percentiles))
|
| 172 |
+
) |>
|
| 173 |
+
filter(!grepl("_layernorm", module)) |>
|
| 174 |
+
left_join(df_cfg_1, by = c("module", "layer"), relationship = "many-to-many")
|
| 175 |
+
|
| 176 |
+
|
| 177 |
+
k_cols <- c("module", "layer", "kurtosis")
|
| 178 |
+
df_kurtosis <- df_all |>
|
| 179 |
+
select(all_of(k_cols))
|
| 180 |
+
|
| 181 |
+
p1 <- weight_grid(df_wdist, df_kurtosis, "mlp.down_proj")
|
| 182 |
+
p2 <- weight_grid(df_wdist, df_kurtosis, "mlp.gate_proj")
|
| 183 |
+
p3 <- weight_grid(df_wdist, df_kurtosis, "mlp.up_proj")
|
| 184 |
+
p4 <- weight_grid(df_wdist, df_kurtosis, "self_attn.k_proj")
|
| 185 |
+
p5 <- weight_grid(df_wdist, df_kurtosis, "self_attn.o_proj")
|
| 186 |
+
p6 <- weight_grid(df_wdist, df_kurtosis, "self_attn.q_proj", TRUE)
|
| 187 |
+
p7 <- weight_grid(df_wdist, df_kurtosis, "self_attn.v_proj")
|
| 188 |
+
|
| 189 |
+
final_plot1 <- (p1 | p2)
|
| 190 |
+
final_plot1
|
| 191 |
+
ggsave(
|
| 192 |
+
paste0("pdfs/", model_id, "-mxq-cfgs-from-model1.pdf"),
|
| 193 |
+
plot = final_plot1, width = 16, height = 9
|
| 194 |
+
)
|
| 195 |
+
|
| 196 |
+
final_plot2 <- (p3 | p3)
|
| 197 |
+
final_plot2
|
| 198 |
+
ggsave(
|
| 199 |
+
paste0("pdfs/", model_id, "-mxq-cfgs-from-model2.pdf"),
|
| 200 |
+
plot = final_plot2, width = 11, height = 6
|
| 201 |
+
)
|
| 202 |
+
|
| 203 |
+
final_plot3 <- (p4 | p5)
|
| 204 |
+
final_plot3
|
| 205 |
+
ggsave(
|
| 206 |
+
paste0("pdfs/", model_id, "-mxq-cfgs-from-model3.pdf"),
|
| 207 |
+
plot = final_plot3, width = 11, height = 6
|
| 208 |
+
)
|
| 209 |
+
|
| 210 |
+
final_plot4 <- (p6 | p7)
|
| 211 |
+
final_plot4
|
| 212 |
+
ggsave(
|
| 213 |
+
paste0("pdfs/", model_id, "-mxq-cfgs-from-model4.pdf"),
|
| 214 |
+
plot = final_plot4, width = 11, height = 6
|
| 215 |
+
)
|
lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/archived/plot-quantiles-laplacian.R
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
library(ggplot2)
|
| 2 |
+
library(dplyr)
|
| 3 |
+
|
| 4 |
+
# Create Laplace distribution function
|
| 5 |
+
dlaplace <- function(x, mu = 0, b = 1) {
|
| 6 |
+
1/(2*b) * exp(-abs(x - mu)/b)
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
# Generate data points
|
| 10 |
+
x <- seq(-4, 4, length.out = 1000)
|
| 11 |
+
y <- dlaplace(x)
|
| 12 |
+
df <- data.frame(x = x, y = y)
|
| 13 |
+
|
| 14 |
+
# Calculate quantiles using the Laplace quantile function
|
| 15 |
+
plaplace <- function(p, mu = 0, b = 1) {
|
| 16 |
+
mu - b * sign(p - 0.5) * log(1 - 2 * abs(p - 0.5))
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
# Calculate quantiles
|
| 20 |
+
probs <- seq(0.05, 0.95, length.out = 15)
|
| 21 |
+
quantiles <- c(-20, sapply(probs, plaplace), 20)
|
| 22 |
+
|
| 23 |
+
# Create data frame for the clipped vertical lines
|
| 24 |
+
line_data <- data.frame()
|
| 25 |
+
for(q in quantiles[2:(length(quantiles)-1)]) { # Skip the ±20 points
|
| 26 |
+
y_at_q <- dlaplace(q)
|
| 27 |
+
line_data <- rbind(line_data,
|
| 28 |
+
data.frame(x = q,
|
| 29 |
+
y_start = 0,
|
| 30 |
+
y_end = y_at_q))
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
# Create data for filled intervals
|
| 34 |
+
interval_data <- data.frame()
|
| 35 |
+
for(i in 1:(length(quantiles)-1)) {
|
| 36 |
+
x_seq <- seq(max(-4, quantiles[i]),
|
| 37 |
+
min(4, quantiles[i+1]),
|
| 38 |
+
length.out = 100)
|
| 39 |
+
interval_data <- rbind(interval_data,
|
| 40 |
+
data.frame(
|
| 41 |
+
x = x_seq,
|
| 42 |
+
y = dlaplace(x_seq),
|
| 43 |
+
group = i
|
| 44 |
+
))
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
# Create the plot
|
| 48 |
+
ggplot() +
|
| 49 |
+
# Add filled intervals
|
| 50 |
+
geom_ribbon(data = interval_data,
|
| 51 |
+
aes(x = x, ymin = 0, ymax = y, group = group),
|
| 52 |
+
fill = "lightblue",
|
| 53 |
+
alpha = 0.3) +
|
| 54 |
+
# Add the distribution curve
|
| 55 |
+
geom_line(data = df, aes(x = x, y = y),
|
| 56 |
+
color = "blue", size = 1) +
|
| 57 |
+
# Add thin solid blue vertical lines for quantiles
|
| 58 |
+
geom_segment(data = line_data,
|
| 59 |
+
aes(x = x, xend = x,
|
| 60 |
+
y = y_start, yend = y_end),
|
| 61 |
+
color = "blue",
|
| 62 |
+
linetype = "solid",
|
| 63 |
+
size = 0.3,
|
| 64 |
+
alpha = 0.7) +
|
| 65 |
+
# Add quantile labels
|
| 66 |
+
geom_text(data = data.frame(
|
| 67 |
+
x = quantiles[2:(length(quantiles)-1)], # Skip the ±20 points
|
| 68 |
+
y = rep(-0.02, 15),
|
| 69 |
+
label = paste0("Q", 1:15)
|
| 70 |
+
),
|
| 71 |
+
aes(x = x, y = y, label = label),
|
| 72 |
+
angle = 45,
|
| 73 |
+
vjust = 1,
|
| 74 |
+
size = 3) +
|
| 75 |
+
# Add infinity labels
|
| 76 |
+
geom_text(data = data.frame(
|
| 77 |
+
x = c(-4, 4),
|
| 78 |
+
y = rep(-0.02, 2),
|
| 79 |
+
label = c("Q0 (-∞)", "Q16 (+∞)")
|
| 80 |
+
),
|
| 81 |
+
aes(x = x, y = y, label = label),
|
| 82 |
+
angle = 45,
|
| 83 |
+
vjust = 1,
|
| 84 |
+
size = 3) +
|
| 85 |
+
# Customize the theme and labels
|
| 86 |
+
theme_minimal() +
|
| 87 |
+
labs(
|
| 88 |
+
title = "Laplace Distribution with 17 Quantiles",
|
| 89 |
+
subtitle = "μ = 0, b = 1",
|
| 90 |
+
x = "x",
|
| 91 |
+
y = "Density"
|
| 92 |
+
) +
|
| 93 |
+
# Set the axis limits
|
| 94 |
+
scale_x_continuous(limits = c(-4, 4)) +
|
| 95 |
+
ylim(-0.05, 0.55) +
|
| 96 |
+
# Add theme customizations
|
| 97 |
+
theme(
|
| 98 |
+
plot.title = element_text(hjust = 0.5),
|
| 99 |
+
plot.subtitle = element_text(hjust = 0.5),
|
| 100 |
+
panel.grid.minor = element_blank()
|
| 101 |
+
)
|
lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/check-lowbits-allot.R
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env Rscript
|
| 2 |
+
|
| 3 |
+
library(tidyverse)
|
| 4 |
+
library(plyr)
|
| 5 |
+
library(dplyr)
|
| 6 |
+
library(readr)
|
| 7 |
+
library(optparse)
|
| 8 |
+
library(openxlsx)
|
| 9 |
+
|
| 10 |
+
budget_to_cfg <- function(budget) {
|
| 11 |
+
if (budget == 3.13) {
|
| 12 |
+
return("b3g128")
|
| 13 |
+
} else if (budget == 3.25) {
|
| 14 |
+
return("b3g64")
|
| 15 |
+
} else if (budget == 3.51) {
|
| 16 |
+
return("b3g32")
|
| 17 |
+
} else if (budget == 4.13) {
|
| 18 |
+
return("b4g128")
|
| 19 |
+
} else if (budget == 4.25) {
|
| 20 |
+
return("b4g64")
|
| 21 |
+
} else if (budget == 4.51) {
|
| 22 |
+
return("b4g32")
|
| 23 |
+
} else if (budget == 8.13) {
|
| 24 |
+
return("b8g128")
|
| 25 |
+
} else if (budget == 8.25) {
|
| 26 |
+
return("b8g64")
|
| 27 |
+
} else if (budget == 8.51) {
|
| 28 |
+
return("b8g32")
|
| 29 |
+
} else if (budget == 2.13) {
|
| 30 |
+
return("b2g128")
|
| 31 |
+
} else if (budget == 2.25) {
|
| 32 |
+
return("b2g64")
|
| 33 |
+
} else if (budget == 2.51) {
|
| 34 |
+
return("b2g32")
|
| 35 |
+
} else {
|
| 36 |
+
return("b4g64")
|
| 37 |
+
}
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
strip_name <- function(name) {
|
| 41 |
+
start <- nchar("fnorm-") + 1
|
| 42 |
+
stop <- nchar(name) - 4
|
| 43 |
+
return(substr(name, start, stop))
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
parser <- OptionParser()
|
| 47 |
+
parser <- add_option(
|
| 48 |
+
parser, c("-f", "--factor"),
|
| 49 |
+
type = "double",
|
| 50 |
+
help = "Factor to apply",
|
| 51 |
+
metavar = "double"
|
| 52 |
+
)
|
| 53 |
+
parser <- add_option(
|
| 54 |
+
parser, c("-c", "--milp_cost_csv"),
|
| 55 |
+
type = "character",
|
| 56 |
+
help = "Dump of MiLP cost csv from the HQQ",
|
| 57 |
+
metavar = "character"
|
| 58 |
+
)
|
| 59 |
+
parser <- add_option(
|
| 60 |
+
parser, c("-a", "--allot_csv_file"),
|
| 61 |
+
type = "character",
|
| 62 |
+
help = "Allocation CSV file",
|
| 63 |
+
metavar = "character"
|
| 64 |
+
)
|
| 65 |
+
parser <- add_option(
|
| 66 |
+
parser, c("--attempt"),
|
| 67 |
+
type = "character",
|
| 68 |
+
help = "attempt",
|
| 69 |
+
metavar = "character"
|
| 70 |
+
)
|
| 71 |
+
|
| 72 |
+
args <- parse_args(parser)
|
| 73 |
+
|
| 74 |
+
if (is.null(args$milp_cost_csv)) {
|
| 75 |
+
milp_cost_csv <- "debug.csv"
|
| 76 |
+
} else {
|
| 77 |
+
milp_cost_csv <- args$milp_cost_csv
|
| 78 |
+
}
|
| 79 |
+
if (is.null(args$attempt)) {
|
| 80 |
+
the_attempt <- "mxq1"
|
| 81 |
+
} else {
|
| 82 |
+
the_attempt <- args$attempt
|
| 83 |
+
}
|
| 84 |
+
if (is.null(args$allot_csv_file)) {
|
| 85 |
+
allot_csv_file <- paste0(
|
| 86 |
+
"data/allot/mxq/", the_attempt, "/quant-allot-", the_attempt, ".csv"
|
| 87 |
+
)
|
| 88 |
+
} else {
|
| 89 |
+
allot_csv_file <- args$allot_csv_file
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
df_fnorm <- read_csv(milp_cost_csv)
|
| 93 |
+
|
| 94 |
+
k_cols <- c(
|
| 95 |
+
"module",
|
| 96 |
+
"layer",
|
| 97 |
+
"cfg",
|
| 98 |
+
"nbit1",
|
| 99 |
+
"gsize1",
|
| 100 |
+
"nbit2",
|
| 101 |
+
"gsize2",
|
| 102 |
+
"fnorm",
|
| 103 |
+
"memmb",
|
| 104 |
+
"params",
|
| 105 |
+
"sensitivity"
|
| 106 |
+
)
|
| 107 |
+
df_fnorm <- df_fnorm |>
|
| 108 |
+
mutate(
|
| 109 |
+
cfg = paste0("b", nbit1, "g", gsize1)
|
| 110 |
+
) |>
|
| 111 |
+
select(all_of(k_cols)) |>
|
| 112 |
+
mutate(
|
| 113 |
+
cfg = factor(
|
| 114 |
+
cfg,
|
| 115 |
+
levels = c(
|
| 116 |
+
"b2g128", "b2g64", "b2g32",
|
| 117 |
+
"b3g128", "b3g64", "b3g32",
|
| 118 |
+
"b4g128", "b4g64", "b4g32",
|
| 119 |
+
"b8g128", "b8g64", "b8g32"
|
| 120 |
+
)
|
| 121 |
+
)
|
| 122 |
+
)
|
| 123 |
+
|
| 124 |
+
by <- join_by(module == module, layer == layer, cfg == cfg)
|
| 125 |
+
df_cfgs <- read_csv(allot_csv_file)
|
| 126 |
+
|
| 127 |
+
if ("attempt" %in% names(df_cfgs)) {
|
| 128 |
+
df_cfgs <- df_cfgs |>
|
| 129 |
+
filter(attempt == the_attempt)
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
df_check <- df_cfgs |>
|
| 133 |
+
mutate(
|
| 134 |
+
cfg = paste0("b", b1, "g", g1),
|
| 135 |
+
cfg_base = sapply(bit_budget, budget_to_cfg)
|
| 136 |
+
) |>
|
| 137 |
+
select(-c("b1", "g1", "b2", "g2", "memmb")) |>
|
| 138 |
+
mutate(
|
| 139 |
+
cfg = factor(
|
| 140 |
+
cfg,
|
| 141 |
+
levels = c(
|
| 142 |
+
"b2g128", "b2g64", "b2g32",
|
| 143 |
+
"b3g128", "b3g64", "b3g32",
|
| 144 |
+
"b4g128", "b4g64", "b4g32",
|
| 145 |
+
"b8g128", "b8g64", "b8g32"
|
| 146 |
+
)
|
| 147 |
+
)
|
| 148 |
+
) |>
|
| 149 |
+
left_join(df_fnorm, by)
|
| 150 |
+
|
| 151 |
+
df_check_sum <- df_check |>
|
| 152 |
+
left_join(
|
| 153 |
+
df_fnorm,
|
| 154 |
+
suffix = c("", "_hqq"),
|
| 155 |
+
join_by(
|
| 156 |
+
module == module,
|
| 157 |
+
layer == layer,
|
| 158 |
+
cfg_base == cfg
|
| 159 |
+
)
|
| 160 |
+
)
|
| 161 |
+
df_check_det <- df_check_sum |>
|
| 162 |
+
select(
|
| 163 |
+
!c(
|
| 164 |
+
"param_cnt",
|
| 165 |
+
"params_quant_tot",
|
| 166 |
+
"params_hqq",
|
| 167 |
+
"sensitivity_hqq",
|
| 168 |
+
"nbit1",
|
| 169 |
+
"nbit2",
|
| 170 |
+
"gsize1",
|
| 171 |
+
"gsize2",
|
| 172 |
+
"nbit1_hqq",
|
| 173 |
+
"nbit2_hqq",
|
| 174 |
+
"gsize1_hqq",
|
| 175 |
+
"gsize2_hqq",
|
| 176 |
+
)
|
| 177 |
+
)
|
| 178 |
+
write.xlsx(
|
| 179 |
+
df_check_det,
|
| 180 |
+
"allot-check-det.xlsx",
|
| 181 |
+
overwrite = TRUE,
|
| 182 |
+
asTable = TRUE
|
| 183 |
+
)
|
| 184 |
+
|
| 185 |
+
df_final <- df_check_sum |>
|
| 186 |
+
group_by(cfg_base, bit_budget) |>
|
| 187 |
+
dplyr::summarise(
|
| 188 |
+
memmb = sum(memmb),
|
| 189 |
+
memmb_hqq = sum(memmb_hqq),
|
| 190 |
+
fnorm = sum(fnorm),
|
| 191 |
+
fnorm_hqq = sum(fnorm_hqq),
|
| 192 |
+
params_tot = sum(params)
|
| 193 |
+
) |>
|
| 194 |
+
mutate(
|
| 195 |
+
memmb = round(memmb, digits = 4),
|
| 196 |
+
memmb_hqq = round(memmb_hqq, digits = 4),
|
| 197 |
+
fnorm = round(fnorm, digits = 4),
|
| 198 |
+
fnorm_hqq = round(fnorm_hqq, digits = 4),
|
| 199 |
+
fnorm_imporved = fnorm < fnorm_hqq,
|
| 200 |
+
theory_memmb = params_tot * bit_budget / 8 / 1024^2,
|
| 201 |
+
mem_pct_of_hqq = round(100 * memmb / memmb_hqq, digits = 4),
|
| 202 |
+
mem_pct_of_theory = round(100 * memmb / theory_memmb, digits = 4)
|
| 203 |
+
) |>
|
| 204 |
+
select(
|
| 205 |
+
c(
|
| 206 |
+
"cfg_base",
|
| 207 |
+
"bit_budget",
|
| 208 |
+
"fnorm_hqq",
|
| 209 |
+
"fnorm",
|
| 210 |
+
"fnorm_imporved",
|
| 211 |
+
"memmb_hqq",
|
| 212 |
+
"memmb",
|
| 213 |
+
"mem_pct_of_hqq",
|
| 214 |
+
"mem_pct_of_theory"
|
| 215 |
+
)
|
| 216 |
+
)
|
| 217 |
+
|
| 218 |
+
write.xlsx(
|
| 219 |
+
df_final,
|
| 220 |
+
"df_final.xlsx",
|
| 221 |
+
overwrite = TRUE,
|
| 222 |
+
asTable = TRUE
|
| 223 |
+
)
|
lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/check-mem.R
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
library(ggplot2)
|
| 2 |
+
library(ggthemes)
|
| 3 |
+
library(openxlsx)
|
| 4 |
+
library(patchwork)
|
| 5 |
+
library(readr)
|
| 6 |
+
library(tidyverse)
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
df_mem <- read_csv("mxq-mem-bound-check.csv") |>
|
| 10 |
+
mutate(
|
| 11 |
+
memmb_delta = param_cnt * ((b1 + 2 * b2 / g1 + 32 / g1 / g2) - bit_budget) / 8 / 1024^2
|
| 12 |
+
) |>
|
| 13 |
+
relocate(memmb_delta, .before = memmb) |>
|
| 14 |
+
summarise(
|
| 15 |
+
delta_tot = sum(memmb_delta),
|
| 16 |
+
.by = c("model", "bit_budget", "attempt")
|
| 17 |
+
)
|
| 18 |
+
|
| 19 |
+
df_mem2 <- read_csv("mxq-mem-bound-check.csv") |>
|
| 20 |
+
summarise(
|
| 21 |
+
memmb_tot = sum(memmb),
|
| 22 |
+
param_quant_tot = sum(param_cnt),
|
| 23 |
+
.by = c("model", "bit_budget", "attempt")
|
| 24 |
+
) |>
|
| 25 |
+
mutate(
|
| 26 |
+
theory_mem = param_quant_tot * bit_budget / 8 / 1024^2,
|
| 27 |
+
within_bound = memmb_tot <= theory_mem
|
| 28 |
+
)
|
lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/check-mxq-allocation.R
ADDED
|
@@ -0,0 +1,260 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env Rscript
|
| 2 |
+
|
| 3 |
+
library(tidyverse)
|
| 4 |
+
library(plyr)
|
| 5 |
+
library(dplyr)
|
| 6 |
+
library(readr)
|
| 7 |
+
library(optparse)
|
| 8 |
+
library(openxlsx)
|
| 9 |
+
|
| 10 |
+
budget_to_cfg <- function(budget) {
|
| 11 |
+
if (budget == 3.13) {
|
| 12 |
+
return("b3g128")
|
| 13 |
+
} else if (budget == 3.25) {
|
| 14 |
+
return("b3g64")
|
| 15 |
+
} else if (budget == 3.51) {
|
| 16 |
+
return("b3g32")
|
| 17 |
+
} else if (budget == 4.13) {
|
| 18 |
+
return("b4g128")
|
| 19 |
+
} else if (budget == 4.25) {
|
| 20 |
+
return("b4g64")
|
| 21 |
+
} else if (budget == 4.51) {
|
| 22 |
+
return("b4g32")
|
| 23 |
+
} else if (budget == 8.13) {
|
| 24 |
+
return("b8g128")
|
| 25 |
+
} else if (budget == 8.25) {
|
| 26 |
+
return("b8g64")
|
| 27 |
+
} else if (budget == 8.51) {
|
| 28 |
+
return("b8g32")
|
| 29 |
+
} else if (budget == 2.13) {
|
| 30 |
+
return("b2g128")
|
| 31 |
+
} else if (budget == 2.25) {
|
| 32 |
+
return("b2g64")
|
| 33 |
+
} else if (budget == 2.51) {
|
| 34 |
+
return("b2g32")
|
| 35 |
+
} else {
|
| 36 |
+
return("b4g64")
|
| 37 |
+
}
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
strip_name <- function(name) {
|
| 41 |
+
start <- nchar("fnorm-") + 1
|
| 42 |
+
stop <- nchar(name) - 4
|
| 43 |
+
return(substr(name, start, stop))
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
parser <- OptionParser()
|
| 47 |
+
parser <- add_option(
|
| 48 |
+
parser, c("-f", "--factor"),
|
| 49 |
+
type = "double",
|
| 50 |
+
help = "Factor to apply",
|
| 51 |
+
metavar = "double"
|
| 52 |
+
)
|
| 53 |
+
parser <- add_option(
|
| 54 |
+
parser, c("-d", "--data_dir"),
|
| 55 |
+
type = "character",
|
| 56 |
+
help = "Data directory of fnorm csv files",
|
| 57 |
+
metavar = "character"
|
| 58 |
+
)
|
| 59 |
+
parser <- add_option(
|
| 60 |
+
parser, c("-a", "--allot_csv_file"),
|
| 61 |
+
type = "character",
|
| 62 |
+
help = "Allocation CSV file",
|
| 63 |
+
metavar = "character"
|
| 64 |
+
)
|
| 65 |
+
parser <- add_option(
|
| 66 |
+
parser, c("--attempt"),
|
| 67 |
+
type = "character",
|
| 68 |
+
help = "attempt",
|
| 69 |
+
metavar = "character"
|
| 70 |
+
)
|
| 71 |
+
|
| 72 |
+
args <- parse_args(parser)
|
| 73 |
+
|
| 74 |
+
if (is.null(args$data_dir)) {
|
| 75 |
+
fnorm_dir <- "../src/data"
|
| 76 |
+
} else {
|
| 77 |
+
fnorm_dir <- args$data_dir
|
| 78 |
+
}
|
| 79 |
+
if (is.null(args$factor)) {
|
| 80 |
+
factor <- 2.0
|
| 81 |
+
} else {
|
| 82 |
+
factor <- args$factor
|
| 83 |
+
}
|
| 84 |
+
if (is.null(args$allot_csv_file)) {
|
| 85 |
+
allot_csv_file <- "data/allot/mxq/mxq1/quant-cfg-allot-mxq1.csv"
|
| 86 |
+
} else {
|
| 87 |
+
allot_csv_file <- args$allot_csv_file
|
| 88 |
+
}
|
| 89 |
+
if (is.null(args$attempt)) {
|
| 90 |
+
the_attempt <- "mxq1"
|
| 91 |
+
} else {
|
| 92 |
+
the_attempt <- args$attempt
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
fnorm_dir <- path.expand(fnorm_dir)
|
| 96 |
+
fnorm_fps <- dir(
|
| 97 |
+
path = fnorm_dir,
|
| 98 |
+
pattern = "fnorm-.*\\.csv$",
|
| 99 |
+
full.names = TRUE
|
| 100 |
+
)
|
| 101 |
+
names(fnorm_fps) <- sapply((basename(fnorm_fps)), strip_name)
|
| 102 |
+
df_fnorm <- ldply(fnorm_fps, read.csv, stringsAsFactors = FALSE, .id = "model")
|
| 103 |
+
|
| 104 |
+
k_cols <- c(
|
| 105 |
+
"model",
|
| 106 |
+
"module",
|
| 107 |
+
"layer",
|
| 108 |
+
"cfg",
|
| 109 |
+
"nbit1",
|
| 110 |
+
"gsize1",
|
| 111 |
+
"nbit2",
|
| 112 |
+
"gsize2",
|
| 113 |
+
"fnorm",
|
| 114 |
+
"memmb",
|
| 115 |
+
"params",
|
| 116 |
+
"sensitivity",
|
| 117 |
+
"kurtosis"
|
| 118 |
+
)
|
| 119 |
+
df_fnorm <- df_fnorm |>
|
| 120 |
+
mutate(
|
| 121 |
+
cfg = paste0("b", nbit1, "g", gsize1)
|
| 122 |
+
) |>
|
| 123 |
+
select(all_of(k_cols)) |>
|
| 124 |
+
mutate(
|
| 125 |
+
cfg = factor(
|
| 126 |
+
cfg,
|
| 127 |
+
levels = c(
|
| 128 |
+
"b2g128", "b2g64", "b2g32",
|
| 129 |
+
"b3g128", "b3g64", "b3g32",
|
| 130 |
+
"b4g128", "b4g64", "b4g32",
|
| 131 |
+
"b8g128", "b8g64", "b8g32"
|
| 132 |
+
)
|
| 133 |
+
)
|
| 134 |
+
)
|
| 135 |
+
|
| 136 |
+
df_sd_mu <- df_fnorm |>
|
| 137 |
+
group_by(model) |>
|
| 138 |
+
dplyr::summarise(
|
| 139 |
+
sigma = sd(sensitivity),
|
| 140 |
+
mu = mean(sensitivity),
|
| 141 |
+
tot_params = sum(params),
|
| 142 |
+
)
|
| 143 |
+
|
| 144 |
+
df_kurt_scaled <- df_fnorm |>
|
| 145 |
+
group_by(model, module) |>
|
| 146 |
+
dplyr::summarise(
|
| 147 |
+
min_kurt = min(kurtosis),
|
| 148 |
+
max_kurt = max(kurtosis)
|
| 149 |
+
)
|
| 150 |
+
|
| 151 |
+
df_fnorm <- df_fnorm |>
|
| 152 |
+
left_join(df_sd_mu, by = c("model")) |>
|
| 153 |
+
mutate(
|
| 154 |
+
bpp = nbit1 + 2 * nbit2 / gsize1 + 32 / gsize1 / gsize2
|
| 155 |
+
) |>
|
| 156 |
+
mutate(
|
| 157 |
+
factor_sensi = ifelse((sensitivity - mu) / sigma > 3, factor, 1)
|
| 158 |
+
) |>
|
| 159 |
+
mutate(
|
| 160 |
+
cost_sensi = factor_sensi * 100 * 12 * (params / tot_params) / bpp
|
| 161 |
+
) |>
|
| 162 |
+
left_join(df_kurt_scaled, by = c("model", "module")) |>
|
| 163 |
+
mutate(
|
| 164 |
+
kurt_scaled = (kurtosis - min_kurt) / (max_kurt - min_kurt),
|
| 165 |
+
cost_kurt = kurt_scaled * 100 * 12 * (params / tot_params) / bpp
|
| 166 |
+
)
|
| 167 |
+
|
| 168 |
+
by <- join_by(model == model, module == module, layer == layer, cfg == cfg)
|
| 169 |
+
df_cfgs <- read_csv(allot_csv_file)
|
| 170 |
+
|
| 171 |
+
if ("attempt" %in% names(df_cfgs)) {
|
| 172 |
+
df_cfgs <- df_cfgs |>
|
| 173 |
+
filter(attempt == the_attempt)
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
df_check <- df_cfgs |>
|
| 177 |
+
mutate(
|
| 178 |
+
cfg = paste0("b", b1, "g", g1),
|
| 179 |
+
cfg_base = sapply(bit_budget, budget_to_cfg)
|
| 180 |
+
) |>
|
| 181 |
+
select(-c("b1", "g1", "b2", "g2", "memmb")) |>
|
| 182 |
+
mutate(
|
| 183 |
+
cfg = factor(
|
| 184 |
+
cfg,
|
| 185 |
+
levels = c(
|
| 186 |
+
"b2g128", "b2g64", "b2g32",
|
| 187 |
+
"b3g128", "b3g64", "b3g32",
|
| 188 |
+
"b4g128", "b4g64", "b4g32",
|
| 189 |
+
"b8g128", "b8g64", "b8g32"
|
| 190 |
+
)
|
| 191 |
+
)
|
| 192 |
+
) |>
|
| 193 |
+
left_join(df_fnorm, by)
|
| 194 |
+
|
| 195 |
+
df_check_sum <- df_check |>
|
| 196 |
+
left_join(
|
| 197 |
+
df_fnorm,
|
| 198 |
+
suffix = c("", "_base"),
|
| 199 |
+
join_by(
|
| 200 |
+
model == model,
|
| 201 |
+
module == module,
|
| 202 |
+
layer == layer,
|
| 203 |
+
cfg_base == cfg
|
| 204 |
+
)
|
| 205 |
+
) |>
|
| 206 |
+
group_by(model, cfg_base, bit_budget) |>
|
| 207 |
+
dplyr::summarise(
|
| 208 |
+
memmb = sum(memmb),
|
| 209 |
+
memmb_base = sum(memmb_base),
|
| 210 |
+
fnorm = sum(fnorm),
|
| 211 |
+
fnorm_base = sum(fnorm_base),
|
| 212 |
+
cost_sensi = sum(cost_sensi),
|
| 213 |
+
cost_kurt = sum(cost_kurt),
|
| 214 |
+
cost_sensi_base = sum(cost_sensi_base),
|
| 215 |
+
cost_kurt_base = sum(cost_kurt_base),
|
| 216 |
+
params_tot = sum(params)
|
| 217 |
+
) |>
|
| 218 |
+
mutate(
|
| 219 |
+
memmb = round(memmb, digits = 4),
|
| 220 |
+
memmb_base = round(memmb_base, digits = 4),
|
| 221 |
+
fnorm = round(fnorm, digits = 4),
|
| 222 |
+
fnorm_base = round(fnorm_base, digits = 4),
|
| 223 |
+
cost_sensi_base = round(cost_sensi_base, digits = 4),
|
| 224 |
+
cost_sensi = round(cost_sensi, digits = 4),
|
| 225 |
+
sensi_imporved = cost_sensi < cost_sensi_base,
|
| 226 |
+
cost_kurt = round(cost_kurt, digits = 4),
|
| 227 |
+
cost_kurt_base = round(cost_kurt_base, digits = 4),
|
| 228 |
+
kurt_imporved = cost_kurt < cost_kurt_base,
|
| 229 |
+
fnorm_imporved = fnorm < fnorm_base,
|
| 230 |
+
theory_memmb = params_tot * bit_budget / 8 / 1024^2,
|
| 231 |
+
mem_pct_of_base = round(100 * memmb / memmb_base, digits = 4),
|
| 232 |
+
mem_pct_of_theory = round(100 * memmb / theory_memmb, digits = 4)
|
| 233 |
+
) |>
|
| 234 |
+
select(
|
| 235 |
+
c(
|
| 236 |
+
"model",
|
| 237 |
+
"cfg_base",
|
| 238 |
+
"bit_budget",
|
| 239 |
+
"cost_sensi_base",
|
| 240 |
+
"cost_sensi",
|
| 241 |
+
"sensi_imporved",
|
| 242 |
+
"cost_kurt_base",
|
| 243 |
+
"cost_kurt",
|
| 244 |
+
"kurt_imporved",
|
| 245 |
+
"fnorm_base",
|
| 246 |
+
"fnorm",
|
| 247 |
+
"fnorm_imporved",
|
| 248 |
+
"memmb_base",
|
| 249 |
+
"memmb",
|
| 250 |
+
"mem_pct_of_base",
|
| 251 |
+
"mem_pct_of_theory"
|
| 252 |
+
)
|
| 253 |
+
)
|
| 254 |
+
|
| 255 |
+
write.xlsx(
|
| 256 |
+
df_check_sum,
|
| 257 |
+
"allot-check.xlsx",
|
| 258 |
+
overwrite = TRUE,
|
| 259 |
+
asTable = TRUE
|
| 260 |
+
)
|
lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/check-normality.R
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env Rscript
|
| 2 |
+
|
| 3 |
+
library(readr)
|
| 4 |
+
library(tidyverse)
|
| 5 |
+
library(nortest)
|
| 6 |
+
|
| 7 |
+
# Function to trim the 5% smallest and biggest values from a vector
|
| 8 |
+
trim_extreme_values <- function(x, trim_percent = 0.10) {
|
| 9 |
+
n <- length(x)
|
| 10 |
+
if (n <= 2) {
|
| 11 |
+
return(x)
|
| 12 |
+
} # Can't trim if there are too few values
|
| 13 |
+
|
| 14 |
+
# Calculate how many values to trim from each end
|
| 15 |
+
trim_count <- floor(n * trim_percent)
|
| 16 |
+
|
| 17 |
+
# If trim_count is 0 (due to small n), make it at least 1
|
| 18 |
+
trim_count <- max(trim_count, 1)
|
| 19 |
+
|
| 20 |
+
# Sort and trim
|
| 21 |
+
sorted_x <- sort(x)
|
| 22 |
+
trimmed_x <- sorted_x[(trim_count + 1):(n - trim_count)]
|
| 23 |
+
|
| 24 |
+
return(trimmed_x)
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
models <- c("Llama-2-7b-hf", "Meta-Llama-3-8B", "Llama-2-13b-hf")
|
| 29 |
+
for (model in models) {
|
| 30 |
+
df_fnorm <- read_csv(
|
| 31 |
+
paste0("~/work/llm-quant/lm-quant-toolkit/src/data/fnorm-", model, ".csv")
|
| 32 |
+
)
|
| 33 |
+
|
| 34 |
+
# Calculate the difference in kurtosis between adjacent layers for each module
|
| 35 |
+
df_diff <- df_fnorm |>
|
| 36 |
+
group_by(module, layer) |>
|
| 37 |
+
summarise(
|
| 38 |
+
sensi_score = min(sensitivity),
|
| 39 |
+
kurt_score = min(kurtosis)
|
| 40 |
+
) |>
|
| 41 |
+
group_by(module) |>
|
| 42 |
+
arrange(module, layer) |>
|
| 43 |
+
mutate(
|
| 44 |
+
kurt_diff = kurt_score - lag(kurt_score),
|
| 45 |
+
sensi_diff = sensi_score / lag(sensi_score)
|
| 46 |
+
) |>
|
| 47 |
+
filter(!is.na(kurt_diff)) |>
|
| 48 |
+
filter(!is.na(sensi_diff))
|
| 49 |
+
|
| 50 |
+
kurt_trim_pct <- 0.10
|
| 51 |
+
sensi_trim_pct <- 0.20
|
| 52 |
+
# Apply trimming for each module and perform Shapiro-Wilk test
|
| 53 |
+
trimmed_results <- df_diff |>
|
| 54 |
+
group_by(module) |>
|
| 55 |
+
summarize(
|
| 56 |
+
|
| 57 |
+
# Create a trimmed version of kurt_diff
|
| 58 |
+
kurt_diff_trimmed = list(
|
| 59 |
+
trim_extreme_values(kurt_diff, trim_percent = kurt_trim_pct)
|
| 60 |
+
),
|
| 61 |
+
kurt_n_trimmed = sapply(kurt_diff_trimmed, length),
|
| 62 |
+
|
| 63 |
+
# For Shapiro-Wilk test on trimmed data
|
| 64 |
+
kurt_shapiro_stat = sapply(kurt_diff_trimmed, function(x) {
|
| 65 |
+
if (length(x) >= 3) shapiro.test(x)$statistic else NA
|
| 66 |
+
}),
|
| 67 |
+
kurt_shapiro_p = sapply(kurt_diff_trimmed, function(x) {
|
| 68 |
+
if (length(x) >= 3) shapiro.test(x)$p.value else NA
|
| 69 |
+
}),
|
| 70 |
+
kurt_normal = sapply(kurt_diff_trimmed, function(x) {
|
| 71 |
+
if (length(x) >= 3) shapiro.test(x)$p.value > 0.05 else NA
|
| 72 |
+
}),
|
| 73 |
+
|
| 74 |
+
# Create a trimmed version of sensi_diff
|
| 75 |
+
sensi_diff_trimmed = list(
|
| 76 |
+
trim_extreme_values(sensi_diff, trim_percent = sensi_trim_pct)
|
| 77 |
+
),
|
| 78 |
+
sensi_n_trimmed = sapply(sensi_diff_trimmed, length),
|
| 79 |
+
|
| 80 |
+
# For Shapiro-Wilk test on trimmed data
|
| 81 |
+
sensi_shapiro_stat = sapply(sensi_diff_trimmed, function(x) {
|
| 82 |
+
if (length(x) >= 3) shapiro.test(x)$statistic else NA
|
| 83 |
+
}),
|
| 84 |
+
sensi_shapiro_p = sapply(sensi_diff_trimmed, function(x) {
|
| 85 |
+
if (length(x) >= 3) shapiro.test(x)$p.value else NA
|
| 86 |
+
}),
|
| 87 |
+
sensi_normal = sapply(sensi_diff_trimmed, function(x) {
|
| 88 |
+
if (length(x) >= 3) shapiro.test(x)$p.value > 0.05 else NA
|
| 89 |
+
}),
|
| 90 |
+
)
|
| 91 |
+
|
| 92 |
+
# Create QQ plots for each module using the trimmed data
|
| 93 |
+
# Unpack the trimmed data for plotting
|
| 94 |
+
df_plot_trimmed_kurt <- df_diff |>
|
| 95 |
+
group_by(module) |>
|
| 96 |
+
do({
|
| 97 |
+
kurt_trimmed_values <- trim_extreme_values(
|
| 98 |
+
.$kurt_diff,
|
| 99 |
+
trim_percent = kurt_trim_pct
|
| 100 |
+
)
|
| 101 |
+
data.frame(
|
| 102 |
+
module = .$module[1],
|
| 103 |
+
kurt_diff_trimmed = kurt_trimmed_values
|
| 104 |
+
)
|
| 105 |
+
})
|
| 106 |
+
|
| 107 |
+
df_plot_trimmed_sensi <- df_diff |>
|
| 108 |
+
group_by(module) |>
|
| 109 |
+
do({
|
| 110 |
+
sensi_trimmed_values <- trim_extreme_values(
|
| 111 |
+
.$kurt_diff,
|
| 112 |
+
trim_percent = sensi_trim_pct
|
| 113 |
+
)
|
| 114 |
+
data.frame(
|
| 115 |
+
module = .$module[1],
|
| 116 |
+
sensi_diff_trimmed = sensi_trimmed_values
|
| 117 |
+
)
|
| 118 |
+
})
|
| 119 |
+
|
| 120 |
+
# Create QQ plots for kurt diff
|
| 121 |
+
plt_qq_kurt <- ggplot(
|
| 122 |
+
df_plot_trimmed_kurt, aes(sample = kurt_diff_trimmed)
|
| 123 |
+
) +
|
| 124 |
+
stat_qq() +
|
| 125 |
+
stat_qq_line() +
|
| 126 |
+
facet_wrap(~module, scales = "free") +
|
| 127 |
+
labs(
|
| 128 |
+
title = paste0(model, " - QQ Plots of Kurtosis Differences by Module"),
|
| 129 |
+
x = "Theoretical Quantiles",
|
| 130 |
+
y = "Sample Quantiles"
|
| 131 |
+
) +
|
| 132 |
+
theme_minimal()
|
| 133 |
+
ggsave(
|
| 134 |
+
create.dir = TRUE,
|
| 135 |
+
paste0("pdfs/qq_kurt_", model, ".pdf"),
|
| 136 |
+
plot = plt_qq_kurt,
|
| 137 |
+
width = 10,
|
| 138 |
+
height = 6
|
| 139 |
+
)
|
| 140 |
+
|
| 141 |
+
# Create QQ plots for sensi diff
|
| 142 |
+
plt_qq_sensi <- ggplot(
|
| 143 |
+
df_plot_trimmed_sensi, aes(sample = sensi_diff_trimmed)
|
| 144 |
+
) +
|
| 145 |
+
stat_qq() +
|
| 146 |
+
stat_qq_line() +
|
| 147 |
+
facet_wrap(~module, scales = "free") +
|
| 148 |
+
labs(
|
| 149 |
+
title = paste0(model, " - QQ Plots of Sensitivity Differences by Module"),
|
| 150 |
+
x = "Theoretical Quantiles",
|
| 151 |
+
y = "Sample Quantiles"
|
| 152 |
+
) +
|
| 153 |
+
theme_minimal()
|
| 154 |
+
ggsave(
|
| 155 |
+
paste0("pdfs/qq_sensi_", model, ".pdf"),
|
| 156 |
+
plot = plt_qq_sensi,
|
| 157 |
+
width = 10,
|
| 158 |
+
height = 6
|
| 159 |
+
)
|
| 160 |
+
|
| 161 |
+
hist_fill_color <- "#66c2a5"
|
| 162 |
+
density_line_color <- "#fc8d62"
|
| 163 |
+
norm_line_color <- "blue"
|
| 164 |
+
# Create histograms with normal curve overlay for trimmed data
|
| 165 |
+
plt_hist_kurt <- ggplot(df_plot_trimmed_kurt, aes(x = kurt_diff_trimmed)) +
|
| 166 |
+
geom_histogram(
|
| 167 |
+
aes(y = after_stat(density)),
|
| 168 |
+
bins = 10,
|
| 169 |
+
fill = hist_fill_color,
|
| 170 |
+
color = "black"
|
| 171 |
+
) +
|
| 172 |
+
geom_density(color = density_line_color, linewidth = 1) +
|
| 173 |
+
stat_function(
|
| 174 |
+
fun = dnorm,
|
| 175 |
+
args = list(
|
| 176 |
+
mean = mean(df_plot_trimmed_kurt$kurt_diff_trimmed),
|
| 177 |
+
sd = sd(df_plot_trimmed_kurt$kurt_diff_trimmed)
|
| 178 |
+
),
|
| 179 |
+
color = norm_line_color, linewidth = 1, linetype = "dashed"
|
| 180 |
+
) +
|
| 181 |
+
facet_wrap(~module, scales = "free") +
|
| 182 |
+
labs(
|
| 183 |
+
# title = paste0(
|
| 184 |
+
# model,
|
| 185 |
+
# " - Histograms of Kurtosis Differences with Normal Curve Overlay"
|
| 186 |
+
# ),
|
| 187 |
+
x = paste0(
|
| 188 |
+
"Kurtosis Difference (",
|
| 189 |
+
formatC(kurt_trim_pct * 100, format = "f", digits = 0),
|
| 190 |
+
"% Trimmed)"
|
| 191 |
+
),
|
| 192 |
+
y = "Density"
|
| 193 |
+
) +
|
| 194 |
+
theme_minimal()
|
| 195 |
+
ggsave(
|
| 196 |
+
paste0("pdfs/hist-kurt-", model, ".pdf"),
|
| 197 |
+
plot = plt_hist_kurt,
|
| 198 |
+
width = 10,
|
| 199 |
+
height = 6
|
| 200 |
+
)
|
| 201 |
+
|
| 202 |
+
# Create histograms with normal curve overlay for trimmed data
|
| 203 |
+
plt_hist_sensi <- ggplot(df_plot_trimmed_sensi, aes(x = sensi_diff_trimmed)) +
|
| 204 |
+
geom_histogram(
|
| 205 |
+
aes(y = after_stat(density)),
|
| 206 |
+
bins = 10,
|
| 207 |
+
fill = hist_fill_color,
|
| 208 |
+
color = "black"
|
| 209 |
+
) +
|
| 210 |
+
geom_density(color = density_line_color, linewidth = 1) +
|
| 211 |
+
stat_function(
|
| 212 |
+
fun = dnorm,
|
| 213 |
+
args = list(
|
| 214 |
+
mean = mean(df_plot_trimmed_sensi$sensi_diff_trimmed),
|
| 215 |
+
sd = sd(df_plot_trimmed_sensi$sensi_diff_trimmed)
|
| 216 |
+
),
|
| 217 |
+
color = norm_line_color, linewidth = 1, linetype = "dashed"
|
| 218 |
+
) +
|
| 219 |
+
facet_wrap(~module, scales = "free") +
|
| 220 |
+
labs(
|
| 221 |
+
# title = paste0(
|
| 222 |
+
# model,
|
| 223 |
+
# " - Histograms of Sensitivity Differences with Normal Curve Overlay"
|
| 224 |
+
# ),
|
| 225 |
+
x = paste0(
|
| 226 |
+
"Sensitivity Difference (",
|
| 227 |
+
formatC(sensi_trim_pct * 100, format = "f", digits = 0),
|
| 228 |
+
"% Trimmed)"
|
| 229 |
+
),
|
| 230 |
+
y = "Density"
|
| 231 |
+
) +
|
| 232 |
+
theme_minimal()
|
| 233 |
+
ggsave(
|
| 234 |
+
paste0("pdfs/hist-sensi-", model, ".pdf"),
|
| 235 |
+
plot = plt_hist_sensi,
|
| 236 |
+
width = 10,
|
| 237 |
+
height = 6
|
| 238 |
+
)
|
| 239 |
+
}
|
lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/combine-vit.R
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
library(tidyverse)
|
| 2 |
+
library(stringr)
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
calc_bpp <- function(config) {
|
| 6 |
+
if (config == "base") {
|
| 7 |
+
return(16.0)
|
| 8 |
+
} else if (startsWith(config, "b")) {
|
| 9 |
+
b1 <- strtoi(substr(config, 2, 2))
|
| 10 |
+
g1 <- strtoi(substr(config, 4, nchar(config)))
|
| 11 |
+
b2 <- 8
|
| 12 |
+
g2 <- 128
|
| 13 |
+
return(round(b1 + 2 * b2 / g1 + 32 / g1 / g2, digits = 2))
|
| 14 |
+
} else {
|
| 15 |
+
return(as.numeric(sub("_", ".", config)))
|
| 16 |
+
}
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
zsc_csvs <- c(
|
| 20 |
+
"data/vit/result-eval_zeroshot_cls_fp16-20240919221324.csv",
|
| 21 |
+
"data/vit/result-eval_zs_B_hqq-20240924115024.csv",
|
| 22 |
+
"data/vit/result-eval_zs_H_hqq-20240922075536.csv",
|
| 23 |
+
"data/vit/result-eval_zs_BH_20_mxq-20240930160208.csv",
|
| 24 |
+
"data/vit/result-eval_zs_BH_b2_4-mxq-20241001224316.csv"
|
| 25 |
+
)
|
| 26 |
+
|
| 27 |
+
lnp_csvs <- c(
|
| 28 |
+
"data/vit/result-eval_lp_BLH_fp16-20240927145518.csv",
|
| 29 |
+
"data/vit/result-eval_lp_H_hqq-20240922062756.csv",
|
| 30 |
+
"data/vit/result-eval_lp_B_hqq-20240927013957.csv",
|
| 31 |
+
"data/vit/result-eval_lp_BH_20_mxq-20240930032213.csv",
|
| 32 |
+
"data/vit/result-eval_lp_BH_b2_4-mxq-20241001220858.csv"
|
| 33 |
+
)
|
| 34 |
+
|
| 35 |
+
zscs <- list()
|
| 36 |
+
for (zsc_csv in zsc_csvs) {
|
| 37 |
+
zsc <- read_csv(
|
| 38 |
+
zsc_csv,
|
| 39 |
+
col_select = c(
|
| 40 |
+
model, algo, config,
|
| 41 |
+
zeroshot_mem_allot, zeroshot_mem_reserved,
|
| 42 |
+
acc1_zeroshot_cls, acc5_zeroshot_cls,
|
| 43 |
+
recall_zeroshot_cls, duration_zeroshot_cls
|
| 44 |
+
)
|
| 45 |
+
) |>
|
| 46 |
+
mutate(
|
| 47 |
+
zeroshot_mem_allot = zeroshot_mem_allot / 1024 / 1024,
|
| 48 |
+
zeroshot_mem_reserved = zeroshot_mem_reserved / 1024 / 1024,
|
| 49 |
+
bpp = sapply(config, calc_bpp)
|
| 50 |
+
) |>
|
| 51 |
+
relocate(bpp, .after = config)
|
| 52 |
+
zscs <- append(zscs, list(zsc))
|
| 53 |
+
}
|
| 54 |
+
combined_zsc <- bind_rows(zscs)
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
lnps <- list()
|
| 58 |
+
for (lnp_csv in lnp_csvs) {
|
| 59 |
+
lnp <- read_csv(lnp_csv) |>
|
| 60 |
+
select(
|
| 61 |
+
model, algo, config,
|
| 62 |
+
linear_probe_mem_allot, linear_probe_mem_reserved,
|
| 63 |
+
acc1_linear_probe, acc5_linear_probe,
|
| 64 |
+
recall_linear_probe, duration_linear_probe
|
| 65 |
+
) |>
|
| 66 |
+
mutate(
|
| 67 |
+
linear_probe_mem_allot = linear_probe_mem_allot / 1024 / 1024,
|
| 68 |
+
linear_probe_mem_reserved = linear_probe_mem_reserved / 1024 / 1024
|
| 69 |
+
)
|
| 70 |
+
lnps <- append(lnps, list(lnp))
|
| 71 |
+
}
|
| 72 |
+
combined_lnp <- bind_rows(lnps)
|
| 73 |
+
|
| 74 |
+
combined <- combined_zsc |>
|
| 75 |
+
left_join(combined_lnp, join_by(model, algo, config)) |>
|
| 76 |
+
arrange(model, algo, config)
|
| 77 |
+
write_csv(combined, "data/vit/combined.csv")
|
lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/combine.R
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env Rscript
|
| 2 |
+
|
| 3 |
+
library(tidyverse)
|
| 4 |
+
library(stringr)
|
| 5 |
+
library(plyr)
|
| 6 |
+
library(dplyr)
|
| 7 |
+
library(optparse)
|
| 8 |
+
library(openxlsx)
|
| 9 |
+
|
| 10 |
+
calc_bpp <- function(config) {
|
| 11 |
+
if (config == "base") {
|
| 12 |
+
return(16.0)
|
| 13 |
+
} else if (startsWith(config, "b")) {
|
| 14 |
+
b1 <- strtoi(substr(config, 2, 2))
|
| 15 |
+
g1 <- strtoi(substr(config, 4, nchar(config)))
|
| 16 |
+
b2 <- 8
|
| 17 |
+
g2 <- 128
|
| 18 |
+
return(round(b1 + 2 * b2 / g1 + 32 / g1 / g2, digits = 2))
|
| 19 |
+
} else {
|
| 20 |
+
return(round(as.numeric(sub("_", ".", config)), digits = 2))
|
| 21 |
+
}
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
load_data <- function(baseline_data_dir, mxq_data_dir, type) {
|
| 25 |
+
if (is.null(baseline_data_dir)) {
|
| 26 |
+
dat_dir <- path.expand(paste0("data/", type))
|
| 27 |
+
dat_fps <- dir(
|
| 28 |
+
path = dat_dir,
|
| 29 |
+
pattern = ".*\\.csv$",
|
| 30 |
+
recursive = TRUE,
|
| 31 |
+
full.names = TRUE
|
| 32 |
+
)
|
| 33 |
+
} else {
|
| 34 |
+
# Read csv files under baseline_data_dir, do not recursive into sub-folders
|
| 35 |
+
dat_dir <- path.expand(paste0(baseline_data_dir, "/", type))
|
| 36 |
+
dat_fps <- dir(
|
| 37 |
+
path = dat_dir,
|
| 38 |
+
pattern = ".*\\.csv$",
|
| 39 |
+
recursive = FALSE,
|
| 40 |
+
full.names = TRUE
|
| 41 |
+
)
|
| 42 |
+
mxq_dat_dir <- path.expand(paste0(mxq_data_dir, "/", type))
|
| 43 |
+
mxq_dat_fps <- dir(
|
| 44 |
+
path = mxq_dat_dir,
|
| 45 |
+
pattern = ".*\\.csv$",
|
| 46 |
+
recursive = TRUE,
|
| 47 |
+
full.names = TRUE
|
| 48 |
+
)
|
| 49 |
+
dat_fps <- c(dat_fps, mxq_dat_fps)
|
| 50 |
+
}
|
| 51 |
+
names(dat_fps) <- str_match(dat_fps, "mxq/(.*)/")[, 2]
|
| 52 |
+
df_combined <- ldply(
|
| 53 |
+
dat_fps,
|
| 54 |
+
read.csv,
|
| 55 |
+
stringsAsFactors = FALSE,
|
| 56 |
+
.id = "attempt"
|
| 57 |
+
)
|
| 58 |
+
return(df_combined)
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
parser <- OptionParser()
|
| 62 |
+
parser <- add_option(
|
| 63 |
+
parser, c("-b", "--baseline_data_dir"),
|
| 64 |
+
type = "character",
|
| 65 |
+
help = "Data directory of baseline results",
|
| 66 |
+
metavar = "character"
|
| 67 |
+
)
|
| 68 |
+
parser <- add_option(
|
| 69 |
+
parser, c("-m", "--mxq_data_dir"),
|
| 70 |
+
type = "character",
|
| 71 |
+
help = "Data directory of MXQ results organized by attempt",
|
| 72 |
+
metavar = "character"
|
| 73 |
+
)
|
| 74 |
+
args <- parse_args(parser)
|
| 75 |
+
|
| 76 |
+
if (is.null(args$baseline_data_dir)) {
|
| 77 |
+
df_combined_stor <- load_data(NULL, NULL, "stor")
|
| 78 |
+
df_combined_ppl <- load_data(NULL, NULL, "ppl")
|
| 79 |
+
df_combined_qnt <- load_data(NULL, NULL, "qnt")
|
| 80 |
+
df_combined_allot <- load_data(NULL, NULL, "allot")
|
| 81 |
+
} else {
|
| 82 |
+
df_combined_stor <- load_data(
|
| 83 |
+
args$baseline_data_dir, args$mxq_data_dir, "stor"
|
| 84 |
+
)
|
| 85 |
+
df_combined_ppl <- load_data(
|
| 86 |
+
args$baseline_data_dir, args$mxq_data_dir, "ppl"
|
| 87 |
+
)
|
| 88 |
+
df_combined_qnt <- load_data(
|
| 89 |
+
args$baseline_data_dir, args$mxq_data_dir, "qnt"
|
| 90 |
+
)
|
| 91 |
+
df_combined_allot <- load_data(
|
| 92 |
+
args$baseline_data_dir, args$mxq_data_dir, "allot"
|
| 93 |
+
)
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
df_combined_stor <- df_combined_stor |>
|
| 97 |
+
select(
|
| 98 |
+
model, algo, config, attempt, load_mem_allot, model_storage_size
|
| 99 |
+
) |>
|
| 100 |
+
mutate(
|
| 101 |
+
load_mem_allot = round(load_mem_allot / 1024^3, digits = 2),
|
| 102 |
+
model_storage_size = round(model_storage_size / 1024^3, digits = 2),
|
| 103 |
+
)
|
| 104 |
+
|
| 105 |
+
df_combined_ppl <- df_combined_ppl |>
|
| 106 |
+
select(
|
| 107 |
+
model, algo, config, attempt,
|
| 108 |
+
ppl_wikitext, ppl_c4, quant_duration
|
| 109 |
+
)
|
| 110 |
+
|
| 111 |
+
df_combined_qnt <- df_combined_qnt |>
|
| 112 |
+
select(
|
| 113 |
+
model, algo, config, attempt, quant_duration
|
| 114 |
+
)
|
| 115 |
+
|
| 116 |
+
df_model_params <- tribble(
|
| 117 |
+
~model, ~param_count,
|
| 118 |
+
"Llama-2-7b-hf", 7000000000,
|
| 119 |
+
"Llama-2-13b-hf", 13000000000,
|
| 120 |
+
"Meta-Llama-3-8B", 8000000000
|
| 121 |
+
)
|
| 122 |
+
|
| 123 |
+
df_combined <- df_combined_ppl |>
|
| 124 |
+
left_join(df_combined_qnt, join_by(model, algo, config, attempt)) |>
|
| 125 |
+
left_join(df_combined_stor, join_by(model, algo, config, attempt)) |>
|
| 126 |
+
mutate(
|
| 127 |
+
quant_duration =
|
| 128 |
+
ifelse(quant_duration.x > 0, quant_duration.x, quant_duration.y)
|
| 129 |
+
) |>
|
| 130 |
+
left_join(df_model_params, join_by(model)) |>
|
| 131 |
+
mutate(
|
| 132 |
+
bpp = sapply(config, calc_bpp)
|
| 133 |
+
) |>
|
| 134 |
+
select(!c("quant_duration.x", "quant_duration.y")) |>
|
| 135 |
+
distinct(model, algo, config, attempt, .keep_all = TRUE) |>
|
| 136 |
+
relocate(bpp, .after = config)
|
| 137 |
+
|
| 138 |
+
write_csv(df_combined, "data/combined.csv", na = "")
|
| 139 |
+
write.xlsx(
|
| 140 |
+
df_combined, "data/combined.xlsx",
|
| 141 |
+
overwrite = TRUE, asTable = TRUE
|
| 142 |
+
)
|
| 143 |
+
|
| 144 |
+
write_csv(df_combined_allot, "data/quant-cfg-allocation.csv", na = "")
|
| 145 |
+
write.xlsx(
|
| 146 |
+
df_combined, "data/quant-cfg-allocation.xlsx",
|
| 147 |
+
overwrite = TRUE, asTable = TRUE
|
| 148 |
+
)
|
lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/data-vis.Rproj
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Version: 1.0
|
| 2 |
+
ProjectId: 9f27daae-0012-43a6-b6a5-ec594e1aadd7
|
| 3 |
+
|
| 4 |
+
RestoreWorkspace: Default
|
| 5 |
+
SaveWorkspace: Default
|
| 6 |
+
AlwaysSaveHistory: Default
|
| 7 |
+
|
| 8 |
+
EnableCodeIndexing: Yes
|
| 9 |
+
UseSpacesForTab: Yes
|
| 10 |
+
NumSpacesForTab: 2
|
| 11 |
+
Encoding: UTF-8
|
| 12 |
+
|
| 13 |
+
RnwWeave: Sweave
|
| 14 |
+
LaTeX: pdfLaTeX
|
lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/data/allot/mxq/kurt-scaled/quant-cfg-allot-kurt-scaled.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/data/allot/mxq/mxq1/quant-cfg-allot-mxq1.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/data/allot/mxq/mxq2/quant-cfg-allot-mxq1.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/data/allot/quant-cfg-allot-hqq.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/data/combined.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/data/fnorm/fnorm-Llama-2-13b-hf.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/data/fnorm/fnorm-Llama-2-70b-hf.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/data/fnorm/fnorm-Llama-2-7b-hf.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/data/fnorm/fnorm-Llama-3-70B.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/data/fnorm/fnorm-Meta-Llama-3-8B.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/data/fnorm/fnorm-Meta-Llama-3.1-405B-Instruct.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/data/llama-mxq-cfgs.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/data/llama-sensitivity.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
lm-quant-toolkit/new_lm-quant-toolkit/lm-quant-toolkit/data-vis/data/mistral-sensi.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|