git404hub

what is swim fr?

humanmllm/swim — explained in plain English

Analysis updated 2026-05-18

75PythonAudience · researcherComplexity · 5/5Setup · hard

tl;dr

Official CVPR 2026 code for SWIM, a video MLLM fine-tuned from Qwen2.5-VL-7B that aligns attention maps with referring text so the model describes a named object in a busy scene without hallucinating.

vibe map

mindmap
  root((SWIM))
    Inputs
      Video frames
      Natural language reference
      Question prompt
    Outputs
      Object caption
      Question answer
      Attention maps
    Use Cases
      Fine-grained video QA
      Object-referring captioning
      Attention-aligned training research
    Tech Stack
      Python
      PyTorch
      Transformers
      DeepSpeed
      FlashAttention
      Qwen2.5-VL

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

what do people make with this?

VIBE 1

Run video object-referring inference with SWIM-7B on your own clips

VIBE 2

Fine-tune a vision-language model using the NL-Refer dataset and attention supervision loss

VIBE 3

Reproduce the CVPR 2026 benchmark numbers on description and multiple-choice QA

VIBE 4

Adapt the <ins> tagging trick to align attention with referring tokens in another MLLM

what's the stack?

PythonPyTorchTransformersDeepSpeedFlashAttention

how it stacks up fr

humanmllm/swimjuew/skill-routing-kitjustxor/pythonroamap2026
Stars757575
LanguagePythonPythonPython
Setup difficultyhardeasyeasy
Complexity5/52/51/5
Audienceresearcherdevelopervibe coder

Figures from each repo's GitHub metadata at analysis time.

how do i run it?

Difficulty · hard time til it works · 1day+

Requires installing the bundled transformers fork in editable mode and 8 GPUs with DeepSpeed Zero-3 for training.

in plain english

SWIM is the official code release for a research paper that will appear at CVPR 2026. The full name is See What I Mean: Aligning Vision and Language Representations for Video Fine-grained Object Understanding. The work comes from Nankai University and Alibaba's Tongyi Lab, and the goal is to make a multimodal large language model describe a specific object in a video accurately when the user simply names that object in words. The motivation, as stated in the README, is that existing video models often hallucinate when asked about one particular object in a busy scene, partly because their attention drifts to the wrong regions of the frame. SWIM adds a training signal that watches the attention maps directly. During supervised fine-tuning, tokens that name the target entity are wrapped in special <ins>...</ins> tags, and an extra loss term encourages the model to focus its attention on the visual region that actually corresponds to those tagged tokens. Alongside the model, the authors publish a dataset called NL-Refer. It is built on top of an existing dataset called VideoRefer-700K, which marked target objects by drawing coloured masks on video frames. NL-Refer replaces those visual prompts with natural-language descriptions written by GPT-4o, with the key referring word tagged for attention supervision. The release includes about 125 thousand detailed-caption samples, 10 thousand question-answer samples, and benchmark splits for description generation and multiple-choice question answering. The shipped model is SWIM-7B, fine-tuned from Qwen2.5-VL-7B-Instruct, and it uses the same inference API as the base model. The README walks through a Python example with the Hugging Face Transformers library and the qwen_vl_utils helper. Only the language model side is updated during fine-tuning, while the vision encoder stays frozen to keep training affordable. Training itself runs on eight GPUs using DeepSpeed Zero-3, BF16 precision, and Flash Attention 2. One installation detail to watch: SWIM depends on a customised fork of Hugging Face Transformers that is shipped inside the repository, in a transformers/ folder. You must install that local copy in editable mode, not the version from PyPI, because the attention supervision logic lives in the fork. Model weights and the NL-Refer dataset are hosted on Hugging Face under the BBBBCHAN account.

prompts (copy fr)

prompt 1
Walk me through running SWIM-7B inference on a 10-second video clip using the Transformers example and qwen_vl_utils
prompt 2
Set up the SWIM training pipeline with DeepSpeed Zero-3 and BF16 on 8 GPUs and reproduce one epoch on NL-Refer
prompt 3
Explain how the attention supervision loss in SWIM uses <ins> tags and where in the patched transformers fork it lives
prompt 4
Convert the NL-Refer 125k caption split into a Hugging Face dataset for evaluation against a baseline Qwen2.5-VL
prompt 5
Adapt SWIM's attention alignment idea to a 3B-class video LLM with limited GPU memory

Frequently asked questions

what is swim fr?

Official CVPR 2026 code for SWIM, a video MLLM fine-tuned from Qwen2.5-VL-7B that aligns attention maps with referring text so the model describes a named object in a busy scene without hallucinating.

What language is swim written in?

Mainly Python. The stack also includes Python, PyTorch, Transformers.

How hard is swim to set up?

Setup difficulty is rated hard, with roughly 1day+ to a first successful run.

Who is swim for?

Mainly researcher.

peek the repo → explain another one

This repo across BitVibe Labs

double-check against the repo, no cap.