Accelerate a World of LLMs on Hugging Face with NVIDIA NIM
NVIDIA NIM now ships a single Docker container that can serve over 100,000 Hugging Face LLMs. It inspects each model's format, architecture and quantization, then picks TensorRT-LLM, vLLM or SGLang as the backend and applies preset tuning. Supported inputs are safetensors checkpoints, GGUF, and TensorRT-LLM checkpoints or engines. Docker commands show how to deploy from Hugging Face or local paths, pin a backend via list-model-profiles and NIM_MODEL_PROFILE, serve GGUF/AWQ quantized models, and set tensor parallelism and context length through environment variables.
Related posts
- Introducing the Hugging Face LLM Inference Container for Amazon SageMaker
Hugging Face mediumAdeptHugging Face's LLM Inference Deep Learning Container for Amazon SageMaker is built on Text Generation Inference (TGI), which provides tensor parallelism, continuous batching, flash-attention, bitsandbytes quantization, safetensors loading and SSE token streaming. The walkthrough deploys the 12B Pythia Open Assistant model on an ml.g5.12xlarge instance (4 A10G GPUs) using the sagemaker Python SDK, with environment variables for GPU count and token limits. It then covers TGI generation parameters such as temperature, top_p, stop sequences and repetition penalty, and builds a Gradio chatbot on top of the endpoint. For a cheaper setup, a g5.2xlarge with int8 quantization is suggested.
- Transformers now runs llama.cpp quants
Hugging Face mediumAdeptHugging Face transformers can now load GGUF (llama.cpp) quantized checkpoints via `from_pretrained(..., gguf_file=...)` and serve them through `transformers serve` with an OpenAI-compatible API. Weights stay packed on Apple Silicon, and ggml's Metal kernels are reused via the `kernels` library for quantized matmul, fused RMSNorm, flash attention, gated delta nets and MoE top-k routing. Two `generate` changes, dropping all-ones padding masks and deferring the stopping check asynchronously, cut CPU-GPU synchronization for all models. Benchmarks on an M2 Max show throughput close to llama-bench for Qwen3.5 dense and MoE checkpoints, though llama.cpp remains the recommended engine for pure local inference. The initial packed path is MPS-only, and padded batching is still slower.
- Hugging Face Text Generation Inference available for AWS Inferentia2
Hugging Face mediumAdeptText Generation Inference (TGI) is now generally available on AWS Inferentia2 through Amazon SageMaker, offering an alternative to GPUs for serving open LLMs such as Llama and Mistral. A walkthrough deploys Zephyr 7B on an ml.inf2.8xlarge using the TGI Neuronx container. Because Inferentia2 lacks dynamic shapes, batch size, sequence length, core count and cast type must be fixed at compile time. A neuron model cache provides pre-compiled configurations; compiling an uncached one with optimum-cli can take up to 45 minutes. The deployment environment variables (HF_NUM_CORES, HF_BATCH_SIZE, HF_SEQUENCE_LENGTH, MAX_TOTAL_TOKENS) must match those compile-time settings.
- Deploy LLMs with Hugging Face Inference Endpoints
Hugging Face mediumAdeptFalcon 40B Instruct can be deployed to Hugging Face Inference Endpoints through the web UI by choosing a repository, cloud, region and instance. For best performance the suggested 4x T4 instance should be switched to a single A100. Once the endpoint is live it can be called with cURL, and generation is controlled through parameters such as temperature, max_new_tokens (max 512), top_k/top_p, repetition_penalty and stop sequences. Tokens can be streamed to clients using huggingface_hub's InferenceClient in Python or HfInferenceEndpoint from @huggingface/inference in JavaScript, with code that skips special tokens and stops on stop sequences.
- Run LLMs Locally with Docker: A Quickstart Guide to Model Runner
Docker mediumAdeptDocker Model Runner, in beta with Docker Desktop 4.40 on Apple silicon, pulls LLMs packaged as OCI artifacts and serves them through an OpenAI-compatible API backed by llama.cpp. Unlike `docker container run`, `docker model run` starts no container. The inference engine runs as a native host process for GPU acceleration, loads models on demand, and unloads them after 5 minutes of inactivity. Containers reach it at model-runner.docker.internal, and host processes can use an optional TCP port (12434), so any OpenAI client such as LangChain4j can point at it by setting a base URL and a model tag of the form {model}:{parameters}-{quantization}.