Skip to content
Back to skills

Vpt Prompt Token Insertion

ASecurity

Build shallow and deep Visual Prompt Tuning token sequences for Transformer-style image embeddings.

  • 247 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 9, 2026
toolspython

Security analysis

A100/100

Scanned September 9, 2026

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

Installs into .claude/skills of the current project.

Are you the author of Vpt Prompt Token Insertion?

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

Security grade badge for Vpt Prompt Token Insertion
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-vpt-prompt-token-insertion/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-vpt-prompt-token-insertion)

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

SKILL.md
---
name: vpt_prompt_token_insertion
description: Build shallow and deep Visual Prompt Tuning token sequences for Transformer-style image embeddings.
---

# VPT Prompt Token Insertion

Use this skill when implementing or checking Visual Prompt Tuning (VPT) token formatting for a vision Transformer or a reduced VPT proxy. Do not use it to compute losses, choose hyperparameters, or emit classification metrics.

## Inputs

- A batch of token embeddings shaped as `[batch, 1 + patches, hidden]` where the first token is `[CLS]`.
- Prompt embeddings shaped as `[num_prompt_tokens, hidden]`.
- Optional deep prompt embeddings shaped as `[layers, num_prompt_tokens, hidden]`.
- Configuration metadata with `location="prepend"`, prompt count, hidden size, and whether prompts are shallow or deep.

## Outputs

- Prompt-augmented token batches shaped as `[batch, 1 + prompts + patches, hidden]`.
- Metadata describing prompt count, hidden size, and placement.
- Validation errors for unsupported prompt locations or shape mismatches.

## Workflow

1. Confirm the input sequence has `[CLS]` plus at least one image token.
2. Validate the prompt hidden size against the token hidden size.
3. Preserve `[CLS]` at position 0 and preserve image-token order.
4. Broadcast prompt embeddings across the batch and insert them immediately after `[CLS]`.
5. For deep VPT, replace the existing prompt-token slots with the layer-specific prompt bank while keeping `[CLS]` and image tokens unchanged.
6. Return formatting metadata; leave training, pooling, and evaluation to downstream skills.

## Validation

Run `python tests/test_prompt_ops.py` from this skill directory, or run the Distiller skill validator with `--run-tests`.

## Limitations

This skill implements the paper's default prepend-token VPT mechanism. Pixel-padding prompt variants and pooling choices are intentionally outside this module's contract.

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.