microsoft/onnxruntime-genai

Generative AI with ONNX Runtime

What it solves

It provides a performant and flexible way to run generative AI models (specifically LLMs) locally on-device, handling the complex loop of generative AI including pre-processing, inference, and post-processing.

How it works

It implements the generative AI loop for ONNX models. This includes managing the KV cache, logits processing, search and sampling, and pre/post processing. It supports a wide range of hardware acceleration options (CPU, CUDA, DirectML, OpenVINO, QNN, WebGPU) and multiple model architectures like Llama, Phi, Mistral, and Gemma.

Who it’s for

Developers who want to integrate generative AI capabilities into their applications using ONNX Runtime, targeting various operating systems (Linux, Windows, Mac, Android) and hardware architectures (x86, x64, arm64).

Highlights

  • Multi-LoRA support
  • Constrained and continuous decoding
  • Broad support for model architectures including Llama, Phi, and Mistral
  • Cross-platform API support for Python, C#, C/C++, and Java
  • Extensive hardware acceleration options including CUDA and DirectML

Related

  • Project
  • Project
  • Project
  • Project
  • Project