Skip to content
Back to skills

Soft Regularization

ASecurity

Compute soft movement-pruning sigmoid sparsity penalties and gradients for threshold-mask recovery checks.

  • 247 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 9, 2026
developmentpython

Security analysis

A100/100

Pro scans all 4 files and shows the line behind each finding

Scanned September 9, 2026

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

Installs into .claude/skills of the current project.

Are you the author of Soft Regularization?

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

Security grade badge for Soft Regularization
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-soft-regularization/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-soft-regularization)

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

Download with Pro
SKILL.md
---
name: soft_regularization
description: Compute soft movement-pruning sigmoid sparsity penalties and gradients for threshold-mask recovery checks.
---

# Soft Movement Sparsity Regularization

Use this skill when implementing or auditing soft movement pruning. It computes the paper penalty `lambda_mvp * sum(sigmoid(S))` and the corresponding score-gradient contribution.

## Inputs
- `scores`: flat or nested numeric scores.
- `lambda_mvp`: nonnegative regularization strength.
- Optional `threshold` and `lr` for before/after keep-ratio diagnostics.

## Outputs
Penalty value, gradient contribution with the same shape as scores, sigmoid mass, and optional threshold keep-ratio diagnostics.

## Workflow
1. Compute stable sigmoid values.
2. Sum sigmoid scores and multiply by `lambda_mvp`.
3. Compute `lambda_mvp * sigmoid(S) * (1 - sigmoid(S))`.
4. Optionally simulate a regularization-only gradient step to show scores are pushed downward.

## Validation
Run `python tests/test_soft_regularization.py`. Tests check zero-lambda behavior, sigmoid-at-zero values, and non-increasing scores under the penalty update.

## Limitations
This skill supplies only the regularizer component; task loss and score masks must be handled by other skills.

Files in this skill

  • SKILL.md1.2 KB
  • scripts/soft_regularization.py1.3 KB
  • tests/test_soft_regularization.py339 B
  • tests/test_soft_threshold.py303 B

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…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.