Skip to content
Back to skills

Low Rank Adapter Layer

ASecurity

Construct LoRA low-rank linear adapters and verify merged inference equivalence without relying on the original implementation repository.

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

Security analysis

A100/100

Scanned September 9, 2026

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

Installs into .claude/skills of the current project.

Are you the author of Low Rank Adapter Layer?

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

Security grade badge for Low Rank Adapter Layer
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-low-rank-adapter-layer/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-low-rank-adapter-layer)

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

SKILL.md
---
name: low_rank_adapter_layer
description: Construct LoRA low-rank linear adapters and verify merged inference equivalence without relying on the original implementation repository.
---

# Low-Rank Adapter Layer

Use this skill when implementing or validating the LoRA layer mechanism from the paper. It is appropriate for linear, embedding-like, or projection-style weights where a frozen base matrix receives a trainable low-rank update. Do not use it to claim full benchmark recovery by itself; it only validates the adapter layer contract.

## Inputs
- Frozen base weight matrix `W0` with shape output by input.
- Rank `r`, alpha scale, LoRA matrix `A` with shape rank by input, and `B` with shape output by rank.
- One or more input vectors for forward checks.

## Outputs
- Dynamic prediction `W0 x + (alpha/r) B A x`.
- Merged weight `W0 + (alpha/r) B A` and numerical merge-equivalence evidence.
- Trainable parameter count `r * (input + output)`.

## Workflow
1. Keep the base weight immutable and represent adaptation only through `A` and `B`.
2. Scale the low-rank branch by `alpha / r` when rank is positive.
3. Initialize or test `B = 0` to confirm the initial model exactly matches the frozen pretrained model.
4. For inference validation, merge the low-rank delta into the base weight and compare merged and dynamic predictions.
5. Report rank, parameter count, and maximum absolute prediction difference as explicit mechanism evidence.

## Validation
Run `python scripts/lora_math.py --input <fixture.json>` or the included tests. The tests check zero-branch identity, trainable-parameter counting, and merged inference equivalence.

## Limitations
This skill uses deterministic matrix arithmetic and does not load PyTorch, Transformers, pretrained checkpoints, or the original LoRA repository.

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…