Module mimir.attacks.loss

Straight-forward LOSS attack, as described in https://ieeexplore.ieee.org/abstract/document/8429311

Classes

class LOSSAttack (config: ExperimentConfig, model: Model)
Expand source code
class LOSSAttack(Attack):

    def __init__(self, config: ExperimentConfig, model: Model):
        super().__init__(config, model, ref_model=None)

    @ch.no_grad()
    def _attack(self, document, probs, tokens=None, **kwargs):
        """
            LOSS-score. Use log-likelihood from model.
        """
        return self.target_model.get_ll(document, probs=probs, tokens=tokens)

Ancestors

Inherited members