Skip to main content
Muna compiles stateless Python functions into self-contained executable binaries.
Your Python code is lowered directly to native code, and does not rely on the Python runtime (or any other managed runtime).

Why Compile?

Deployment is not the first step in shipping a model—compilation is. Compiled models are smaller, faster, and can yield up to 45x reductions in cold-start times:
Cumulative time to first token

Cumulative time to first token, compiled vs. uncompiled.

This matters most in serverless and autoscaling deployments, where every scale-up event pays the cold-start tax. Faster cold starts mean fewer warm replicas—and a smaller GPU bill. A compiled model is also a portable artifact: the exact same binary can serve requests on our hosted endpoint, on your own GPUs, or on end-user devices—with hardware-optimized performance on each.

Defining a Function

Write your function, add a docstring, then wrap it with our @compile decorator:
greeting.py
The docstring is used as a description, is required, and must be 100 characters or less.
The function must specify parameter and return type annotations. Learn more.

Compiling the Function

Use the Muna CLI to compile the function. First, make sure you are logged into the Muna CLI:
Then run the following command:
Muna will upload your code, perform code generation on your function and its dependencies, then compile for our supported platforms:

Compiling a function with the Muna CLI. This is realtime--not sped up.

Using the Function

Depending on the complexity of your function, it can take anywhere from a few seconds to a few minutes for the function to be compiled for all platforms. Once the function is compiled, you can run it everywhere:
You can check the compilation status of the function at muna.ai/predictors.