RNAQwen/reports/stage2_config_test.json

reports / stage2_config_test.json

reports/stage2_config_test.json · 10.3 KB

{
  "checks": {
    "preset_and_budget": true,
    "peft_param_arithmetic": true,
    "unknown_preset_errors": true,
    "rslora_passthrough": true,
    "target_modules_match": true,
    "data_filter": true,
    "sample_assembly_and_backward": true
  },
  "details": {
    "preset_table": [
      {
        "preset": "attn",
        "targets": [
          "q_proj",
          "k_proj",
          "v_proj",
          "o_proj"
        ],
        "n_targets": 4,
        "r": 16,
        "alpha": 32,
        "params_offline": 15335424,
        "params_million": 15.34,
        "ratio_pct": 0.1872,
        "table_expected_million": 15.3,
        "delta_vs_table_pct": 0.23,
        "targets_ok": true,
        "r_alpha_ok": true,
        "params_ok": true
      },
      {
        "preset": "attn_mlp",
        "targets": [
          "q_proj",
          "k_proj",
          "v_proj",
          "o_proj",
          "gate_proj",
          "up_proj",
          "down_proj"
        ],
        "n_targets": 7,
        "r": 16,
        "alpha": 32,
        "params_offline": 43646976,
        "params_million": 43.65,
        "ratio_pct": 0.5329,
        "table_expected_million": 43.6,
        "delta_vs_table_pct": 0.11,
        "targets_ok": true,
        "r_alpha_ok": true,
        "params_ok": true
      },
      {
        "preset": "attn_mlp_r8",
        "targets": [
          "q_proj",
          "k_proj",
          "v_proj",
          "o_proj",
          "gate_proj",
          "up_proj",
          "down_proj"
        ],
        "n_targets": 7,
        "r": 8,
        "alpha": 16,
        "params_offline": 21823488,
        "params_million": 21.82,
        "ratio_pct": 0.2665,
        "table_expected_million": 21.8,
        "delta_vs_table_pct": 0.11,
        "targets_ok": true,
        "r_alpha_ok": true,
        "params_ok": true
      },
      {
        "preset": "attn_mlp_r64",
        "targets": [
          "q_proj",
          "k_proj",
          "v_proj",
          "o_proj",
          "gate_proj",
          "up_proj",
          "down_proj"
        ],
        "n_targets": 7,
        "r": 64,
        "alpha": 128,
        "params_offline": 174587904,
        "params_million": 174.59,
        "ratio_pct": 2.1316,
        "table_expected_million": 174.6,
        "delta_vs_table_pct": -0.01,
        "targets_ok": true,
        "r_alpha_ok": true,
        "params_ok": true
      }
    ],
    "peft_extrapolation": {
      "true_8b_shapes_meta_build": {
        "down_proj": [
          12288,
          4096
        ],
        "gate_proj": [
          4096,
          12288
        ],
        "k_proj": [
          4096,
          1024
        ],
        "o_proj": [
          4096,
          4096
        ],
        "q_proj": [
          4096,
          4096
        ],
        "up_proj": [
          4096,
          12288
        ],
        "v_proj": [
          4096,
          1024
        ]
      },
      "true_8b_shapes_match_offline_table": true,
      "true_8b_head_dim": 128,
      "true_8b_num_key_value_heads": 8,
      "tiny_config": {
        "hidden": 512,
        "intermediate": 1536,
        "n_layers": 1,
        "num_attention_heads": 4,
        "num_key_value_heads": 1,
        "head_dim": 128
      },
      "scale_factor": 8,
      "by_rank": {
        "8": {
          "peft_params_tiny": 75776,
          "offline_tiny": 75776,
          "scale": 8,
          "extrapolated_8b": 21823488,
          "offline_formula_8b": 21823488,
          "million": 21.82,
          "peft_matches_offline_tiny": true,
          "extrapolation_matches_offline_8b": true,
          "agree": true
        },
        "16": {
          "peft_params_tiny": 151552,
          "offline_tiny": 151552,
          "scale": 8,
          "extrapolated_8b": 43646976,
          "offline_formula_8b": 43646976,
          "million": 43.65,
          "peft_matches_offline_tiny": true,
          "extrapolation_matches_offline_8b": true,
          "agree": true
        },
        "32": {
          "peft_params_tiny": 303104,
          "offline_tiny": 303104,
          "scale": 8,
          "extrapolated_8b": 87293952,
          "offline_formula_8b": 87293952,
          "million": 87.29,
          "peft_matches_offline_tiny": true,
          "extrapolation_matches_offline_8b": true,
          "agree": true
        },
        "64": {
          "peft_params_tiny": 606208,
          "offline_tiny": 606208,
          "scale": 8,
          "extrapolated_8b": 174587904,
          "offline_formula_8b": 174587904,
          "million": 174.59,
          "peft_matches_offline_tiny": true,
          "extrapolation_matches_offline_8b": true,
          "agree": true
        }
      },
      "note": "小模型的 head_dim 必须手写成 hidden//num_heads:Qwen3Config 会无条件 把 head_dim 默认成 128,不一致时 transformers 5.9 走 packed 的 q/k 布局,小模型就不再同构(本地 Qwen3-8B 的 config head_dim=128 == 4096//32,没这问题)",
      "scale_limit": "scale ≤ 8:Qwen3 有 8 个 kv head,再缩就成 0 了"
    },
    "unknown_preset": {
      "config_raises": "未知 LoRA preset 'attn_mlp_r128';可用:['attn', 'attn_mlp', 'attn_mlp_r64', 'attn_mlp_r8']",
      "cli_returncode": 2,
      "cli_last_line": "23_train_stage2.py: error: argument --preset: 未知 LoRA preset 'nope';可用:['attn', 'attn_mlp', 'attn_mlp_r64', 'attn_mlp_r8']",
      "available": [
        "attn",
        "attn_mlp",
        "attn_mlp_r64",
        "attn_mlp_r8"
      ]
    },
    "rslora": {
      "off": false,
      "on": true,
      "r64_r": 64,
      "r64_alpha": 128,
      "r64_rslora": true
    },
    "target_modules": {
      "bert": {
        "path": "C:\\qwen-api\\RNAQwen\\models\\bert-base-uncased",
        "exists": true,
        "ok": true,
        "targets": [
          "query",
          "key",
          "value"
        ],
        "n_layers": 12,
        "matched_modules": 36,
        "expected_modules": 36,
        "trainable_params": 442368,
        "expected_params": 442368
      },
      "qwen3_tiny": {
        "n_matched": 14,
        "n_layers": 2,
        "per_layer": 7,
        "expected_per_layer": 7,
        "targets_found": [
          "down_proj",
          "gate_proj",
          "k_proj",
          "o_proj",
          "q_proj",
          "up_proj",
          "v_proj"
        ],
        "missing": [],
        "extra": [],
        "base_shapes_tiny": {
          "down_proj": [
            1536,
            512
          ],
          "gate_proj": [
            512,
            1536
          ],
          "k_proj": [
            512,
            128
          ],
          "o_proj": [
            512,
            512
          ],
          "q_proj": [
            512,
            512
          ],
          "up_proj": [
            512,
            1536
          ],
          "v_proj": [
            512,
            128
          ]
        },
        "expected_on_8b": 252
      },
      "wrong_name_raises": true,
      "qwen3_8b_module_names": [
        "down_proj",
        "gate_proj",
        "k_proj",
        "o_proj",
        "q_proj",
        "up_proj",
        "v_proj"
      ]
    },
    "data_filter": {
      "data": "C:\\qwen-api\\RNAQwen\\data\\processed\\rnaqa_50.jsonl",
      "records": 50,
      "cases": {
        "variant_ais": {
          "variants": [
            "ais"
          ],
          "kinds": [],
          "records_kept": 50,
          "qa_kept": 150,
          "qa_in": 300
        },
        "variant_dc": {
          "variants": [
            "dc"
          ],
          "kinds": [],
          "records_kept": 50,
          "qa_kept": 150,
          "qa_in": 300
        },
        "kind_factoid": {
          "variants": [],
          "kinds": [
            "factoid"
          ],
          "records_kept": 50,
          "qa_kept": 300,
          "qa_in": 300
        },
        "dc_AND_factoid": {
          "variants": [
            "dc"
          ],
          "kinds": [
            "factoid"
          ],
          "records_kept": 50,
          "qa_kept": 150,
          "qa_in": 300
        },
        "dc_AND_closed": {
          "variants": [
            "dc"
          ],
          "kinds": [
            "closed"
          ],
          "records_kept": 0,
          "qa_kept": 0,
          "qa_in": 300
        },
        "multi_variant": {
          "variants": [
            "ais",
            "dc"
          ],
          "kinds": [
            "factoid"
          ],
          "records_kept": 50,
          "qa_kept": 300,
          "qa_in": 300
        }
      },
      "invariants": {
        "ais_plus_dc_equals_total": true,
        "factoid_equals_total": true,
        "dc_and_factoid_equals_dc": true,
        "dc_and_closed_is_empty": true,
        "multi_variant_equals_total": true
      },
      "note": "rnaqa_50.jsonl 里 kind 只有 factoid,没有 closed/open —— 所以 '--variant dc --kind closed' 正确地筛出 0 条(子集为空是数据事实,不是筛选 bug)"
    },
    "sample_assembly": {
      "seq_len": 102,
      "n_supervised": 34,
      "sum_answer_tokens": 34,
      "per_sample_segments": [
        {
          "n_prefix": 8,
          "n_rna": 8,
          "n_suffix": 23,
          "n_prompt": 41,
          "n_answer": 22
        },
        {
          "n_prefix": 8,
          "n_rna": 8,
          "n_suffix": 23,
          "n_prompt": 36,
          "n_answer": 12
        }
      ],
      "answer_only_mask_ok": true,
      "no_supervision_outside_answer": true,
      "loss": 5.562154769897461,
      "grad_norm_lora": 7.478895604610443,
      "grad_norm_projection": 4.230171084403992,
      "control_prompt_also_supervised": {
        "n_supervised": 111,
        "loss": 5.497989654541016,
        "inputs_identical": true,
        "non_label_positions_identical": false
      }
    }
  },
  "passed": true,
  "summary": {
    "1_presets": true,
    "1b_peft_extrapolation": true,
    "2_unknown_preset": true,
    "3_rslora": true,
    "4_target_modules": true,
    "5_data_filter": true,
    "6_sample_assembly": true
  }
}

← 返回文件树 · 在 Hugging Face 上查看