MLC-LLM CLI Cheatsheet - mlc_llm Compile and Serve Full Reference
MLC-LLM compiles popular open models into efficient local GPU (CUDA, Metal, Vulkan) runtimes. mlc_llm is its unified CLI: chat interactively, serve an OpenAI-compatible endpoint, or convert a HuggingFace model into deployable weights. This sheet covers the three subcommands and common flags so you can launch local inference.
Interactive Chat 5
mlc_llm chat HF://mlc-ai/Llama-3-8B-Instruct-q4f16_1-MLCmlc_llm chat model --device cudamlc_llm chat model --device macmlc_llm chat model --device metalmlc_llm chat model --quantization q4f16_1Serve and Convert 5
mlc_llm serve modelmlc_llm serve --device cudamlc_llm convert model --quantization q4f16_1mlc_llm convert model --model-lib pathmlc_llm serve --host 0.0.0.0 --port 8000Flags and Help 10
mlc_llm chat model --overrides "{}"mlc_llm chat model --temperature 0.7mlc_llm chat model --top-p 0.95mlc_llm chat model --max-gen-len 1024mlc_llm chat model --device vulkanmlc_llm serve --port 8000mlc_llm convert --revision mainmlc_llm chat --helpmlc_llm serve --helpmlc_llm --helpTips
- For local GPU inference prefer mlc_llm chat model --device cuda (or mac); it beats pure CPU by far.
- Use mlc_llm serve to expose an OpenAI-compatible API for client tools.
- convert quantizes a HuggingFace model into MLC format; convert once, then serve offline repeatedly.
FAQ
How is MLC-LLM different from llama.cpp?
MLC-LLM uses a compilation route (TVM/Relax) for unified cross-hardware deployment; llama.cpp is a hand-written C++ engine. Both run local models.
What protocol does serve expose?
It is OpenAI chat-completions compatible; point a client base_url at the serve address to call it directly.
Official References
Each command links to its official documentation below, so you can verify the latest usage and read deeper.
Maintained by LaoHand
Publicly updated on Sep 10, 2026, continuously proofread against official docs.
Contact Us
Wrong command or description? Send us corrections, business inquiries or product feedback by email.
Contact Us