Skip to content

Add group sparsity support #5

@MaxGhenis

Description

@MaxGhenis

Description

Implement group sparsity to prune entire structures (filters, attention heads, etc.) rather than individual weights.

Motivation

Structured pruning can provide better hardware acceleration since it maintains dense tensor operations on smaller tensors, rather than sparse operations on large tensors.

Proposed Implementation

  • Group gates for conv filters: single gate per filter
  • Group gates for attention heads: single gate per head
  • Group gates for channels: single gate per channel

Example

# Prune entire conv filters
conv = L0Conv2d(64, 128, 3, structured='filter')

# Prune attention heads
attn = L0MultiheadAttention(embed_dim=512, num_heads=8, structured='head')

References

  • Section 3.2 of the L0 paper on structured sparsity

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions