Skip to content
Back to skills

Structured Sparsity Patterns

ASecurity

Build deterministic N:M semi-structured pruning masks from Wanda or other importance scores.

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

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 structured_sparsity_patterns --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Structured Sparsity Patterns?

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

Security grade badge for Structured Sparsity Patterns
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-structured-sparsity-patterns/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-structured-sparsity-patterns)

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: structured_sparsity_patterns
description: Build deterministic N:M semi-structured pruning masks from Wanda or other importance scores.
---

# Structured Sparsity Patterns

Use this skill when a Wanda recovery or implementation needs 2:4, 4:8, or other N:M pruning masks. It operates on score matrices after activation-aware scoring has already been computed.

## Inputs
- Score matrix shaped outputs by inputs.
- `prune_n`: number of entries to prune in each group.
- `prune_m`: group width along the input-channel dimension.

## Outputs
- Boolean mask with exactly `prune_n` true values per complete group in each row.
- Metadata describing complete groups, ignored tail width, and achieved sparsity.

## Workflow
1. Validate `0 < prune_n <= prune_m`.
2. Split each row into consecutive groups of width `prune_m`.
3. In each complete group, mark the `prune_n` lowest scores for pruning with deterministic tie-breaking by column index.
4. Leave incomplete tail groups unpruned unless the caller pads them explicitly.

## Validation
Tests assert exact group counts and unpruned tail behavior.

## Limitations
The skill only creates masks. Applying them and checking model quality belongs to an evaluation skill.

Files in this skill

  • SKILL.md1.2 KB
  • scripts/structured.py1.3 KB
  • tests/test_stress_nm.py237 B
  • tests/test_structured_sparsity_patterns.py236 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.