Skip to content
Back to skills

Residual Quantizers

ASecurity

"Operate stacked and grouped residual vector quantizers in

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

Works with

  • api

Security analysis

A100/100

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

Scanned September 9, 2026

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

Installs into .claude/skills of the current project.

Are you the author of Residual Quantizers?

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

Security grade badge for Residual Quantizers
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-residual-quantizers/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-residual-quantizers)

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: residual-quantizers
description: "Operate stacked and grouped residual vector quantizers in
  vector-quantize-pytorch."
disable-model-invocation: true
metadata:
  disco-role: operating
license: MIT
---

# Residual Quantizers

Use this sub-skill when the task involves stacked residual codebook quantization with `ResidualVQ` or feature-split residual quantization with `GroupedResidualVQ`.

## Route here for

- `ResidualVQ` setup, forward output shapes, `return_all_codes`, `get_output_from_indices`, and saved-index reconstruction.
- Shared or stochastic residual codebooks: `shared_codebook`, `stochastic_sample_codes`, and `sample_codebook_temp`.
- Training-time residual codebook dropout: `quantize_dropout`, cutoff/multiple settings, and why indices can contain `-1`.
- Layer-specific codebook sizes such as `codebook_size=(5, 128, 256)` and inferred quantizer depth.
- Beam-search residual quantization with `beam_size`, `eval_beam_size`, and quantizer score weights.
- DiVeQ residual codebook updates (`diveq=True`) and implicit neural codebooks (`implicit_neural_codebook=True`).
- `GroupedResidualVQ` feature-group splitting, grouped indices, grouped commit losses, and grouped reconstruction.

## Route elsewhere

- Single-stage `VectorQuantize`, multi-headed base VQ, random projection quantizers, codebook health, or manual EMA updates: use the vector-quantization sub-skill.
- `ResidualFSQ` or `GroupedResidualFSQ`: use the scalar-quantizers sub-skill.
- `ResidualLFQ` or `GroupedResidualLFQ`: use the lookup-free-and-latent sub-skill.
- `ResidualSimVQ`: use the sim-and-hierarchical sub-skill.

## Operating sequence

1. Read [API reference](references/api-reference.md) for constructor/forward signatures, exact return tuples, and shape contracts.
2. Read [workflows](references/workflows.md) for common recipes: reconstruction from indices, grouped residual settings, stochastic/shared codebooks, dropout, beam search, DiVeQ, and implicit neural codebooks.
3. Read [troubleshooting](references/troubleshooting.md) before debugging shape, `-1` index, beam-memory, tuple-codebook, or DiVeQ loss behavior.
4. For an installation/runtime smoke check, run `python scripts/smoke_residual_quantizers.py --help` or `python scripts/smoke_residual_quantizers.py` from this sub-skill directory.

## Minimum usage facts

- Default tensor layout is sequence-last-features: input `(batch, sequence, dim)` returns quantized output with the same shape.
- `ResidualVQ` indices normally have shape `(batch, sequence, num_quantizers)`; `GroupedResidualVQ` indices normally have shape `(groups, batch, sequence, num_quantizers)`.
- `get_output_from_indices(indices)` reconstructs quantized outputs from the current model codebooks, not from standalone indices. Save/load the model state together with indices.
- Prefer `.eval()` when generating indices intended for later reconstruction or cross-entropy targets; training dropout can mark skipped residual layers with `-1`.

Files in this skill

  • SKILL.md2.9 KB
  • references/api-reference.md9.5 KB
  • references/troubleshooting.md8.2 KB
  • references/workflows.md7.8 KB
  • scripts/smoke_residual_quantizers.py6 KB

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.