SCOREFramework<T>
Models & Types · AiDotNet.Diffusion.Safety
SCORE: Selective Concept Obliteration for Responsible Editing in diffusion models.
For Beginners
SCORE works like a content filter built into the model itself. Instead of blocking outputs after generation, it changes the model so it can’t generate certain content in the first place. When the model encounters a prompt for erased content, it automatically redirects to generating something neutral instead.
How It Works
SCORE provides a structured framework for selectively removing unsafe or undesirable concepts from diffusion models while preserving the model’s overall generation quality. It operates by fine-tuning cross-attention layers to redirect concept associations, effectively “remapping” the erased concept to a neutral alternative.
Reference: Lu et al., “SCORE: Selective Concept Obliteration for Responsible Editing”, 2024
Constructors
| Constructor | Summary |
|---|---|
SCOREFramework(double remappingStrength, double preservationWeight) |
Initializes a new SCORE framework instance. |
Properties
| Property | Summary |
|---|---|
double PreservationWeight { get; } |
Gets the preservation weight. |
double RemappingStrength { get; } |
Gets the remapping strength. |
int RemappingCount { get; } |
Gets the number of registered concept remappings. |
Methods
| Method | Summary |
|---|---|
T ComputeSCORELoss(Vector<T> originalAttention, Vector<T> remappedAttention, Vector<T> preservedAttention, Vector<T> originalPreserved) |
Computes the SCORE training loss for cross-attention remapping. |
bool IsConceptErased(string concept) |
Checks whether a concept has a registered remapping. |
string GetReplacement(string concept) |
Gets the neutral replacement for an erased concept. |
void AddConceptRemapping(string targetConcept, string neutralReplacement) |
Registers a concept to be remapped to a neutral alternative. |