Skip to content

attacks: Make config validation skip fields with a default value#93

Merged
tomtseng merged 1 commit intomainfrom
tomtseng/attack-validation
Feb 12, 2026
Merged

attacks: Make config validation skip fields with a default value#93
tomtseng merged 1 commit intomainfrom
tomtseng/attack-validation

Conversation

@tomtseng
Copy link
Collaborator

Changes

When running LoRA fine-tuning I got

Traceback (most recent call last):
  File "/workspace/TamperBench/scripts/user/tomtseng/mmlu_pro_chat_260211/run_mmlu_pro_variants.py", line 197, in <module>
    main()
  File "/workspace/TamperBench/scripts/user/tomtseng/mmlu_pro_chat_260211/run_mmlu_pro_variants.py", line 185, in main
    run_attack_and_evaluate(
  File "/workspace/TamperBench/scripts/user/tomtseng/mmlu_pro_chat_260211/run_mmlu_pro_variants.py", line 116, in run_attack_and_evaluate
    attacker = attack_cls(attack_config=attack_config_cls.from_dict(data=attack_config_data))
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/TamperBench/src/tamperbench/whitebox/attacks/base.py", line 67, in from_dict
    cls._validate_dict_keys(data)
  File "/workspace/TamperBench/src/tamperbench/whitebox/attacks/base.py", line 105, in _validate_dict_keys
    raise ValueError(f"`{config_key}` is a mandatory field, and is not provided")
ValueError: `target_modules` is a mandatory field, and is not provided

which is a field introduced by #69. #69 tried to make this backwards compatible (it fills in the field later if it's not provided) but didn't actually test it. I think the fix here is to make the validator not flag the field.

Testing

Added unit tests, and they pass

@tomtseng tomtseng merged commit 1f94ef9 into main Feb 12, 2026
2 checks passed
@tomtseng tomtseng deleted the tomtseng/attack-validation branch February 12, 2026 00:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant