> ## Documentation Index
> Fetch the complete documentation index at: https://docs.m-star.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Phi-4-multimodal

> Transcribe and summarize a recording or ask a question about a picture.

Phi-4-multimodal-instruct reads text, audio or still images and returns text. Use it when the question needs both recognition and an answer, such as a summary of a recording.

## Install and start

The default uses one GPU. The checkpoint includes vision and speech adapters, selected automatically for the input modality.

### `phi4mm`

Text, image, audio → text. The default `phi4mm.yaml` uses 1 GPU. Beta. The [weights](https://huggingface.co/microsoft/Phi-4-multimodal-instruct) use MIT.

```bash theme={null}
uv pip install --torch-backend=auto "mstar-ai[all]"
mstar serve phi4mm
```

[Send the request](#describe-image).

## Send a request

Run either client example in a second terminal after `/health` returns 200.

### Ask about an image

Supply a photograph as `scene.png` and read the model’s description.

**Python SDK**

```python theme={null}
from mstar import MStarClient

client = MStarClient("http://localhost:8000")
print(client.generate(
    text='Describe this image.',
    images='scene.png',
    input_modalities=('image', 'text'),
    output_modalities=('text',),
).text)
```

**curl**

```bash theme={null}
curl -fsS http://localhost:8000/generate \
  --form-string 'text=Describe this image.' \
  -F files=@scene.png \
  --form-string input_modalities=image,text \
  --form-string output_modalities=text \
  --form-string streaming=false \
  | python3 -c '
import base64, json, sys

outputs = json.load(sys.stdin)["outputs"]
text = b"".join(base64.b64decode(chunk["data"]) for chunk in outputs["text"])
print(text.decode())
'
```

## Deployment configs

| File | GPUs | Parallelism | When to use |
| - | - | - | - |
| `configs/phi4mm.yaml` | 1 | none | The only shipped config: the LLM and both encoders on one GPU, 131072-token context. |

## Settings and defaults

The checkpoint ships a vision LoRA and a speech LoRA, and the model picks one per request from its media: vision for any prompt with an image, speech for audio alone, the base model for text. The config serves them from the engine's LoRA pool:

```yaml theme={null}
resources:
  lora:
    max_slots: 2
    max_rank: 320
```

The vision adapter has rank 256 and the speech adapter rank 320, so `max_rank` stays at 320 or more. A text-only prompt may run an adapter of the deployment's own; raise `max_slots` to hold it, and see [LoRA](https://docs.m-star.org/models/lora.md).

Request knobs are the sampler's: `temperature`, `top_p`, `top_k`, `repetition_penalty`, `penalize_prompt` and `max_output_tokens`. A `min_p` above 0 is refused unless the checkpoint's `generation_config.json` sets one.

## Limits

* Video input is refused.
* Audio below 8 kHz is refused. Audio between 8 and 16 kHz runs through the 8 kHz front end, and higher rates are resampled to 16 kHz.
* LongRoPE picks its table from the prompt's length: a prompt past 4096 tokens runs on the long table throughout. Unlike the reference, a request whose output crosses 4096 tokens stays on the table it started on.
* The chat route refuses tool calls, `n` above 1, stop sequences and OpenAI `logprobs`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.