Skip to main content

Simple LLM continous batching engine implementation with support for optimized macos-inference

Project description

macos-serving

This repository contains a minimal continuous batching LLM engine. The current implementation is a straightforward PyTorch prototype focused on exercising the serving loop and request scheduler.

Current Capabilities

  • Runs a single dense model configuration: Qwen 0.6B.
  • Demonstrates continuous batching to keep GPU execution saturated under streaming request load.

Vision

  • Transition the backend to Metal-accelerated kernels purpose-built for Apple silicon.
  • Broaden model coverage and support quantized variants suited for on-device serving.
  • Introduce production-grade observability, adaptive batching heuristics, and deployment tooling tailored for macOS.

Quick Start

  1. Make sure you have uv installed
uvx macos-serving --model_path Qwen/Qwen3-0.6B

This command will install all required dependencies and run an API on port 4444 by default.

After server goes up you can go to http://localhost:4444 some simple chat page will be exposed there that you can use to test out inference process. Additionally you can use exposed API as openai compatible server and do something like this

from openai import OpenAI
client = OpenAI(base_url="http://localhost:4444/v1", api_key="")
messages = [
    {"role": "system", "content": "You are helpful assistant, answer user questions"},
    {"role": "user", "content": "Who was Shakesphere? Tell me in detail"},
]
response = client.chat.completions.create(messages=messages, model="w/e")
print(response)

Oh and right now there is no sophisticated sampling implemented, during decoding next token is just sampled using argmax from logits.

For now this is just an experimental-exploration project in future there is a plan to further optimize it and play around with metal kernes.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

macos_serving-0.1.1.tar.gz (62.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

macos_serving-0.1.1-py3-none-any.whl (20.9 kB view details)

Uploaded Python 3

File details

Details for the file macos_serving-0.1.1.tar.gz.

File metadata

  • Download URL: macos_serving-0.1.1.tar.gz
  • Upload date:
  • Size: 62.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.2

File hashes

Hashes for macos_serving-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8cefb6583e785a70604d21feb6e3b4e8c1bd18f15fd36a445fca637b27805f9b
MD5 c6bebdc5561280c6a365fd0713a26f88
BLAKE2b-256 18153e728ff1aee891dc61b4339c526901263c6b690544ee631506abda2bd3fc

See more details on using hashes here.

File details

Details for the file macos_serving-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for macos_serving-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0d780871bafb4415ff2eea2e78a7a1900911a78d1b6cc4f35c06b6c0c2e520d1
MD5 d36b2f090564be1c93ad796220c4b8d8
BLAKE2b-256 b9b3dd12aab959d319e4ea80dbea2946a40107cc3e997e0bf0e826fb9b0ef0d6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page