wenmin-wu/ds-skills/kv-cache-prefix-scoring
Claude Code and agent skill by wenmin-wu/ds-skills
Trust tier 2
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
Shares KV cache from a common prefix (context+question) across multiple answer suffixes for efficient multi-choice scoring.
Install
npx vskill@latest install wenmin-wu/ds-skills/kv-cache-prefix-scoringSKILL.md
KV Cache Prefix Scoring
Overview
For multiple-choice QA, the context and question are shared across all answer options. Compute the KV cache once for this shared prefix, then score each answer suffix by expanding the cache. This avoids redundant computation — scoring 5 options costs ~1.2x of a single forward pass instead of 5x.
Quick Start
Workflow
- Tokenize shared prefix (context + question)
- Run single forward pass to get KV cache
- For each answer option, run forward pass with cached KV states
- Score each option by mean log-probability of suffix tokens
- Rank options by score
Key Decisions
- Memory: Cache is ~2x model hidden size per layer; fits for models up to 13B on T4
- Scoring metric: Mean log-prob normalizes for option length differences
- Batch suffixes: If GPU memory allows, batch all suffixes in one pass
- Applicability: Any LLM multiple-choice or ranking task
References
- Kaggle LLM Science Exam (Kaggle)
- Source: platypus2-70b-with-wikipedia-rag
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/llm/kv-cache-prefix-scoring/SKILL.md
Popularity
- Repository stars
- 35
- Repository forks
- 2
- 7-day trend score
- 18
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 28 Apr 2026, 6 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/wenmin-wu/ds-skills/kv-cache-prefix-scoring)