Skip to content
Back to skills

Dlr Margin Loss

ASecurity

Compute DLR-style logit margin losses for APGD-DLR adversarial optimization checks.

  • 247 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 9, 2026
toolspythongit

Security analysis

A100/100

Scanned September 9, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill dlr_margin_loss --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Dlr Margin Loss?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Dlr Margin Loss
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-dlr-margin-loss/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-dlr-margin-loss)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

SKILL.md
---
name: dlr_margin_loss
description: Compute DLR-style logit margin losses for APGD-DLR adversarial optimization checks.
---

# DLR Margin Loss

Use this skill when an adversarial attack needs the AutoAttack DLR loss or when validating that a proxy attack preserves APGD-DLR semantics. Do not use it for binary classifiers or tasks without ordered class logits.

## Inputs
- A logit vector with at least three classes.
- The true class index.

## Outputs
- Scalar untargeted DLR loss.
- Ranking diagnostics from the helper script.

## Workflow
1. Sort logits while retaining the true-class position.
2. Identify the strongest non-true competitor.
3. Normalize the true-versus-competitor margin by the spread between top and third logits.
4. Maximize this loss during untargeted APGD.

## Validation
Run `python tests/test_dlr.py` or the generated skill validator.

## Limitations
This pure-Python helper is intended for deterministic small examples and mirrors the untargeted loss needed by the recovery harness.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…