CoolFace
Modelpublic

rwightman/coca2-moderntext-naflex_ViT-B-32.cc12m-qk-lr2e3-b4096

sourceHugging Faceapache-2.0updated 1mo agoView on Hugging Face
0likes21downloads
Model Card

Model card for coca2-moderntext-naflex_ViT-B-32.cc12m-qk-lr2e3-b4096

CoCa2 with a NaFlexVit B/32 vision tower and parallel paper pooling: a 128-query generative pooler feeds the caption decoder while an independent 1-query pooler (reading the same validity-masked trunk tokens) produces the contrastive latent. Modern causal text encoder with masked mean pooling, modern multimodal decoder, tiktoken r50k at ctx 128. Matches the bs-4096 MaMMUT2 on caption metrics but gives up the caption-objective I2T retrieval boost (see comparison).

Research checkpoint from a B/32-scale architecture/objective comparison on CC12M (CLIP vs MaMMUT2 vs modern text decoder); not a production model.

Model Details

  • —Dataset: pixparse/cc12m-wds
  • —Epochs: 32
  • —Precision: bf16 amp
  • —Weight decay: 0.25
  • —Objective: InfoNCE + 2x caption CE + 1e-5 z-loss
  • —Vision tower: timm NaFlexVit base, patch 32, NaFlex data pipeline; parallel attentional pooling (128-query generative + 1-query contrastive)
  • —Text encoder: modern (RoPE/RMSNorm/SwiGLU/gated attn), qk-norm, causal, masked mean pooling, tiktoken r50k vocab 50260, ctx 128, variable-length text
  • —Multimodal decoder: modern, cross-attn every block over the 128 pooled queries
  • —Optimizer: adamw, lr 2e-3
  • —Batch size: 4096

Model Usage

python
import torch
import open_clip

model, preprocess = open_clip.create_model_from_pretrained('hf-hub:rwightman/coca2-moderntext-naflex_ViT-B-32.cc12m-qk-lr2e3-b4096')
tokenizer = open_clip.get_tokenizer('hf-hub:rwightman/coca2-moderntext-naflex_ViT-B-32.cc12m-qk-lr2e3-b4096')

image = preprocess(pil_image).unsqueeze(0)
text = tokenizer(['a dog', 'a cat', 'a bird'])
with torch.no_grad():
    image_features = model.encode_image(image)
    text_features = model.encode_text(text)

Caption generation:

python
with torch.no_grad():
    tokens = model.generate(image, generation_type='beam_search', seq_len=30)
print(tokenizer.decode(tokens[0].cpu().tolist()))

Model Comparison

runIN1KIN-V2IN-RIN-SkI2T R@1T2I R@1CIDErBLEU-4METEOR
clip-siglip42.7236.4454.3832.0834.8425.95
clip-naflex40.434.4350.5328.5534.624.25
mammut2 (no z)37.831.9848.827.1637.5224.7210.022.437.37
mammut2 (+z)38.3632.4749.4427.1238.1824.5410.042.417.38
mammut2-naflex37.5431.9248.6326.2838.6424.79.522.337.4
mammut2-mt no-qk lr1e-338.0732.7850.8427.2837.4425.1810.963.587.69
mammut2-mt qk lr2e-338.3733.0250.5627.1837.9424.9310.853.447.57
mammut2-mt qk lr2e-3 b409640.034.2153.9129.8137.725.3712.233.917.99
mammut2-mt qk lr3e-337.0531.8248.4126.0335.9224.0610.293.317.35
coca2-mt-naflex (this model)38.032.1549.9627.6433.6423.4212.413.668.43

All ten runs: CC12M, 32 epochs, 2x GPU, bf16 amp, wd 0.25, evaluated at epoch 32 with one harness (ImageNet zero-shot w/ OpenAI 80-prompt ensemble; COCO Karpathy-test retrieval, I2T = any-of-5-captions; caption metrics vs the 5 COCO refs, beam search). Key reads:

  • —The CLIP rows are prior runs, not purpose-trained controls: they were the closest available baselines but come from NAdaMuon optimizer experiments (nadamuon @ bs 4096 vs the MaMMUT runs' adamw @ bs ~1024), so cross-family deltas bundle optimizer + batch + loss.
  • —Caption objective -> I2T retrieval: every MaMMUT2 run beats both CLIP runs by 1-4 pt I2T R@1 despite 1/4 the contrastive batch and a plainer optimizer.
  • —Zero-shot ordering tracks batch/loss/optimizer, not architecture -- confirmed by the bs-4096 moderntext run: at matched batch (still adamw) it lands within 0.4 IN1K of clip-naflex and within 0.5 IN-R of clip-siglip. Batch was most of the CLIP lead.
  • —The caption-objective I2T advantage is batch-independent (37.7-38.6 I2T R@1 at both bs 1024 and 4096), while zero-shot, T2I, and caption metrics all scale with batch.
  • —...and it needs the shared caption/contrastive pathway, not just the caption loss: CoCa2 with parallel pooling (an independent 1-query contrastive pooler, decoupled from the caption path at the pooler) matches the bs-4096 MaMMUT2 on caption metrics (CIDEr 12.41 vs 12.23) yet drops I2T R@1 to 33.6 -- below both CLIP baselines. Its zero-shot/robustness deltas vs that run are NaFlex-tower-sized (cf. clip-naflex), so the retrieval regression is the pooling topology.
  • —NaFlex vision and 1e-5 caption z-loss are both ~free (within the <=0.6 pt repeat-run noise).
  • —Modern text tower (bundled with r50k tokenizer + ctx 128) at its best LR: IN1K parity with classic, +V2/+IN-R/+T2I, and clearly better caption metrics. qk-norm buys 2x LR headroom rather than direct quality; 3e-3 is past the stable edge even with it.
  • —Caption scores are style-limited: CC12M alt-text register vs COCO references. Absolute CIDEr is low for all runs; relative differences are the signal.