> For the complete documentation index, see [llms.txt](https://docs.spice.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.spice.ai/docs/enterprise/features/distributed-inference.md).

# Distributed Inference

Spice.ai Enterprise can serve a single language model across multiple nodes using **tensor parallelism**. A model whose weights do not fit in one node's memory is split across nodes, which exchange activations over a pure-TCP **ring** all-reduce backend. The ring backend needs no NCCL or other system dependency.

{% hint style="info" %}
Multi-node distributed inference is a **Spice.ai Enterprise** feature and requires the `distributed` build. Single-node model serving — including `model_type: glm4` — is available in Spice.ai OSS. See [Hugging Face model provider](https://github.com/spicehq/docs/tree/trunk/building-blocks/model-providers/huggingface.md).
{% endhint %}

## Configuration

Run the same model on every node, changing only `node_rank`. Every node is given the identical `nodes` list, ordered by rank; rank `0` is the head node and serves the API.

```yaml
models:
  - name: glm
    from: huggingface:huggingface.co/THUDM/glm-4-9b-chat
    params:
      model_type: glm4              # glm4, glm4moe, or glm4moelite
      distributed_backend: ring     # none (default, single-node) | ring
      nodes: 10.0.4.21,10.0.4.22    # identical on every node, ordered by rank
      node_rank: 0                  # this node's rank; set node_rank: 1 on 10.0.4.22
```

| Parameter             | Description                                                                              |
| --------------------- | ---------------------------------------------------------------------------------------- |
| `distributed_backend` | `none` (default, single-node) or `ring` (multi-node tensor parallelism over TCP).        |
| `nodes`               | Comma-separated, rank-ordered list of node host/IPs. The same list is set on every node. |
| `node_rank`           | This node's rank in `[0, world_size)`. Rank `0` is the head node and serves the API.     |

The **world size** is the number of entries in `nodes`.

## Constraints

* At least **2 nodes** are required.
* The world size must be a **power of two**.
* The `ring` backend currently supports **exactly 2 nodes** (`world_size = 2`).
* `node_rank` must be within `[0, world_size)`.
* The world size must divide the model's attention / KV head counts; this is enforced when the model loads.

## See also

* [Distributed Query](/docs/enterprise/features/distributed-query.md)
* [High Availability](/docs/enterprise/production/high-availability.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.spice.ai/docs/enterprise/features/distributed-inference.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
