Skip to content

Video understanding, tracking, generation, and world models · Video-language learning · VID041 · Model

UniVL

Combines modality-specific encoders, a cross-modal encoder and a decoder to support both understanding and generation.

Explained here Component demo, not a trained model CodeSplash's run and the reference's record

In CodeSplash

Documented in the Academy only. There's no Set up button.

Availability
Explained here
Code example
Component demo, not a trained model
Who ran it
CodeSplash's run and the reference's record
CodeSplash's run
The reference's example ran in Python and R here, and they agree.
The reference's record
Python: Ran in the reference's review. The report doesn't record which version of the code ran. R: Reviewed but not run: R wasn't available to the reference's authors.

Purpose

Combines modality-specific encoders, a cross-modal encoder and a decoder to support both understanding and generation. Its staged training mixes alignment and reconstruction tasks, allowing the system to serve retrieval and video-caption generation.

Question / objective

Align video evidence with language for retrieval, recognition, captioning or grounded answers. This is a learning or inference objective, not a test of a statistical null hypothesis.

Method type and supervision

model · Video-language learning. Weak paired video/text pretraining and/or supervised instruction learning, depending on the entry.

Architecture / computational structure

Separate text/video encoders, cross-modal encoder and generative text decoder.

Assumptions

Inputs must satisfy the temporal, modality and annotation protocol described below. A captioning objective and retrieval objective need not favor identical features. Misaligned narration and generic language can produce convincing but weakly grounded captions.

Formula / computational definition

L=λrLretrieval+λmLmasked+λcLcaptionL=\lambda_rL_{retrieval}+\lambda_mL_{masked}+\lambda_cL_{caption} summarizes objective families; Lcaption=−∑tlog⁡p(wt∣w<t,V)L_{caption}=-\sum_t\log p(w_t\mid w_{<t},V) predicts caption tokens from video VV. Actual stages may use different combinations.

Parameters and notation

Learned/estimated quantities: Modality encoders, connectors, projections and language-model weights may be learned or frozen according to the stated stage; token IDs and timestamps are inputs. Symbols specific to the objective are defined with the equation. Hyperparameters and design choices: Precomputed video features, transcript pairing, stage schedule, negative sampling, decoder length and loss weights are consequential.

Fitting, fine-tuning, and adaptation

Tune the head/decoder or alignment modules for the target task. Joint fine-tuning should balance retrieval and generation to avoid improving one while forgetting the other. Use a separate adaptation validation split, monitor the target metric and retention of previously useful behavior, and save the exact preprocessing and training configuration.

How to use and calibrate

Fix the input protocol and target before fitting; choose design settings on held-out source videos, then freeze the evaluation procedure. Report retrieval recall and caption quality with human grounding checks, isolating modality and training-stage contributions.

Example application

Retrieve a clip and generate a grounded description of its content.

Interpretation / pitfalls

Watch out

An optimized training objective or a favorable example does not establish generalization. Report retrieval recall and caption quality with human grounding checks, isolating modality and training-stage contributions. The example below isolates one mechanism and cannot substantiate a full-model benchmark claim.

Python and R code examples

Component: Keep retrieval and caption objectives separately inspectable. Dependencies: NumPy in Python; base R in R; run the shared setup above. Python component: executed successfully. R component: unexecuted. No complete model training or pretrained inference was executed.

Full implementation route — Python: Follow the authors' stage-specific pipeline with consistent video features and tokenizer. R: Analyze similarity matrices and token losses in R; invoke the encoder-decoder through Python for model-level reproduction.

Python and R

The reference's own programs, shown as written. A component demo shows one central piece of the method; it doesn't train a full model.

Python

Component demo, not a trained model — Keep retrieval and caption objectives separately inspectable.

Shared setup for this chapter
import numpy as np

def softmax(x):
    z = np.asarray(x, dtype=float)
    e = np.exp(z - z.max())
    return e / e.sum()
similarity = np.array([[2.,0.],[0.,2.]])
retrieval = np.mean([-np.log(softmax(similarity[i])[i]) for i in range(2)])
caption_target_probs = np.array([.7,.6,.8])
caption = -np.log(caption_target_probs).mean()
print("retrieval",retrieval,"caption",caption,"illustrative sum",retrieval+caption)
R

Component demo, not a trained model — Keep retrieval and caption objectives separately inspectable.

Shared setup for this chapter
softmax <- function(x) {
  e <- exp(x - max(x))
  e / sum(e)
}
similarity <- rbind(c(2,0),c(0,2))
retrieval <- mean(sapply(1:2,function(i)-log(softmax(similarity[i,])[i])))
caption <- -mean(log(c(.7,.6,.8)))
print(c(retrieval=retrieval,caption=caption,total=retrieval+caption))

Sources

From the CodeSplash reference, entry VID041.