Spaces:
Running
Running
Update src/App.js
Browse files- src/App.js +51 -38
src/App.js
CHANGED
|
@@ -73,7 +73,7 @@ const BenchmarkChart = () => {
|
|
| 73 |
const interval = setInterval(() => {
|
| 74 |
setCurrentPhase(prev => prev === 'baseline' ? 'additive_synthesis' : 'baseline');
|
| 75 |
setCurrentMethodIndex(0); // Reset when switching phases
|
| 76 |
-
},
|
| 77 |
|
| 78 |
return () => clearInterval(interval);
|
| 79 |
}, []);
|
|
@@ -89,7 +89,7 @@ const BenchmarkChart = () => {
|
|
| 89 |
}
|
| 90 |
return nextIndex;
|
| 91 |
});
|
| 92 |
-
},
|
| 93 |
return () => clearInterval(methodInterval);
|
| 94 |
}
|
| 95 |
}, [currentPhase]);
|
|
@@ -129,9 +129,12 @@ const BenchmarkChart = () => {
|
|
| 129 |
const getBarColor = (modelData, phase) => {
|
| 130 |
if (phase === 'baseline') {
|
| 131 |
return 'from-blue-500 to-blue-600';
|
| 132 |
-
} else {
|
| 133 |
-
//
|
| 134 |
return 'from-green-500 to-green-600';
|
|
|
|
|
|
|
|
|
|
| 135 |
}
|
| 136 |
};
|
| 137 |
|
|
@@ -150,13 +153,12 @@ const BenchmarkChart = () => {
|
|
| 150 |
{/* Methodology Disclaimer */}
|
| 151 |
<div className="mt-6 p-4 bg-yellow-900/30 border border-yellow-500/30 rounded-lg max-w-4xl mx-auto">
|
| 152 |
<div className="flex items-start space-x-3">
|
| 153 |
-
<div className="text-yellow-400 mt-1">⚠️</div>
|
| 154 |
<div className="text-left">
|
| 155 |
<p className="text-yellow-200 font-semibold mb-2">Methodology Note</p>
|
| 156 |
<p className="text-yellow-100 text-sm leading-relaxed">
|
| 157 |
-
<strong>Additive Visualization:</strong> This chart shows cumulative impact by progressively adding each synthesis method's individual success rate.
|
| 158 |
-
Values >100% represent
|
| 159 |
-
Results are based on
|
| 160 |
</p>
|
| 161 |
</div>
|
| 162 |
</div>
|
|
@@ -176,7 +178,7 @@ const BenchmarkChart = () => {
|
|
| 176 |
|
| 177 |
{/* Chart Container */}
|
| 178 |
<div className="bg-white rounded-2xl shadow-2xl p-8">
|
| 179 |
-
<div className="space-y-
|
| 180 |
{benchmarkData.map((modelData, index) => {
|
| 181 |
const currentValue = getCurrentValue(modelData, currentPhase);
|
| 182 |
const baselineValue = modelData.direct_conversation;
|
|
@@ -187,23 +189,51 @@ const BenchmarkChart = () => {
|
|
| 187 |
|
| 188 |
return (
|
| 189 |
<div key={modelData.model} className="relative">
|
| 190 |
-
{/* Model Name and Methods */}
|
| 191 |
-
<div className="flex items-
|
| 192 |
-
<div>
|
| 193 |
-
<h3 className="font-semibold text-gray-800 text-lg">
|
| 194 |
{modelData.model}
|
| 195 |
</h3>
|
| 196 |
-
<
|
| 197 |
-
|
| 198 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
</div>
|
| 200 |
-
<div className="text-right">
|
| 201 |
<span className="text-2xl font-bold text-gray-700">
|
| 202 |
{currentValue.toFixed(1)}%
|
| 203 |
</span>
|
| 204 |
{currentPhase === 'additive_synthesis' && totalGain > 0 && (
|
| 205 |
<div className="text-sm font-semibold text-green-600">
|
| 206 |
-
+{totalGain.toFixed(1)}%
|
| 207 |
</div>
|
| 208 |
)}
|
| 209 |
</div>
|
|
@@ -212,7 +242,7 @@ const BenchmarkChart = () => {
|
|
| 212 |
{/* Progress Bar */}
|
| 213 |
<div className="relative h-12 bg-gray-200 rounded-full overflow-hidden">
|
| 214 |
<div
|
| 215 |
-
className={`h-full bg-gradient-to-r ${getBarColor(modelData, currentPhase)} rounded-full transition-all duration-[
|
| 216 |
style={{ width: `${Math.max(barWidth, 5)}%` }}
|
| 217 |
>
|
| 218 |
<div className="text-white font-semibold text-sm">
|
|
@@ -220,23 +250,6 @@ const BenchmarkChart = () => {
|
|
| 220 |
</div>
|
| 221 |
</div>
|
| 222 |
</div>
|
| 223 |
-
|
| 224 |
-
{/* Method Breakdown */}
|
| 225 |
-
{currentPhase === 'additive_synthesis' && currentMethodIndex > 0 && (
|
| 226 |
-
<div className="mt-2 text-xs text-gray-500 space-y-1">
|
| 227 |
-
<div>Baseline: {baselineValue.toFixed(1)}%</div>
|
| 228 |
-
{synthesisMethodsOrder.slice(0, currentMethodIndex).map(method => {
|
| 229 |
-
if (modelData[method] !== undefined) {
|
| 230 |
-
return (
|
| 231 |
-
<div key={method}>
|
| 232 |
-
+ {method.replace(/_/g, ' ')}: {modelData[method].toFixed(1)}%
|
| 233 |
-
</div>
|
| 234 |
-
);
|
| 235 |
-
}
|
| 236 |
-
return null;
|
| 237 |
-
})}
|
| 238 |
-
</div>
|
| 239 |
-
)}
|
| 240 |
</div>
|
| 241 |
);
|
| 242 |
})}
|
|
@@ -250,14 +263,14 @@ const BenchmarkChart = () => {
|
|
| 250 |
</div>
|
| 251 |
<div className="flex items-center space-x-2">
|
| 252 |
<div className="w-4 h-4 bg-gradient-to-r from-green-500 to-green-600 rounded"></div>
|
| 253 |
-
<span className="text-gray-700">
|
| 254 |
</div>
|
| 255 |
</div>
|
| 256 |
</div>
|
| 257 |
|
| 258 |
{/* Footer Info */}
|
| 259 |
<div className="mt-8 text-center text-slate-400 space-y-2">
|
| 260 |
-
<p>Animation cycles every
|
| 261 |
<p className="text-sm">
|
| 262 |
Data from SafetyBench Aug 2025 • Synthesis methods test different attack vectors
|
| 263 |
</p>
|
|
|
|
| 73 |
const interval = setInterval(() => {
|
| 74 |
setCurrentPhase(prev => prev === 'baseline' ? 'additive_synthesis' : 'baseline');
|
| 75 |
setCurrentMethodIndex(0); // Reset when switching phases
|
| 76 |
+
}, 10000); // Reduced by 2 seconds: was 12000ms, now 10000ms
|
| 77 |
|
| 78 |
return () => clearInterval(interval);
|
| 79 |
}, []);
|
|
|
|
| 89 |
}
|
| 90 |
return nextIndex;
|
| 91 |
});
|
| 92 |
+
}, 2500); // Increased to 2.5 seconds to allow animation to complete
|
| 93 |
return () => clearInterval(methodInterval);
|
| 94 |
}
|
| 95 |
}, [currentPhase]);
|
|
|
|
| 129 |
const getBarColor = (modelData, phase) => {
|
| 130 |
if (phase === 'baseline') {
|
| 131 |
return 'from-blue-500 to-blue-600';
|
| 132 |
+
} else if (phase === 'additive_synthesis' && currentMethodIndex > 0) {
|
| 133 |
+
// Only turn green when we've actually started adding methods
|
| 134 |
return 'from-green-500 to-green-600';
|
| 135 |
+
} else {
|
| 136 |
+
// Stay blue if we're in additive phase but haven't started adding yet
|
| 137 |
+
return 'from-blue-500 to-blue-600';
|
| 138 |
}
|
| 139 |
};
|
| 140 |
|
|
|
|
| 153 |
{/* Methodology Disclaimer */}
|
| 154 |
<div className="mt-6 p-4 bg-yellow-900/30 border border-yellow-500/30 rounded-lg max-w-4xl mx-auto">
|
| 155 |
<div className="flex items-start space-x-3">
|
|
|
|
| 156 |
<div className="text-left">
|
| 157 |
<p className="text-yellow-200 font-semibold mb-2">Methodology Note</p>
|
| 158 |
<p className="text-yellow-100 text-sm leading-relaxed">
|
| 159 |
+
<strong>Additive Visualization:</strong> This chart shows cumulative impact by progressively adding each synthesis method's individual attack success rate.
|
| 160 |
+
Values >100% represent sythesis of multiple conversations off one failed, human seed conversation.
|
| 161 |
+
Results are based on HarmBench Grading methodology and should be interpreted as relative performance indicators.
|
| 162 |
</p>
|
| 163 |
</div>
|
| 164 |
</div>
|
|
|
|
| 178 |
|
| 179 |
{/* Chart Container */}
|
| 180 |
<div className="bg-white rounded-2xl shadow-2xl p-8">
|
| 181 |
+
<div className="space-y-8">
|
| 182 |
{benchmarkData.map((modelData, index) => {
|
| 183 |
const currentValue = getCurrentValue(modelData, currentPhase);
|
| 184 |
const baselineValue = modelData.direct_conversation;
|
|
|
|
| 189 |
|
| 190 |
return (
|
| 191 |
<div key={modelData.model} className="relative">
|
| 192 |
+
{/* Model Name and Methods - Fixed Height Container */}
|
| 193 |
+
<div className="flex items-start justify-between mb-3 min-h-[60px]">
|
| 194 |
+
<div className="flex-1">
|
| 195 |
+
<h3 className="font-semibold text-gray-800 text-lg mb-1">
|
| 196 |
{modelData.model}
|
| 197 |
</h3>
|
| 198 |
+
<div className="text-sm text-gray-600 leading-tight">
|
| 199 |
+
<span className="font-medium">Methods: </span>
|
| 200 |
+
<span>{methodsAdded.join(' + ')}</span>
|
| 201 |
+
</div>
|
| 202 |
+
{/* Method breakdown - Always show, even during baseline */}
|
| 203 |
+
<div className="mt-1 min-h-[20px]">
|
| 204 |
+
{currentPhase === 'baseline' && (
|
| 205 |
+
<div className="text-xs text-gray-500 flex flex-wrap gap-x-4 gap-y-1">
|
| 206 |
+
<span className="text-blue-600">Base: {baselineValue.toFixed(1)}%</span>
|
| 207 |
+
<span className="text-gray-400">Ready to add synthesis methods...</span>
|
| 208 |
+
</div>
|
| 209 |
+
)}
|
| 210 |
+
{currentPhase === 'additive_synthesis' && (
|
| 211 |
+
<div className="text-xs text-gray-500 flex flex-wrap gap-x-4 gap-y-1">
|
| 212 |
+
<span className="text-blue-600">Base: {baselineValue.toFixed(1)}%</span>
|
| 213 |
+
{currentMethodIndex === 0 && (
|
| 214 |
+
<span className="text-gray-400">Starting to add methods...</span>
|
| 215 |
+
)}
|
| 216 |
+
{synthesisMethodsOrder.slice(0, currentMethodIndex).map(method => {
|
| 217 |
+
if (modelData[method] !== undefined) {
|
| 218 |
+
return (
|
| 219 |
+
<span key={method} className="text-green-600">
|
| 220 |
+
+{method.replace(/_/g, ' ')}: {modelData[method].toFixed(1)}%
|
| 221 |
+
</span>
|
| 222 |
+
);
|
| 223 |
+
}
|
| 224 |
+
return null;
|
| 225 |
+
})}
|
| 226 |
+
</div>
|
| 227 |
+
)}
|
| 228 |
+
</div>
|
| 229 |
</div>
|
| 230 |
+
<div className="text-right ml-4">
|
| 231 |
<span className="text-2xl font-bold text-gray-700">
|
| 232 |
{currentValue.toFixed(1)}%
|
| 233 |
</span>
|
| 234 |
{currentPhase === 'additive_synthesis' && totalGain > 0 && (
|
| 235 |
<div className="text-sm font-semibold text-green-600">
|
| 236 |
+
+{totalGain.toFixed(1)}% gain
|
| 237 |
</div>
|
| 238 |
)}
|
| 239 |
</div>
|
|
|
|
| 242 |
{/* Progress Bar */}
|
| 243 |
<div className="relative h-12 bg-gray-200 rounded-full overflow-hidden">
|
| 244 |
<div
|
| 245 |
+
className={`h-full bg-gradient-to-r ${getBarColor(modelData, currentPhase)} rounded-full transition-all duration-[2000ms] ease-out flex items-center justify-end pr-4`}
|
| 246 |
style={{ width: `${Math.max(barWidth, 5)}%` }}
|
| 247 |
>
|
| 248 |
<div className="text-white font-semibold text-sm">
|
|
|
|
| 250 |
</div>
|
| 251 |
</div>
|
| 252 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 253 |
</div>
|
| 254 |
);
|
| 255 |
})}
|
|
|
|
| 263 |
</div>
|
| 264 |
<div className="flex items-center space-x-2">
|
| 265 |
<div className="w-4 h-4 bg-gradient-to-r from-green-500 to-green-600 rounded"></div>
|
| 266 |
+
<span className="text-gray-700">Adding Synthesis Methods</span>
|
| 267 |
</div>
|
| 268 |
</div>
|
| 269 |
</div>
|
| 270 |
|
| 271 |
{/* Footer Info */}
|
| 272 |
<div className="mt-8 text-center text-slate-400 space-y-2">
|
| 273 |
+
<p>Animation cycles every 10 seconds: baseline (4s) → progressive method addition (2.5s each) → smooth 2s bar growth</p>
|
| 274 |
<p className="text-sm">
|
| 275 |
Data from SafetyBench Aug 2025 • Synthesis methods test different attack vectors
|
| 276 |
</p>
|