← Back to project

Molmo2 Codec — Motion Search & Adaptive GOP Audit

What the search does well, what is distinctive, and the verified implementation gaps · 2026-07-24
motion searchadaptive GOPAdaCodecblock matchingcodec front end

1 · Verdict and characteristics

Core design
Correct direction
Own motion search on decoded 2-fps frames; no dependency on playback-codec I/P/B syntax.
Implementation status
Strong but inconsistent
ViT-aligned blocks, wide search, deterministic cache — plus several verified scale and GOP bugs.
Highest-risk finding
Hidden λ rescale
The configured λ is multiplied by 14², so λ=0.05 becomes an effective displacement coefficient of 9.8.
Our MLLM-oriented motion path Decoded RGBsampled at 2 fps 14×14 blocks27×27 ViT-aligned grid Own ±48 searchluma SAD + displacementcoarse step-2 + local refine MV + residualwarp previous frameuₜ=[rₜ,Mₜ] P-tokenizer16 tokensif role = P The same search also schedules GOPs selected block costsℓᵇₜ(mᵇₜ) frame pcostℓₜ = Σᵦ ℓᵇₜ adaptive decisionℓₜ > γ → new I-frameotherwise → P-frame one pass, two outputsmotion representation+ content-adaptive GOP Key characteristic: no H.264/H.265 frame types or bitstream motion vectors are required in the default path.
Distinctive characteristicCurrent implementationWhy it matters
MLLM-oriented, not playback-orientedFresh search over sampled RGB framesFrame roles and motion units are chosen for tokenization rather than bitstream compliance
ViT-aligned coding unit14×14 macroblocks on a 27×27 grid at 378 pxEach visual patch receives one uniform motion vector
Low-fps displacement coverage±48 px window at 2 fpsCovers the observed p95 motion magnitude near 47 px
One search, two productsSelected MV/residual + summed pcostThe same work builds P inputs and triggers adaptive I-frame insertion
Deterministic encodingFixed scan order, strict tie-break, cache fingerprintStage-1 and Stage-2 can consume reproducible codec inputs
Compact offline cache729 block MVs/frame; rebuild residual at 2–4 ms/frameAvoids live block matching inside distributed training

2 · Search objective and candidate schedule

Paper Eq. 1
SAD + λ‖d‖₁
SAD is explicitly defined as a sum over the macroblock.
Current code
SAD + λ·196·‖d‖₁
pen = lam * block * block, with block=14.
Current λ
0.05 → 9.8
Effective per-pixel displacement coefficient before multiplying by |dx|+|dy|.
full search ±8
289
hierarchical ±16
≤297
current hierarchical ±48
≤2409
Candidate positions per block: step-2 coarse grid plus at most eight local-refinement positions.

3 · Search-range evolution and measured tail behavior

±8 boundary hits, p90 videos
15.6%
±8 boundary hits, worst video
55.9%
±16 clipped blocks at 2 fps
24.5%
±48 clipped blocks at 2 fps
≈5%
VersionSampling / rangeCharacteristic
V1native-rate consecutive frames, ±8Small motion but high-motion tail repeatedly hits the boundary
V2native-rate, ±16 hierarchicalTwice the reach at approximately full-±8 candidate cost
V3–V52 fps, ±48 hierarchicalCorrect temporal spacing and broad reach; approximately 8× more candidates than V2
Local measurements are historical diagnostics from the repository documentation, not a standardized benchmark dataset.

4 · The motion-channel saturation bug

+10−1 −48−32−160163248 px current: clip(motion / 16) proposed: motion / 48 Current encoding maps every component from 16 px through 48 px to the same ±1 value.
Raw motionCurrent encoded value, scale 16Proposed value, scale 48
8 px0.500.17
16 px1.000.33
32 px1.000.67
48 px1.001.00

5 · Adaptive GOP: good idea, three concrete bugs

Intended Kmax=16
I121516I
Current condition
I1215I
The code increments since_i and then checks >= 16, so frame 16 becomes I; the maximum P-chain length is 15.
FindingEvidenceImpactPriority
Per-video γgamma=None invokes quantile calibration on each videoEvery video is pushed toward a similar GOP distribution; content adaptivity is weakenedP1
Global calibration at wrong fpsframe_costs() decodes without sample_fps=2The available global-γ helper calibrates native-rate motion but training/eval use 2-fps gapsP0
Kmax off by onesince_i += 1; if since_i >= max_gopDeclared Kmax=16 produces at most 15 P-framesP1
gop_min_p unusedConfig field never enters assign_roles()Configuration and behavior can silently divergeP2

6 · Strengths worth preserving

Verified quality
Residual energy drops
Historical tests report −84.7% vs. naive difference and +23%/+51% gains on selected high-motion clips.
Training reliability
Offline deterministic cache
Codec work is removed from the distributed hot path; a config fingerprint prevents most stale-cache reuse.
Base alignment
14×14 motion cells
The motion field respects Molmo's ViT patch grid rather than playback-codec dynamic partitions.

7 · Repair and validation gates

GateChangeMeasurementPass condition
AMatch Eq. 1 exactly or document a normalized-SAD equivalentExact-search oracle on a sampled block setHierarchical selected cost within a predefined tolerance; no hidden 196× λ
BCalibrate one γ on 2-fps training framesGOP-length histogram by dataset and motion quartileMedian near 8; dynamic videos receive shorter GOPs than static videos
CFix Kmax and motion normalizationChain lengths and encoded-MV histogramst=16 occurs; saturation limited to true ±48 boundary
DRange/λ ablation: ±32 vs ±48; λ sweepresidual MAE, pcost, runtime, boundary rateChoose the Pareto point before rebuilding the full cache
EEnd-to-end matched-token evaluationMLVU/MVBench plus quality by GOP depthSearch fixes improve P quality without collapsing temporal coverage
Sources: AdaCodec paper · motion search · preprocessing and GOP · codec configuration. Local implementation findings were audited at commit 59320178.