Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Hugging Face 6 min read How-to mediumAdept

Deploy LLMs with Hugging Face Inference Endpoints

Falcon 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.

Related posts

  • Inference for PROs

    Hugging Face mediumAdept

    Hugging Face PRO subscribers get curated, rate-limit-boosted HTTP inference endpoints served by text-generation-inference for models such as Llama 3, Mixtral 8x7B, Zephyr, Code Llama, Stable Diffusion XL and Bark, intended for prototyping rather than heavy production (Inference Endpoints is recommended for that). Usage is shown via curl, the huggingface_hub InferenceClient and the OpenAI-compatible Messages API, including Llama 2 chat templates and Code Llama's <PRE>/<SUF>/<MID> infilling format. Generation parameters (do_sample, temperature, top_k, top_p, repetition_penalty, max_new_tokens, stop_sequences, SDXL guidance and steps) are explained, along with disabling response caching via the x-use-cache: 0 header and token streaming.

  • Run a vLLM Server on HF Jobs in One Command

    Hugging Face mediumAdept

    A single `hf jobs run` command using the official vllm/vllm-openai image, a GPU `--flavor` and `--expose 8000` launches a private, OpenAI-compatible LLM endpoint on Hugging Face infrastructure, billed per second and gated by HF token auth through the jobs proxy. The guide covers querying via curl and the OpenAI Python client, and scaling to Qwen3.5-122B on 2×H200 with `--tensor-parallel-size`, using capped `--max-model-len` and `--max-num-seqs` to avoid out-of-memory errors. It also shows a Gradio chat UI, SSH debugging, and enabling tool-call parsing to back the Pi coding agent. HF Jobs suits experiments, evals and batch generation, while Inference Endpoints fit production workloads that need scale-to-zero and finer access control.

  • From OpenAI to Open LLMs with Messages API on Hugging Face

    Hugging Face mediumAdept

    Text Generation Inference 1.4.0 adds a Messages API compatible with OpenAI's Chat Completion API, so open LLMs on Inference Endpoints can be called from existing OpenAI client code by changing the base URL and token. The guide deploys Nous-Hermes-2-Mixtral-8x7B-DPO via huggingface_hub with TGI token-limit settings and then calls it from the OpenAI Python and JavaScript clients. It also plugs the endpoint into LangChain (ChatOpenAI) and LlamaIndex (OpenAILike) RAG pipelines. Limitations: no function calling, only models with a chat_template, and a subset of parameters (stream, max_tokens, temperature, top_p, seed, logprobs, frequency_penalty).

  • Deploy Embedding Models with Hugging Face Inference Endpoints

    Hugging Face mediumAdept

    Open-source embedding models such as BAAI/bge-base-en-v1.5 can be deployed on Hugging Face Inference Endpoints using Text Embeddings Inference (TEI), which offers token-based dynamic batching, Flash Attention, Candle and cuBLASLt kernels, safetensors loading, small images for fast boot, and OpenTelemetry/Prometheus support. Deployment is click-through: pick a model, cloud, region and instance, such as an Nvidia A10G instead of the suggested CPU instance. Batch requests are sent over HTTP with `truncate: true`, because TEI does not truncate inputs by default. A benchmark at sequence length 512 and batch size 32 reached 450+ req/sec, about $0.00000156 per 1k tokens, which Hugging Face says is 64x cheaper than OpenAI embeddings.

  • Deploy Meta Llama 3.1 405B on Google Cloud Vertex AI

    Hugging Face mediumAdept

    Meta Llama 3.1 405B Instruct in FP8 can be served on a single Google Cloud A3 node (8x H100 80GB, ~640 GB VRAM) through Vertex AI, using Hugging Face's Text Generation Inference Deep Learning Container. FP16 weights would need ~810 GB, so FP8 (~405 GB) is the recommended way to fit one node while leaving room for KV cache and CUDA graphs. The walkthrough covers the A3 quota requests, gcloud and SDK setup, registering the model with TGI environment variables (MODEL_ID, NUM_SHARD=8, HF token), and deploying to an endpoint, which takes about 25-30 minutes. It then shows how to apply the Llama 3.1 chat template with transformers and send prediction requests to the endpoint from Python.

The quest for software engineering knowledge.

Look:
Layout: