Prompting guide · SAM 3 and SAM 3.1
Meta SAM 3 Prompts: How to Segment Anything with Text, Examples and Clicks Type a short phrase, box an example, or click. SAM 3 finds, segments and tracks exactly the objects you mean, in images and video.
At a glance
SAM 3 Prompts in Six Points
Basics
What Is a Prompt in Meta SAM 3?
A prompt is the hint you give SAM 3 about what to segment. From one prompt, SAM 3 can find every matching object, outline each one with a mask, and, in video, keep tracking them.
Three kinds of hint
- A short text phrase, such as “yellow school bus”, “striped cat” or “players in red jerseys”.
- Example boxes drawn around objects you want (positive) or don’t want (negative).
- Visual prompts: clicks, a box or a mask on one object, as in SAM 1 and SAM 2.
Two task modes. Text and example boxes run Promptable Concept Segmentation (PCS): find all instances. Clicks run Promptable Visual Segmentation (PVS): segment one object. Both live in the same SAM 3 model.
Prompt types
The Prompt Types, and When Each One Fits
Pick the prompt by the question you are asking: “every X”, “things like this”, or “this one”.
Text prompts: “every X”
Short noun phrases, optionally with an attribute: “red cars”, “blue recycling bins”. Open vocabulary, so you are not limited to a fixed label list. Returns every match, each with its own mask and ID.
Example boxes: “things like this”
Box one object and SAM 3 finds look-alikes. Add negative boxes to leave out confusions. Best when the concept is rare, hard to name, or a specific product or logo.
Clicks, boxes, masks: “this one”
Positive clicks on the object, negative clicks on background, a rough box, or an existing mask to refine. Best when you want precise edges on one object.
Two modes
PCS vs PVS: Which Mode Do You Need?
Most workflows start with PCS to find everything, then use PVS clicks to polish the objects that matter.
| PCS (concepts) | PVS (visual) | |
|---|---|---|
| Prompt | Text, example boxes, or both | Clicks, a box or a mask |
| Finds | Every matching object | One object per prompt |
| Output | Masks, boxes, scores, an ID each | A detailed mask |
| Good for | “Every dog”, counting, labelling | One product shot, one person |
| Earlier models | New in SAM 3 | Like SAM 1 and SAM 2 |
Deeper dive: segmentation guide · select specific objects
Example boxes
Positive and Negative Example Boxes
Examples teach SAM 3 a concept by showing it. Negatives are the quickest fix when a text prompt grabs look-alikes.
- Positive box: “find more like this”. Draw it tight around a clean, typical example.
- Several positives help when the category varies, such as a product seen from different angles.
- Negative box: “not like this”. Box one wrong object; similar wrong objects drop out too.
- Boxes, not masks. SAM 3’s concept examples are boxes. Masks are used as visual prompts on a single object.
Use examples when words fail: rare parts, a specific logo, or two types that look alike.
Combining prompts
Combining Text, Examples and Clicks
You can mix prompt types. Each one has a job:
- 1Start with text“players” finds every player, and maybe referees too.
- 2Add a negative boxBox one referee and mark it negative; the referees drop out of the set.
- 3Add a positive box if neededBox one player in the exact kit you want, to focus on that team.
- 4Click to fix single masksClicks refine the edges of one object (PVS). They don’t add or remove whole groups; use example boxes for that.
In Hugging Face Transformers, a text prompt and a negative box can go in the same request, for example “handle” minus the oven handle.
Writing prompts
How to Write Text Prompts That Work
SAM 3 is trained on short noun phrases. Specific beats long.
✓ Do
- red basketball jerseys
- goalkeepers in green
- wooden tables
- blue plastic bins
✗ Avoid
- please find all the players wearing red basketball jerseys
- cool objects
- the second car from the left
- cars, bikes and people
- Name the thing, then add one or two attributes: colour, material, role.
- One concept per prompt. For cars, bikes and people, run three prompts.
- Position and relationships (“behind the dog”, “leftmost”) need SAM 3 Agent, not a plain prompt.
- No results? Try a simpler or more common word, then add an example box. See empty masks.
Refining
Refine in a Loop
SAM 3 is built for quick back-and-forth. You rarely need more than a couple of rounds.
- 1PromptText or an example box (PCS).
- 2CheckLook for missed objects, wrong objects and rough edges; in video, check tracking too.
- 3RefinePositive boxes for misses, negative boxes for wrong picks, clicks for edges.
- 4UseExport masks or move on. See export masks.
- Clicks: start with one or two; add corrections only where the mask is wrong.
- Thin or small parts: zoom in and add a positive click along the edge. More in improve mask quality.
Recipes
Example Prompt Recipes
Video edit: isolate the players
- Text:
football players - Negative box on a referee if they’re included.
- Click one player for a hero-shot mask.
Robotics: pick the right bins
- Text:
blue plastic bins - Positive box on one correct bin.
- Pass masks and IDs to grasp planning.
See use cases
Labelling: a tricky class
- Text:
solar panelson aerial images. - Negative box on a skylight.
- Export masks to train a small, fast model.
See mask formats
Under the hood
How SAM 3 Reads Your Prompt
Each kind of prompt is encoded, then combined with the image. A presence check stops SAM 3 inventing objects that aren’t there.
- Encoders: one for the image, one for the text phrase, one for example boxes.
- Fusion: the prompt is matched against the image features.
- Presence check: first decides whether the concept is in the image at all, which cuts false matches for similar phrases.
- Training data: the SA-Co data has over 4 million unique concept phrases, including hard negatives (phrases that are not in the image).
- Result: Meta reports about a 2× gain over earlier systems on its SA-Co concept benchmark.
A text prompt in code
from PIL import Image
from sam3.model_builder import build_sam3_image_model
from sam3.model.sam3_image_processor import Sam3Processor
model = build_sam3_image_model()
processor = Sam3Processor(model)
state = processor.set_image(Image.open("street.jpg"))
output = processor.set_text_prompt(state=state, prompt="yellow school bus")
masks, boxes, scores = output["masks"], output["boxes"], output["scores"]From the official sam3 repository. Setup: install SAM 3 · Python tutorial
Limits
Limits and Gotchas
Prompting fixes a lot, but not everything.
Where plain prompts struggle
- Vague words: “cool objects”, “interesting shapes”.
- Reasoning and position: “the person standing behind the dog”, “the tallest building”.
- Near-identical types, such as two similar logos: expect manual cleanup.
- Specialist fields such as medical imaging, where everyday words don’t apply.
- Video length: Meta defines the task on images and short clips (up to about 30 seconds). Split longer footage.
What to do instead
- Be specific and add an example box.
- Use SAM 3 Agent for complex requests: a multimodal language model turns them into simple phrases for SAM 3.
- Fine-tune for a specialist domain. MedSAM3, a research model, adapts SAM 3 to medical concepts. See fine-tuning.
- More: all limitations
Where to try
Where to Use SAM 3 Prompts
Three ways in, from no code to full control.
facebook/sam3 or facebook/sam3.1 in Python with the official code or Transformers.
Tools and APIsHosted servicesLabelling and vision platforms that wrap SAM 3 with a UI and an API.
Meta also runs an official demo, the Segment Anything Playground, at aidemos.meta.com.
Questions
SAM 3 Prompts FAQ
What is a prompt in Meta SAM 3?
A prompt is the hint you give SAM 3 about what to segment. It can be a short text phrase such as “yellow school bus”, one or more example boxes around objects you want (or don’t want), or classic clicks, boxes and masks on a single object.
What makes a good SAM 3 text prompt?
A short noun phrase with the attributes that matter, such as “red basketball jerseys” or “wooden tables”. Avoid full sentences and instructions like “please find…”. SAM 3 is trained on short phrases, not long descriptions.
Can SAM 3 understand long or complex prompts?
Not on its own. Requests like “the person standing behind the dog” need reasoning about position or relationships. For those, SAM 3 Agent pairs SAM 3 with a multimodal language model that breaks the request into simple phrases SAM 3 can handle.
What is the difference between PCS and PVS?
Promptable Concept Segmentation (PCS) finds every object that matches a text phrase or example boxes. Promptable Visual Segmentation (PVS) segments one specific object from clicks, a box or a mask, the way SAM 1 and SAM 2 work.
How do I stop SAM 3 from selecting the wrong objects?
Add a negative example: draw a box around one wrong object and mark it negative. SAM 3 then drops look-alikes of it. Making the text phrase more specific, such as adding a colour or role, also helps.
Do prompts work the same in SAM 3.1?
Yes. SAM 3.1 uses the same text, example and click prompts. It mainly makes video with many objects faster.
Can I use several concepts in one prompt?
Each text prompt describes one concept. To find cars, bikes and people, run three prompts. In code you can reuse the image features so extra prompts are cheap.
Keep reading
Sources
- SAM 3: Segment Anything with Concepts (Meta, paper)
- facebookresearch/sam3 on GitHub
- Hugging Face Transformers: SAM 3 (text, positive and negative boxes)
- Meta AI blog: SAM 3