Macalinao StudioLearnAll enriched lessons ↗
College path · 7 sectionsSwitch to high school ↗

College / LONGER LESSON 23

Multimodal learning: alignment is not cross-attention

Distinguish CLIP-style matching from a model that routes information across modalities.

Preparation: Vector similarity and attention shapes.

Plan 20–35 minutes with the activities; this is a study estimate, not a timed requirement. Both paths have complete narration. Your notes and progress are kept separately for each level.

Section 01 / 07

Represent different inputs

College path. Distinguish CLIP-style matching from a model that routes information across modalities.

Preparation: Vector similarity and attention shapes. Work through one section at a time. Predict the experiment result before changing its controls, then explain what the example leaves out.

Images and text begin with different structures. Encoders map them into representations that a later objective or fusion mechanism can compare or combine. The embedding widths, pooling and normalization are architectural choices. Shared vector dimension does not by itself imply shared semantic calibration or grounded understanding.

Worked step 1. Encode one image and three captions.

Worked step 2. Check vector widths.

Worked step 3. Compare scores only under the model’s intended normalization.

Try it yourself. Does equal vector length prove semantic compatibility?

Pause the recording and write your reasoning before continuing. The worked solution follows.

Reveal worked solution

Worked solution. No. The encoders and training objective must establish the useful relationship.

Section 02 / 07

Learn a contrastive match

CLIP trains image and text encoders to match paired examples against other examples in a batch. Its contrastive alignment should not be described as inherently cross-attention between every image and word token. CLIP uses image-text similarities with a learned temperature scale and symmetric contrastive losses. Separate encoders produce representations; this differs from token-level cross-attention fusion.

Worked step 1. Two images and two captions produce a 2 by 2 similarity table.

Worked step 2. Correct pairs occupy the intended diagonal.

Worked step 3. Train both retrieval directions.

Try it yourself. Is CLIP’s similarity table a token-level cross-attention map?

Pause the recording and write your reasoning before continuing. The worked solution follows.

Reveal worked solution

Worked solution. No. It compares encoded examples in the contrastive objective.

Section 03 / 07

Cross-attention routes another stream

Cross-attention takes queries from one stream and keys and values from another. The output follows the query positions while incorporating weighted information from the other stream. For T text queries and P visual keys, scores are T by P per head. Value width determines the context feature width; projected query and key widths must agree.

scores: T×P; context: T×dᵥ

Worked step 1. Use T=3, P=5 and value width 4.

Worked step 2. Scores are 3 by 5.

Worked step 3. The context is 3 by 4.

Try it yourself. Which axis determines how many output positions there are?

Pause the recording and write your reasoning before continuing. The worked solution follows.

Reveal worked solution

Worked solution. The query axis: three in this example.

Section 04 / 07

Similarity can miss a critical relation

Two captions can mention the same objects but reverse who acts on whom. A high global similarity can overlook counting, negation, spatial relations or a small identifying detail. Evaluate compositional and grounding tasks separately from global retrieval. Contrastive training on broad pairs does not guarantee precise localization, counting or logical entailment.

Worked step 1. Compare captions with reversed roles.

Worked step 2. Keep nouns unchanged.

Worked step 3. Inspect whether the system distinguishes the relation.

Try it yourself. Does a high match score establish every caption detail?

Pause the recording and write your reasoning before continuing. The worked solution follows.

Reveal worked solution

Worked solution. No. Test the details directly with appropriate labels and counterexamples.

Section 05 / 07

Keep masking and preprocessing visible

Padding, image resizing and token selection affect what the fusion layer can observe. A model cannot reliably use evidence that preprocessing removed. Trace image transforms, visual token selection and source masks. Evaluate the actual end-to-end path; isolated embedding or attention calculations omit these upstream constraints.

Worked step 1. Mark a small text region in an image.

Worked step 2. Apply the production resize and crop.

Worked step 3. Check whether its pixels remain legible.

Try it yourself. Can the fusion layer recover information that was entirely discarded?

Pause the recording and write your reasoning before continuing. The worked solution follows.

Reveal worked solution

Worked solution. Not from that input alone. It may guess from priors, which is different from reading the evidence.

Section 06 / 07

Evaluate claims with counterexamples

Use paired examples that differ in one important detail. Ask whether the system’s answer changes appropriately and whether it admits uncertainty when evidence is insufficient. Report retrieval, localization, answer accuracy and calibration separately. Document dataset shifts and annotation ambiguity; a single aggregate score can conceal systematic failures.

Worked step 1. Create an image-caption pair and a minimally changed incorrect caption.

Worked step 2. Measure both scores.

Worked step 3. Inspect the margin and failure pattern.

Try it yourself. Is a positive similarity score itself a probability of truth?

Pause the recording and write your reasoning before continuing. The worked solution follows.

Reveal worked solution

Worked solution. No. Its interpretation depends on the model and calibration procedure.

Section 07 / 07

Mastery and transfer

Bring the pieces together. First answer the checkpoint without the worked solutions. Then explain the mechanism in your own words, using one numerical example from this lesson.

CLIP’s original training is primarily… Option 1: Pairwise image-text contrastive alignment. Option 2: Always token-level cross-attention fusion. Option 3: A guarantee of exact visual counting.

Pause here and choose an answer before continuing. The checkpoint explanation follows.

Reveal worked solution

The correct choice is option 1: Pairwise image-text contrastive alignment. Contrastive alignment and cross-attention are distinct mechanisms.

Transfer task. Change one assumption in the worked example. State your prediction, calculate or test it in Workbench, then explain whether the result supports your prediction.

Reveal worked solution

Self-check rubric. Name the changed assumption, keep the other inputs fixed, show at least one intermediate calculation, and distinguish what the toy example guarantees from what would require a trained model or a real measurement.

MODERN MODEL CASE STUDY

DeepSeek V4.1 Flash: where this idea goes next

Connect image features, pixel unshuffle and modality-specific expert balancing. Follow the worked examples, then evaluate the reported gains and their limits.

Open the college case study →

Added October 21, 2026. This optional extension has its own complete local narration.

Sources and scope

Original worked examples and teaching text, grounded in these primary references. Numerical fixtures explain mechanisms; model quality and hardware performance require separate measurements. Both levels share key examples, with different explanations and checkpoints.

Reset this college path?

This removes only this path’s notes, progress and experiments from this browser.