> For the complete documentation index, see [llms.txt](https://docs.quantaria.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.quantaria.xyz/deep-dives/matrix-product-states.md).

# Matrix product states from scratch

A matrix product state (MPS) is a way to write a very large vector using a chain of small tensors. It is the basic building block behind every Quantaria layer.

## The problem it solves

A vector with N entries, where each entry is indexed by d values, has d^N components. For N = 30 binary sites that is about a billion numbers. Storing the full vector is impossible long before N reaches the sizes used in practice.

An MPS avoids this by writing each entry as a product of small matrices, one per site:

ψ(i₁, i₂, …, i\_N) = A¹\[i₁] · A²\[i₂] · … · Aᴺ\[i\_N]

Each Aᵏ\[iₖ] is a matrix. The first and last sites use row and column vectors so the product is a number.

## Shapes and bonds

The matrices are chained through bond indices. If Aᵏ has size χₖ₋₁ × χₖ, then neighbouring cores share a bond of dimension χₖ. The bond dimension χ is the largest of these, and it controls how much correlation the chain can carry.

The number of parameters is roughly N · d · χ². For fixed d and χ this grows linearly in N, not exponentially.

## Why this matters for weights

Quantaria stores each layer's weight matrix in the same form, but as a matrix product operator, with two physical indices per core (see [Matrix product operators](/deep-dives/matrix-product-operators.md)). The idea is the same: the chain stays small, and the bond sets the capacity.

## What the MPS does not do

* It is not a general-purpose compression of any matrix. The shape of the chain assumes some structure in the data. Quantaria's rank-adaptive training is meant to find that structure during training rather than assume it.
* It does not guarantee accuracy. Compressed layers can lose information if χ is too small for the task.

## Quantaria's use

* **Live:** Hilbert-1 Nano and Base use MPS/MPO weight layers. See [Tensor-Network Weights](https://github.com/bhavy2908/dataai_docs/tree/main/architecture/tensor-network-weights.md).
* **Background:** the MPS formalism is standard in physics. The variants used in Quantaria's models are described in [Rank-adaptive training](/deep-dives/rank-adaptive-training.md).

## Related

* [Bond dimension and entanglement entropy](/deep-dives/bond-dimension-and-entanglement.md)
* [Canonical forms and sweeps](/deep-dives/canonical-forms-and-sweeps.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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.quantaria.xyz/deep-dives/matrix-product-states.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
