Skip to main content
Back

Microsoft's Florence-2 Beats 80B Models Using Just 230 Million Parameters

Microsoft's tiny 0.23B vision foundation model handles captioning, detection, grounding and OCR through one prompt-based interface, and it is quietly racking up millions of downloads.

Pro

  • Microsoft's Florence-2-base passes 2.7M downloads, powering OmniParser, Magma-UI and dozens of finetunes
  • 0.23B parameter seq2seq model handles captioning, detection, grounding, OCR and region tasks via prompt tokens
  • Trained on FLD-5B: 5.4 billion annotations across 126 million images, generated iteratively
  • Zero-shot COCO caption CIDEr 133.0 beats 80B Flamingo at 84.3, using 350x fewer parameters
  • MIT licensed, runs in transformers with trust_remote_code=True, ships float16 weights
  • Technical report details the unified prompt-based multi-task representation

A 230 million parameter vision model from Microsoft keeps climbing the Hugging Face charts, and it is worth understanding why. Florence-2-base has crossed 2.7 million downloads on the Hub, powers popular spaces like OmniParser and Magma-UI, and has spawned dozens of finetunes and adapters. For a model this small, that kind of traction is unusual, and it points to a design choice that turns out to be extremely practical.

One model, one prompt syntax, many vision tasks

Florence-2 is a vision foundation model that uses prompt tokens to switch between captioning, detection, segmentation, grounding, and OCR. Send an image plus a short task tag and the model returns structured text you can parse, replacing what used to be a stack of a detector, OCR engine, captioner, and grounding model.

Swap the tag and the same weights produce a different output shape:

  • <CAPTION>, <DETAILED_CAPTION>, <MORE_DETAILED_CAPTION> for image descriptions at three levels of verbosity
  • <OD> for object detection returning bounding boxes and labels
  • <DENSE_REGION_CAPTION> and <REGION_PROPOSAL> for region-level outputs
  • <CAPTION_TO_PHRASE_GROUNDING>, which takes a caption as extra text input and returns boxes for each phrase
  • <OCR> and <OCR_WITH_REGION> for text extraction with optional quad boxes

Getting started is a three-line pattern in transformers. The repo still ships as custom code, so trust_remote_code=True is required.

from transformers import AutoProcessor, AutoModelForCausalLM
from PIL import Image
model = AutoModelForCausalLM.from_pretrained(
    "microsoft/Florence-2-base", trust_remote_code=True
).to("cuda")
processor = AutoProcessor.from_pretrained(
    "microsoft/Florence-2-base", trust_remote_code=True
)
image = Image.open("scene.jpg")
inputs = processor(text="<OD>", images=image, return_tensors="pt").to("cuda")
out = model.generate(**inputs, max_new_tokens=1024, num_beams=3)
text = processor.batch_decode(out, skip_special_tokens=False)[0]
parsed = processor.post_process_generation(text, task="<OD>",
    image_size=(image.width, image.height))

Why a 0.23B model punches above its weight

The training recipe does most of the heavy lifting. The team describes Florence-2 as a sequence-to-sequence model trained on annotations spanning three granularities: image-level captions, region-level boxes, and pixel-level masks or dense text. Every task, from a bounding box to a paragraph description, is expressed as a text sequence, so one decoder learns them all under a single loss.

The training corpus, FLD-5B, holds 5.4 billion visual annotations across 126 million images, generated by an iterative loop of automated labeling and model refinement rather than human labor. That combination of unified output format and massive pretraining is what lets a small decoder cover so many tasks.

The zero-shot numbers show the payoff. On COCO captioning CIDEr, Florence-2-base scores 133.0 with 0.23B parameters; Flamingo scores 84.3 with 80B. On COCO object detection val2017, the base model reaches 34.7 mAP zero-shot and 41.4 mAP after generalist fine-tuning. On phrase grounding benchmarks like RefCOCO, the fine-tuned base variant hits 92.6 val accuracy, matching or beating specialist models an order of magnitude larger.

Where it shines and where it does not

Strengths are clear from the model card:

  • Structured outputs (boxes, quad boxes, region captions) come out of the same generate call, so pipelines stay simple
  • Fast inference on modest GPUs thanks to the 0.23B footprint and float16 weights
  • Strong grounding and OCR-with-region, which is why it shows up inside UI-parsing tools like OmniParser
  • Permissive MIT license, making it usable in commercial products

The limitations are just as clear. Florence-2 does not do free-form dialogue, chain-of-thought reasoning, or open-ended VQA, and the prompt vocabulary is essentially the closed set of task tokens. TextVQA at 63.6 for the fine-tuned base trails specialist OCR-augmented systems, and base captioning CIDEr on TextCaps sits at 143.9 versus 160-plus for PaLI variants that use external OCR. For open-ended visual reasoning you still want a general VLM.

What it is actually good for

Given the shape of the model, the sweet spot is production pipelines that need reliable structured vision outputs at low latency and low cost:

  1. Auto-labeling and dataset bootstrapping, where you want dense captions plus boxes on millions of images
  2. Screen and document understanding, thanks to OCR-with-region returning quad boxes and text
  3. Grounding search, using caption-to-phrase grounding to link words in a query to image regions
  4. Preprocessing for downstream systems like SAM, where Florence-2 supplies proposals and SAM refines masks (the florence-sam space is a good reference)
  5. Agentic UI automation, where a small model needs to parse buttons, labels, and layout on the fly

The quiet lesson

The deeper point here is about representation. By treating detection, grounding, OCR, and captioning as one text generation task and pretraining on a massive machine-labeled corpus that spans all three annotation granularities, a 0.23B decoder ends up competitive with 7B and 80B specialists on their own benchmarks. That is why finetunes keep multiplying on the Hub, and why the model still trends more than a year after release. If your stack currently glues together three or four vision models to get structured outputs, Florence-2-base is worth an afternoon of benchmarking.