Skip to content

Image-language and multimodal models · Image-language and multimodal models · MM007 · Model

UNITER

Builds a shared image-text representation using conditional masking and both global and fine-grained alignment. Its word-region alignment objective uses optimal transport to connect language tokens with visual regions.

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

Builds a shared image-text representation using conditional masking and both global and fine-grained alignment. Its word-region alignment objective uses optimal transport to connect language tokens with visual regions.

Question / objective

Can conditional reconstruction and word-region alignment improve a joint representation beyond global image-caption matching? The learning target replaces a null/alternative hypothesis formulation; benchmark evaluation is a separate statistical task.

Method type and supervision

Model/system family. Image-language or broader multimodal learning using the paired, generated or task-specific supervision described below. This is not a classical significance test.

Architecture / computational structure

A joint transformer consumes region and text embeddings. Pretraining combines masked language, masked region, matching and optimal-transport word-region objectives, with one modality fully observed during conditional masking of the other.

Assumptions

Transport distance depends on the feature geometry and chosen masses. It supplies an alignment bias, not verified object-word annotations. Detector-region coverage, paired-caption quality and cross-dataset overlap remain important.

Formula / computational definition

LWRA=min⁡T∈Π(a,b)∑ijTijCijL_{WRA}=\min_{T\in\Pi(a,b)}\sum_{ij}T_{ij}C_{ij} aligns word/region masses a,ba,b through transport plan TT and feature-distance cost CC. Other masked/matching losses train the same representation. This captures the central mechanism; consult the primary source for all masks, stages, normalizations and loss terms.

Parameters and notation

Learned/estimated quantities: Embedding, fusion and predictor weights are learned. The transport plan is an inner optimization output; cost normalization, mass constraints and approximation settings are design choices. Hyperparameters and design choices: Masking policy, region/text budgets, transport regularization/solver details and loss weights affect fine-grained alignment.

Fitting, fine-tuning, and adaptation

Tune a task head with the encoder frozen, then adapt fusion layers. Preserve conditional masking when extending pretraining; changing the OT solver or mass rules changes the training objective and should be tested independently. Save the exact trainable-module selection, data split, loss, optimizer and processor configuration; distinguish parameter adaptation from inference-time prompt tuning.

How to use and calibrate

Choose a specific model/processor and task protocol, validate preprocessing on known examples, tune only on a held-out development set and freeze the final evaluation. Evaluate retrieval and grounding separately; compare against no-OT and unconditional-mask ablations at matched data/compute.

Example application

Match a referring expression to a region or improve image-text retrieval with fine-grained correspondence.

Interpretation / pitfalls

Watch out

Reported capability is conditional on available visual evidence, data coverage and the chosen task. Evaluate retrieval and grounding separately; compare against no-OT and unconditional-mask ablations at matched data/compute. A successful numeric component example is not evidence that a complete system achieves a published benchmark score.

Python and R code examples

Component: Solve a tiny balanced two-by-two transport problem by enumeration. Dependencies: shared NumPy/base-R setup above. Python: executed successfully. R: unexecuted. Complete model training/inference: not run.

Full implementation routes: Python: reproduce UNITER’s detector inputs, conditional tasks and OT objective; R: use small transport examples or a documented solver, with full neural training bridged through Python.

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 — Solve a tiny balanced two-by-two transport problem by enumeration.

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()
cost=np.array([[.1,.9],[.8,.2]])
plans=[np.eye(2)/2,np.fliplr(np.eye(2))/2]
objectives=[np.sum(p*cost) for p in plans]
best=plans[int(np.argmin(objectives))]
print(best,"transport cost",min(objectives))
# For 2x2 uniform masses, a linear optimum occurs at an endpoint plan.
R

Component demo, not a trained model — Solve a tiny balanced two-by-two transport problem by enumeration.

cost <- rbind(c(.1,.9),c(.8,.2))
plans <- list(diag(2)/2,diag(2)[,2:1]/2)
objectives <- sapply(plans,function(p)sum(p*cost))
print(plans[[which.min(objectives)]]); print(min(objectives))

Sources

From the CodeSplash reference, entry MM007.