> 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/tensor-train-decomposition.md).

# Tensor-train decomposition of a weight matrix

The tensor-train (TT) decomposition is the general method for turning a large tensor into a chain of cores. It is the form Quantaria's layers take when they are written as MPOs. This page covers how the decomposition is computed and what changes between the trained and the factorized form.

## The procedure

Given a dense weight matrix, the TT decomposition is found by a sequence of SVDs:

1. Reshape the matrix into a tensor with one index per physical dimension.
2. Cut off the first core with an SVD, keeping the top singular values.
3. Reshape the remainder and repeat for the next core.

The bond dimensions are set by how many singular values are kept at each step. This is the classic route, and it applies truncation to a dense matrix that already exists.

## Why Quantaria does not start from this

Post-hoc decomposition compresses a model that was trained dense. Quantaria trains the cores directly, so the model learns inside the low-rank format rather than losing accuracy when squeezed into it. The TT form is the parameterization, not a compression step.

## What the procedure gives you

* An exact decomposition if the bonds are not truncated.
* An approximate decomposition if they are. The error is bounded by the discarded singular values (see [SVD and truncation](/deep-dives/svd-and-truncation.md)).

## Trade-offs

* Choosing the reshaping (which indices group into which cores) changes the bond sizes. Some groupings compress much better than others.
* Large χ recovers accuracy at the cost of parameters.

## Quantaria's use

Each Hilbert-1 layer is an MPO in tensor-train form. The reshaping is a design decision in the architecture. See [Matrix product operators as weight matrices](/deep-dives/matrix-product-operators.md).

## Related

* [Parameter counting for tensor-network layers](/deep-dives/parameter-counting.md)
* [Rank-adaptive training](/deep-dives/rank-adaptive-training.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/tensor-train-decomposition.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.
