MI

microsoft/Phi-3-mini-4k-instruct

text-generationtransformersmit3.8B params · updated Dec 2025

Usage

usage.pytemplate from repo id
from osai import AutoModelForCausalLM, AutoTokenizer

repo = "microsoft/Phi-3-mini-4k-instruct"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(
    repo, dtype="bfloat16", device_map="auto",
)

msgs = [{"role": "user", "content": "Explain speculative decoding."}]
ids = tok.apply_chat_template(msgs, return_tensors="pt").to(model.device)
print(tok.decode(model.generate(ids, max_new_tokens=256)[0]))

Hardware

Computed from 3.82B parameters × bytes per parameter, plus 20% for activations and KV cache. Not measured.

PrecisionWeightsEstimated VRAMFits on
bf167.1 GB8.5 GBCPU or T4 16 GB
int83.6 GB4.3 GBCPU or T4 16 GB
nf41.8 GB2.1 GBCPU or T4 16 GB