gregH commited on
Commit
8fb2f84
1 Parent(s): 41c2afe

Update assets/js/calibration.js

Browse files
Files changed (1) hide show
  1. assets/js/calibration.js +35 -5
assets/js/calibration.js CHANGED
@@ -63,17 +63,47 @@ $(document).ready(function(){
63
  var brr_board = document.getElementById("brr-value");
64
  if (cur_defense === "ppl")
65
  {
66
- asr_board.innerText = parseFloat(jailbreak_results[cur_defense][cur_model]["pair"][ppl_threshold.toString()]["tpr"]).toFixed(5);
 
 
 
 
 
 
 
 
 
 
67
  brr_board.innerText = parseFloat(jailbreak_results[cur_defense][cur_model]["pair"][ppl_threshold.toString()]["fpr"]).toFixed(5);
68
  return "demo_results/ppl_"+cur_model+"_threshold_"+ppl_threshold.toString()+".png"
69
  }
70
  else if (cur_defense === "gradient_cuff")
71
  {
72
- asr_board.innerText = parseFloat(jailbreak_results[cur_defense][cur_model]["pair"][gradient_norm_threshold.toString()]["tpr"]).toFixed(5);
73
- brr_board.innerText = parseFloat(jailbreak_results[cur_defense][cur_model]["pair"][gradient_norm_threshold.toString()]["fpr"]).toFixed(5);
74
- return "demo_results/gradient_cuff_"+cur_model+"_threshold_"+gradient_norm_threshold.toString()+".png"
 
 
 
 
 
 
 
 
 
 
75
  }else{
76
- asr_board.innerText = parseFloat(jailbreak_results[cur_defense][cur_model]["pair"]["tpr"]).toFixed(5);
 
 
 
 
 
 
 
 
 
 
77
  brr_board.innerText = parseFloat(jailbreak_results[cur_defense][cur_model]["pair"]["fpr"]).toFixed(5);
78
  return "demo_results/"+cur_defense+"_"+cur_model+".png"
79
  }
 
63
  var brr_board = document.getElementById("brr-value");
64
  if (cur_defense === "ppl")
65
  {
66
+ var asr_gcg=jailbreak_results[cur_defense][cur_model]["adv_harmful_behavior"][ppl_threshold.toString()]["tpr"];
67
+ var asr_autodan=jailbreak_results[cur_defense][cur_model]["autodan"][ppl_threshold.toString()]["tpr"];
68
+ var asr_pair=jailbreak_results[cur_defense][cur_model]["pair"][ppl_threshold.toString()]["tpr"];
69
+ var asr_tap=jailbreak_results[cur_defense][cur_model]["tap"][ppl_threshold.toString()]["tpr"];
70
+ var asr_base64=jailbreak_results[cur_defense][cur_model]["base64"][ppl_threshold.toString()]["tpr"];
71
+ var asr_lrl_de=jailbreak_results[cur_defense][cur_model]["lrl_de"][ppl_threshold.toString()]["tpr"];
72
+ var asr_lrl_fr=jailbreak_results[cur_defense][cur_model]["lrl_fr"][ppl_threshold.toString()]["tpr"];
73
+ var asr_lrl_zh_CN=jailbreak_results[cur_defense][cur_model]["lrl_zh-CN"][ppl_threshold.toString()]["tpr"];
74
+ var asr_lrl_sv=jailbreak_results[cur_defense][cur_model]["lrl_sv"][ppl_threshold.toString()]["tpr"];
75
+ var asr=(asr_gcg+asr_autodan+asr_pair+asr_tap+asr_base64+(asr_lrl_de+asr_lrl_fr+asr_lrl_zh_CN+asr_lrl_sv)/4)/6
76
+ asr_board.innerText = parseFloat(asr).toFixed(5);
77
  brr_board.innerText = parseFloat(jailbreak_results[cur_defense][cur_model]["pair"][ppl_threshold.toString()]["fpr"]).toFixed(5);
78
  return "demo_results/ppl_"+cur_model+"_threshold_"+ppl_threshold.toString()+".png"
79
  }
80
  else if (cur_defense === "gradient_cuff")
81
  {
82
+ var asr_gcg=jailbreak_results[cur_defense][cur_model]["adv_harmful_behavior"][gradient_norm_threshold.toString()]["tpr"];
83
+ var asr_autodan=jailbreak_results[cur_defense][cur_model]["autodan"][gradient_norm_threshold.toString()]["tpr"];
84
+ var asr_pair=jailbreak_results[cur_defense][cur_model]["pair"][gradient_norm_threshold.toString()]["tpr"];
85
+ var asr_tap=jailbreak_results[cur_defense][cur_model]["tap"][gradient_norm_threshold.toString()]["tpr"];
86
+ var asr_base64=jailbreak_results[cur_defense][cur_model]["base64"][gradient_norm_threshold.toString()]["tpr"];
87
+ var asr_lrl_de=jailbreak_results[cur_defense][cur_model]["lrl_de"][gradient_norm_threshold.toString()]["tpr"];
88
+ var asr_lrl_fr=jailbreak_results[cur_defense][cur_model]["lrl_fr"][gradient_norm_threshold.toString()]["tpr"];
89
+ var asr_lrl_zh_CN=jailbreak_results[cur_defense][cur_model]["lrl_zh-CN"][gradient_norm_threshold.toString()]["tpr"];
90
+ var asr_lrl_sv=jailbreak_results[cur_defense][cur_model]["lrl_sv"][gradient_norm_threshold.toString()]["tpr"];
91
+ var asr=(asr_gcg+asr_autodan+asr_pair+asr_tap+asr_base64+(asr_lrl_de+asr_lrl_fr+asr_lrl_zh_CN+asr_lrl_sv)/4)/6
92
+ asr_board.innerText = parseFloat(asr).toFixed(5);
93
+ brr_board.innerText = parseFloat(jailbreak_results[cur_defense][cur_model]["pair"][gradient_norm_threshold.toString()]["fpr"]).toFixed(5);
94
+ return "demo_results/gradient_cuff_"+cur_model+"_threshold_"+gradient_norm_threshold.toString()+".png"
95
  }else{
96
+ var asr_gcg=jailbreak_results[cur_defense][cur_model]["adv_harmful_behavior"]["tpr"];
97
+ var asr_autodan=jailbreak_results[cur_defense][cur_model]["autodan"]["tpr"];
98
+ var asr_pair=jailbreak_results[cur_defense][cur_model]["pair"]["tpr"];
99
+ var asr_tap=jailbreak_results[cur_defense][cur_model]["tap"]["tpr"];
100
+ var asr_base64=jailbreak_results[cur_defense][cur_model]["base64"]["tpr"];
101
+ var asr_lrl_de=jailbreak_results[cur_defense][cur_model]["lrl_de"]["tpr"];
102
+ var asr_lrl_fr=jailbreak_results[cur_defense][cur_model]["lrl_fr"]["tpr"];
103
+ var asr_lrl_zh_CN=jailbreak_results[cur_defense][cur_model]["lrl_zh-CN"]["tpr"];
104
+ var asr_lrl_sv=jailbreak_results[cur_defense][cur_model]["lrl_sv"]["tpr"];
105
+ var asr=(asr_gcg+asr_autodan+asr_pair+asr_tap+asr_base64+(asr_lrl_de+asr_lrl_fr+asr_lrl_zh_CN+asr_lrl_sv)/4)/6
106
+ asr_board.innerText = parseFloat(asr).toFixed(5);
107
  brr_board.innerText = parseFloat(jailbreak_results[cur_defense][cur_model]["pair"]["fpr"]).toFixed(5);
108
  return "demo_results/"+cur_defense+"_"+cur_model+".png"
109
  }