LLaVA-OneVision-2 is an openly released multimodal AI model and training framework that processes images, long-form video, and spatial information. Researchers use it to train, evaluate, and reproduce vision-language models with the project’s released data, encoders, checkpoints, and training records. The catalogue skills support work with this model and its training resources.
Borrowing it
Nothing to install: this file belongs to EvolvingLMMs-Lab/LLaVA-OneVision-2. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/EvolvingLMMs-Lab/LLaVA-OneVision-2/main/.opencode/skills/cu-lengths-attention-flow/SKILL.mdgit clone --depth 1 https://github.com/EvolvingLMMs-Lab/LLaVA-OneVision-2Wrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/evolvinglmms-lab/llava-onevision-2/cu-lengths-attention-flow)<a href="https://agentmods.dev/skills/evolvinglmms-lab/llava-onevision-2/cu-lengths-attention-flow"><img src="https://agentmods.dev/badge/skills/evolvinglmms-lab/llava-onevision-2/cu-lengths-attention-flow/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/evolvinglmms-lab/llava-onevision-2/cu-lengths-attention-flow"><img src="https://agentmods.dev/badge/skills/evolvinglmms-lab/llava-onevision-2/cu-lengths-attention-flow.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector pass
What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00035 | $0.03510 |
| Opus 5.5 | $0.00014 | $0.01404 |
| Sonnet 5.5 | $0.00007 | $0.00702 |
| Haiku 4.5 | $0.00003 | $0.00351 |
Grade A, and why
cu-lengths-attention-flow scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 278 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Purpose / 用途
Use this skill when reasoning about attention boundaries in the LLaVA-OneVision2 forward pass — specifically how cu_lengths and patch_positions control attention at different stages of the model.
在分析 LLaVA-OneVision2 前向传播中的 attention 边界时使用这个 skill——具体来说,cu_lengths 和 patch_positions 如何在模型的不同阶段控制 attention。
This skill is specifically for:
- Understanding the difference between ViT-level and LLM-level attention control
- Debugging packed vs non-packed attention behavior
- Reasoning about cross-sample isolation in packed sequences
- Understanding why
patch_positionsgrouping does NOT carry into the LLM
这个 skill 专门用于:
- 理解 ViT 层和 LLM 层 attention 控制的区别
- 调试 packed 和 non-packed 的 attention 行为
- 分析 packed 序列中跨样本隔离机制
- 理解为什么
patch_positions的分组不会延续到 LLM 中
Key Files / 关键文件
| File | Role |
|---|---|
aiak_training_llm/train/pretrain/pretrain_llava_onevision2.py |
Forward function — decides packed vs non-packed path based on cu_lengths shape |
aiak_training_llm/train/sft/utils.py |
_get_packed_sequence_params() — builds PackedSeqParams from attention_mask for SFT |
aiak_training_llm/data/multimodal/task_encoder.py |
batch() — sets cu_lengths to [[0]] (dummy) for non-packed, or stacks real cu_lengths for packed |
aiak_training_llm/data/multimodal/task_encoder.py |
pack_selected_samples() — constructs cu_lengths = [0, len_1, len_1+len_2, ...] for offline packed data |
aiak_training_llm/models/llava_onevision2/onevision_encoder_model.py |
ViT encoder — uses patch_positions for local/shared attention |
aiak_training_llm/data/multimodal/qwen2vl_task_encoder.py |
process_sft_qa() — generates patch_positions from image_grid_thw |
Core Concept: Two Independent Attention Control Mechanisms / 核心概念:两套独立的 Attention 控制机制
Overview Diagram / 概览图
┌─────────────────────────────────────────────────┐
│ ViT Encoder │
│ │
│ Control: patch_positions (temporal dimension) │
│ Effect: Local/shared attention │
│ e.g. 4 images share one attention │
│ window via same temporal index │
│ │
│ Output: visual embeddings │
└──────────────────┬──────────────────────────────┘
│ (embeddings replace image
│ placeholder tokens)
▼
┌─────────────────────────────────────────────────┐
│ LLM Decoder │
│ │
│ Control: cu_lengths (cumulative sub-seq lens) │
│ Effect: Determines attention domain │
│ │
│ NON-PACKED: cu_lengths == [[0]] │
│ → full causal attention │
│ → ALL tokens see ALL previous tokens │
│ → patch_positions grouping is GONE │
│ │
│ PACKED: cu_lengths = [0, a, a+b, ...] │
│ → block-diagonal causal attention │
│ → sub-sequences isolated from each other │
│ → within each sub-seq: full causal │
└─────────────────────────────────────────────────┘
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2mo ago First seen · 278 lines · 35 tokens per session scan A b8d43c8fae67
cu-lengths-attention-flow is a skill published in the GitHub repository EvolvingLMMs-Lab/LLaVA-OneVision-2 (1,232 stars, last pushed yesterday), licensed Apache-2.0. It adds 35 tokens to every session and 3,510 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
cu-lengths-attention-flow compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| cu-lengths-attention-flowEvolvingLMMs-Lab/LLaVA-OneVision-2 | Skill | 1.2k | yesterday | Apache-2.0 | A | 35 | OpenCode |
| add-new-modelBlaizzy/mlx-vlm | Skill | 5.7k | 4d ago | MIT | A | 83 | Claude Code |
| cli-inferenceBlaizzy/mlx-vlm | Skill | 5.7k | 4d ago | MIT | A | 67 | Claude Code |
| convert-quantizeBlaizzy/mlx-vlm | Skill | 5.7k | 4d ago | MIT | A | 99 | Claude Code |
| server-inferenceBlaizzy/mlx-vlm | Skill | 5.7k | 4d ago | MIT | A | 80 | Claude Code |
| hf-cache-modelsBlaizzy/mlx-vlm | Skill | 5.7k | 4d ago | MIT | A | 38 | Claude Code |
| ml-llm-wikisammcj/agentic-coding | Skill | 168 | 2d ago | Apache-2.0 | A | 80 | Claude Code, Codex |