wikillm

Paper · 2023-06-08 · cs.CV

Video-ChatGPT: Towards Detailed Video Understanding via Large Vision and Language Models

Video-ChatGPT feeds frames through a frozen CLIP ViT-L/14 encoder, pools them into temporal and spatial tokens, and maps them into Vicuna-7B with one trainable linear layer. That layer is tuned on 100K video-instruction pairs from human and GPT-assisted annotation. Author-reported: 2.40 correctness on a 1-5 GPT-judged benchmark, the top score among the compared video chat models.

Multimodal language modelVisual instruction tuningVision Transformer (ViT) backbonesvideomultimodalvision-languageinstruction-tuningevaluation

arXivPDFCodeMarkdown10 min read

AI-compiled by claude-haiku-5-5 on 2026-10-18, not yet reviewed by a human. Every claim cites its source; check it when a detail matters.

In plain words

Language models that chat well can read text but cannot watch a video. This paper gives one such model a view of the video. A standard image model looks at each frame, its output is condensed into a short list of vectors, and a single simple layer translates those vectors into the chatbot's own input format. The chatbot is then trained on a set of about 100,000 questions and answers about videos. Some were written by people and some were generated with other AI tools.

The authors also propose a way to grade video chat answers. Another AI model acts as the judge and scores answers on aspects such as correctness, level of detail and consistency.

TL;DR

  • Video-ChatGPT = frozen CLIP ViT-L/14 frame encoder, spatiotemporal pooling, one trainable linear projection, Vicuna-7B language model §3.1 fig. 1.
  • Only the projection is trained, on 100K video-instruction pairs §3.2 §4 §5.1.
  • The paper also proposes a GPT-3.5-judged benchmark with five aspects, plus zero-shot video QA §5.2.
  • All numbers are author-reported. The judge is a closed API model.

Problem

Image-based vision-language models are the usual base for multimodal chat, but they generally do not consider video input §1. Training a video model from scratch needs video-caption data that is scarce, and substantial compute §3. The paper also notes that no quantitative benchmark existed for judging video conversation models §1.

Method

Overview

The model starts from LLaVA, which joins a CLIP image encoder to Vicuna and is trained on generated instruction data §3 fig. 1. Video-ChatGPT adapts that design to video: the encoder runs on every frame, and the frame features are pooled along two axes. The result is a fixed-layout token sequence with a temporal part and a spatial part. The encoder and language model stay frozen. Only the linear projection learns §3.1 §3.2.

Steps

  1. Frame encoding. Each of the T frames is encoded independently by CLIP ViT-L/14 into an h x w grid of D-dimensional patch features, with patch size p = 14 and h = H/p, w = W/p §3.1. The grid has N = h x w patches.
  2. Temporal tokens. Average over the spatial grid, giving one vector per frame (T vectors of size D) §3.1.
  3. Spatial tokens. Average over frames, giving one vector per patch position (N vectors of size D) §3.1.
  4. Concatenation. Stack temporal and spatial tokens into the video feature matrix of shape (T+N) x D §3.1 eq. 1.
  5. Projection. A single trainable linear layer g maps each row into the language model's embedding space of width K §3.1 eq. 2. The paper calls g an adapter and says more complex designs are possible §3.1.
  6. Concatenation with text. The projected video tokens are concatenated with the embedded text query, whose length is L, and fed to the language model §3.1.
  7. Instruction tuning. The prompt has the form USER: <Instruction> <video tokens> Assistant:. The loss is the autoregressive likelihood of the answer tokens. Only g is updated §3.2.
Pseudocode
# Build video tokens for one clip  [§3.1] [eq. 1] [eq. 2]
# Input:  frames (T, H, W, 3)
# Output: video tokens (T+N, K) in the language model's embedding space

def encode_video(frames):
    # Frozen CLIP ViT-L/14 patch features per frame  [§3.1]
    frame_features = clip_vit_l14(frames)            # (T, h, w, D)
    # Average over the spatial grid: one vector per frame  [§3.1]
    temporal_tokens = mean(frame_features, over=(h, w))  # (T, D)
    # Average over frames: one vector per patch position  [§3.1]
    spatial_tokens = mean(frame_features, over=T)        # (N, D)
    # Stack both kinds of tokens  [§3.1] [eq. 1]
    video_features = concat(temporal_tokens, spatial_tokens)  # (T+N, D)
    # Single trainable linear layer g  [§3.1] [eq. 2]
    return linear_g(video_features)                  # (T+N, K)
Pseudocode
# One instruction-tuning step  [§3.2]
# Frozen: CLIP encoder, language model. Trained: linear layer g only.
# Input:  frames, instruction text, answer text

def training_step(frames, instruction, answer):
    # Prompt template: USER: <instruction> <video tokens> Assistant:  [§3.2]
    text_tokens = tokenize(instruction)
    video_tokens = encode_video(frames)
    prompt = concat(text_tokens, video_tokens)
    # Next-token loss on the answer tokens  [§3.2]
    return cross_entropy(language_model(prompt, answer), answer)

Data: video instruction pairs

The dataset has 100,000 video-instruction pairs §4. Two annotation routes are used, and they are mixed in the final set §5.3.

  • Human-assisted. Annotators enrich ActivityNet-200 ground-truth captions with appearance, spatial and temporal details §4.1 fig. 2. The paper describes the annotators as being told to neutralise tone and bias §10.
  • Semi-automatic. BLIP-2 produces frame captions, GRiT produces dense captions for objects, and Tag2Text produces tags for each key frame §4.2 fig. 3. Dense captions are kept only when their vocabulary words agree with the Tag2Text tags. GPT-3.5 then merges the frame captions into one video-level caption and drops details that are inconsistent across frames §4.2 fig. 4.
  • GPT-assisted post-processing. GPT-3.5, prompted with in-context examples, writes question-answer pairs covering detailed descriptions, summaries, creative tasks and conversation §4.3.
Pseudocode
# Keep a dense frame caption only when it agrees with the frame's tags  [§4.2]
# Input:  dense_caption (text), tags (set of strings)
# Output: filtered caption text, or nothing when it is dropped

def keep_dense_caption(dense_caption, tags):
    # Only the words before the first colon are checked
    # [code: data/generate_instruction_qa_semi_automatic.py#L33]
    caption_words = split_words(before_first_colon(dense_caption))
    # Keep only the words that belong to the tag vocabulary
    # [code: data/generate_instruction_qa_semi_automatic.py#L35]
    vocab_words = [w for w in caption_words if w in tag_vocabulary]
    # Drop the caption if any kept word is missing from the tags
    # [code: data/generate_instruction_qa_semi_automatic.py#L37]
    if all(w in tags for w in vocab_words):
        return join(vocab_words)
    return nothing

Hyperparameters

NameValueWhereNotes
Visual encoderCLIP ViT-L/14, frozen§3.1 save_spatio_temporal_clip_features.pyFeatures are precomputed offline in training.
Patch size p14§3.1Stated in text.
Patch grid N256 for 224 x 224 inputsave_spatio_temporal_clip_features.pyPaper gives N = h x w but does not state the input size. Derived from code.
Visual feature width D1024video_chatgpt.pyPaper does not state D.
Feature layerPenultimate hidden layer, CLS token removedsave_spatio_temporal_clip_features.pyNot stated in paper.
Frames per videoUp to 100, uniformly sampledsave_spatio_temporal_clip_features.py save_spatio_temporal_clip_features.pyNot stated in paper. Shorter videos give fewer frames.
Frame resolution224 x 224save_spatio_temporal_clip_features.pyNot stated in paper.
Temporal token countZero-padded to 100save_spatio_temporal_clip_features.pyNot stated in paper.
Total visual tokens356 (100 temporal + 256 spatial)train.pyHard-coded in the dataset class.
Projection gOne linear layer, with bias§3.1 eq. 2 video_chatgpt.pyBias is set by the nn.Linear default. Paper does not mention a bias.
Language modelVicuna-v1.1, 7B, initialised from LLaVA weightsfig. 1 train_video_chatgpt.md
Training data100K video-instruction pairs; 30% human, 70% semi-automatic§4 §5.3
Epochs3§5.1 train_video_chatgpt.md
Learning rate2e-5§5.1 train_video_chatgpt.md
Overall batch size32§5.1 train_video_chatgpt.md4 per GPU on 8 GPUs.
Hardware and time8 x A100 40GB, about 3 hours§5.1
Training precisionbf16train_video_chatgpt.mdNot stated in paper.
Weight decay0train_video_chatgpt.mdNot stated in paper.
Warmup ratio0.03train_video_chatgpt.mdNot stated in paper.
LR scheduleCosinetrain_video_chatgpt.mdNot stated in paper.
OptimizerAdamW (torch)train.pyNot stated in paper.
Max sequence length2048train_video_chatgpt.mdNot stated in paper.
Inference precisionFP16§5.1 model_utils.py
Inference decodingSampling, temperature 0.2, max 1024 new tokenssingle_video_inference.pyNot stated in paper.
Keyframe extractionKatna§5.1Not in the repository.
Tag2TextSwin-B, 384 x 384 input, confidence threshold 0.7§5.1Not in the repository.
GRiTViT-B with CenterNet2§5.1Not in the repository.
Benchmark scoring modelGPT-3.5, 1-5 scale§5.2 evaluate_benchmark_1_correctness.pyCode uses model gpt-3.5-turbo with a 0-5 integer scale. See Paper vs code.
Ablation scoring modelVicuna-1.5 (13B)§5.3 tab. 4

Results

Author-reported. Setup: a test set based on ActivityNet-200, with dense captions and QA pairs from human annotations §5.2. Judge: GPT-3.5 §5.2. All models are 7B variants tab. 1 tab. 2.

Video-based generative benchmark (1-5 scale, higher is better) tab. 1

Evaluation aspectVideo ChatLLaMA AdapterVideo-LLaMAVideo-ChatGPT
Correctness of information2.232.031.962.40
Detail orientation2.502.322.182.52
Contextual understanding2.532.302.162.62
Temporal understanding1.941.981.821.98
Consistency2.242.151.792.37

Zero-shot question answering (accuracy in %, and score on a 1-5 scale) tab. 2

ModelMSVD-QA acc / scoreMSRVTT-QA acc / scoreTGIF-QA acc / scoreActivityNet-QA acc / score
FrozenBiLM32.2 / --16.8 / --41.0 / --24.7 / --
Video Chat56.3 / 2.845.0 / 2.534.4 / 2.326.5 / 2.2
LLaMA Adapter54.9 / 3.143.8 / 2.7- / -34.2 / 2.7
Video-LLaMA51.6 / 2.529.6 / 1.8- / -12.4 / 1.1
Video-ChatGPT64.9 / 3.349.3 / 2.851.4 / 3.035.2 / 2.8

Ablation: training data mix (same benchmark as tab. 1) tab. 3

MetricHuman only (30%)Automatic only (70%)Combined
Correctness2.272.352.40
Detail orientation2.492.492.52
Contextual understanding2.502.562.62
Temporal understanding1.851.921.98
Consistency2.212.382.37
Average2.282.342.38

Ablation: open-source judge (Vicuna-1.5 13B as the judge) tab. 4

MetricVideo ChatVideo-LLaMAVideo-ChatGPT
Correctness2.322.102.49
Detail orientation2.502.182.52
Contextual understanding2.762.412.85
Temporal understanding2.272.172.38
Consistency2.952.673.09

The paper reports no variance, seeds or significance tests for these numbers.

Qualitative examples are described in §11 and shown in fig. 5 to fig. 11. The paper does not give them numerical results.

Paper vs code

Code: official repository at commit 8d54ebf README.md. The paper links the repository in its abstract.

No discrepancies found in: the projection formula, the mean pooling directions, the learning rate, the epoch count, or the overall batch size of 32.

Pitfalls

  • Frame budget is not in the paper. The 100-frame cap, the segment-midpoint sampling and the 224 x 224 resize all come from code. Implement them from the code, or your features will not match the released weights.
  • Padding changes the layout. Zero-padding the temporal tokens to 100 happens before the projection. Implementations that pad after projection get different vectors.
  • Layer choice matters. The features come from the penultimate CLIP layer with the CLS token dropped save_spatio_temporal_clip_features.py. Using the final layer or keeping CLS is a silent change.
  • Boundary tokens and template. Training and inference use different system prompts and different question placement (see Paper vs code). Pick one convention and apply it at both ends.
  • Trainable parameters. The paper's claim that only the projection trains does not hold for the code's configuration (see Paper vs code). Decide explicitly whether the embedding matrix is trainable.
  • The judge is a closed model. Tables 1 and 2 rely on GPT-3.5 §5.2. The ablation with Vicuna-1.5 13B shows the same ordering tab. 4, but absolute scores move (for example Video-ChatGPT correctness is 2.40 in tab. 1 and 2.49 in tab. 4). Compare numbers only under the same judge.
  • Small score gaps. Differences of a few hundredths on a 1-5 judge scale are reported without variance. For example the temporal-understanding row in tab. 1 is a tie at 1.98 between Video-ChatGPT and LLaMA Adapter.
  • Blind-test result is near chance. The human-versus-automatic QA test used 50 videos and reached 52% §5.3. That is close to 50%, the chance level for a two-way choice. The paper reads it as evidence the automatic data is reliable.
  • Inference setup is unstated in the paper. Sampling at temperature 0.2, FP16 and up to 1024 new tokens come from code only single_video_inference.py.
  • Long videos and small objects. The authors report difficulty with subtle temporal relations in videos longer than two minutes and with small-object details §7.
  • Cost. Training took about 3 hours on 8 A100 40GB GPUs §5.1. Data generation depends on GPT-3.5 and three off-the-shelf captioning or tagging models §4.2.
  • Data licence. The paper says the dataset is built on ActivityNet, which it describes as MIT-licensed, and that the authors will release their data under MIT §9. We have not verified those terms, and the videos are not in this repository.

Lineage

  • Builds on: LLaVA, "Visual Instruction Tuning" [arXiv:2304.08485], which supplies the CLIP-plus-Vicuna design and the initial weights §3 fig. 1.
  • Compared against: Video Chat, LLaMA Adapter and Video-LLaMA, and FrozenBiLM for zero-shot QA §5.2 tab. 1 tab. 2.

Source and license

Adapted from “Video-ChatGPT: Towards Detailed Video Understanding via Large Vision and Language Models” by Muhammad Maaz, Hanoona Rasheed, Salman Khan, Fahad Shahbaz Khan (arXiv:2306.05424), used under CC BY 4.0. Changes: condensed and restructured for implementation, with tables, equations and algorithms taken from the paper and its code, each cited to its source. Not affiliated with or endorsed by the authors. Code citations refer to https://github.com/mbzuai-oryx/Video-ChatGPT at commit 8d54ebfcb049 (CC BY 4.0). Any quoted code is shown under that license.