tensorcad
v0.1.21Design transformer LLM architectures and report their parameters, FLOPs, memory and cost
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
tensorcad_list_designs List designs
List the designs this server has open, the built-in reference architectures you can start from, and the .tensorcad.json files it can see on disk. Start here when you do not already hold a design_id.
| Parameter | Type | Description |
|---|---|---|
include_files | boolean | Also scan the working directory for .tensorcad.json files. |
tensorcad_new_design New design
Create a design from a reference architecture, or an empty one with just the B and T runtime symbols. Returns the design_id every other tool needs.
| Parameter | Type | Description |
|---|---|---|
name | string | Name for the new design. Defaults to the preset's name. |
preset | string | One of: nano-sort, gpt2-small, gpt2-medium, gpt2-large, gpt2-xl, nanogpt, bloom-7b1, t5-small, flan-t5-base, llama-2-7b, mistral-7b, llama-3-8b, llama-3-70b, llama-3.1-405b, qwen2.5-7b, qwen3-8b, gemm… |
tensorcad_open_design Open design
Load a .tensorcad.json document from disk and return a design_id for it. Opening the same path twice returns the same handle.
| Parameter | Type | Description |
|---|---|---|
path * | string | Path to a .tensorcad.json file, absolute or relative to the server's directory. |
tensorcad_save_design Save design
Write a design to disk as .tensorcad.json. Overwrites the file it was opened from unless a path is given.
| Parameter | Type | Description |
|---|---|---|
design_id * | string | Handle returned by tensorcad_new_design or tensorcad_open_design, e.g. "dsn_1". |
path | string | Where to write. Defaults to the path it was opened from. |
tensorcad_get_design Get design
Read a design. Use format "outline" (the default) first: it is the whole structure, symbol table and edge shapes in a fraction of the tokens. Use format "full" only when you need the literal JSON document.
| Parameter | Type | Description |
|---|---|---|
design_id * | string | Handle returned by tensorcad_new_design or tensorcad_open_design, e.g. "dsn_1". |
format | string | "outline" is a compact block/edge summary; "full" is the whole document. |
tensorcad_get_block Get block
One block of a design: its parameters as written and as resolved, the inferred shape on every port, what each port is wired to, and how many trainable parameters it contributes.
| Parameter | Type | Description |
|---|---|---|
design_id * | string | Handle returned by tensorcad_new_design or tensorcad_open_design, e.g. "dsn_1". |
path * | string | Block path from the outline, e.g. "layers/block" or "embed". |
tensorcad_search_catalog Search catalog
Search the block catalog. Returns each block's parameter schema, port patterns and documentation, which is what you need before adding a block with tensorcad_apply_ops.
| Parameter | Type | Description |
|---|---|---|
category | string | attention, mlp, norm, embedding, container, io, ... |
kind | string | |
limit | integer | Default 20. |
query | string | Substring matched against type, category, summary and formula. |
tensorcad_apply_ops Apply edits
Apply a batch of edits to a design. The batch is all-or-nothing: the first rejected operation aborts it and the design is left untouched. Pass expected_revision to be told about a concurrent edit instead of silently overwriting it. Returns the new revision, what changed, and a fresh validation summary.
| Parameter | Type | Description |
|---|---|---|
design_id * | string | Handle returned by tensorcad_new_design or tensorcad_open_design, e.g. "dsn_1". |
ops * | array | Edits applied in order. |
expected_revision | integer | Revision you last read. The call is rejected if the design has moved on. |
tensorcad_validate Validate design
Run every design rule: shape and symbol errors, kernel-friendly head dimensions, tensor-core multiples, whether training and serving fit the chosen device, Chinchilla sanity and drift from published numbers. Each finding carries a fix hint.
| Parameter | Type | Description |
|---|---|---|
design_id * | string | Handle returned by tensorcad_new_design or tensorcad_open_design, e.g. "dsn_1". |
B | integer | Micro-batch size. |
S | integer | Source length, for an encoder-decoder: the second sequence its encoder runs along. Defaults to the document's own S; ignored by a design that declares none. |
T | integer | Sequence length. Defaults to the document's own T. |
concurrency | integer | Concurrent sequences when serving. |
dp | integer | Data parallel degree. |
dtype | string | Training dtype. Default bf16. |
ep | integer | Expert parallel degree. |
gpus | integer | |
hardware | string | Hardware id: h100-sxm, h200-sxm, b200, a100-80, rtx5080 or rtx4090. Default h100-sxm. |
mfu | number | Model FLOPs utilization, 0..1. |
optimizer | string | |
packing | object | Training rows packed with documents, for a design whose mask keeps them apart (doc(b, q) == doc(b, kv)). Moves the training figures and the cost, not serving. |
pp | integer | Pipeline parallel degree. |
recompute | string | |
severity | string | Only return findings at least this bad. |
tokens | number | Training token budget. Defaults to Chinchilla-optimal. |
tp | integer | Tensor parallel degree. |
zero | integer | ZeRO/FSDP sharding stage. |
tensorcad_analyze Analyze design
Parameters, FLOPs per token, KV cache, training and serving memory, decode throughput, training cost and Chinchilla position, for a given sequence length, batch, dtype, device, GPU count and parallel plan.
| Parameter | Type | Description |
|---|---|---|
design_id * | string | Handle returned by tensorcad_new_design or tensorcad_open_design, e.g. "dsn_1". |
B | integer | Micro-batch size. |
S | integer | Source length, for an encoder-decoder: the second sequence its encoder runs along. Defaults to the document's own S; ignored by a design that declares none. |
T | integer | Sequence length. Defaults to the document's own T. |
concurrency | integer | Concurrent sequences when serving. |
dp | integer | Data parallel degree. |
dtype | string | Training dtype. Default bf16. |
ep | integer | Expert parallel degree. |
gpus | integer | |
hardware | string | Hardware id: h100-sxm, h200-sxm, b200, a100-80, rtx5080 or rtx4090. Default h100-sxm. |
mfu | number | Model FLOPs utilization, 0..1. |
optimizer | string | |
packing | object | Training rows packed with documents, for a design whose mask keeps them apart (doc(b, q) == doc(b, kv)). Moves the training figures and the cost, not serving. |
pp | integer | Pipeline parallel degree. |
recompute | string | |
tokens | number | Training token budget. Defaults to Chinchilla-optimal. |
tp | integer | Tensor parallel degree. |
zero | integer | ZeRO/FSDP sharding stage. |
tensorcad_generate_code Generate code
Emit a runnable PyTorch module plus the design document. Without out_dir the file contents come back in the result; with out_dir they are written to disk and only a manifest comes back.
| Parameter | Type | Description |
|---|---|---|
design_id * | string | Handle returned by tensorcad_new_design or tensorcad_open_design, e.g. "dsn_1". |
class_name | string | Class name for the top-level module. |
include_smoke_test | boolean | Emit a __main__ block that checks the size. |
out_dir | string | Directory to write into. Omit to get the contents inline. |
tensorcad_checkpoint Checkpoint design
Snapshot a design under a name you can come back to. Take one before an experiment so tensorcad_restore can put it back exactly.
| Parameter | Type | Description |
|---|---|---|
design_id * | string | Handle returned by tensorcad_new_design or tensorcad_open_design, e.g. "dsn_1". |
label | string | What this snapshot is, e.g. "before widening the FFN". |
tensorcad_restore Restore design
Put a design back. With a checkpoint_id it restores that snapshot; without one it undoes the most recent tensorcad_apply_ops batch. Either way the revision moves forward, so a stale expected_revision still fails.
| Parameter | Type | Description |
|---|---|---|
design_id * | string | Handle returned by tensorcad_new_design or tensorcad_open_design, e.g. "dsn_1". |
checkpoint_id | string | Omit to undo the last batch of edits. |
tensorcad_explain Explain a block
What one block is and what it contributes: its parameters as written and as evaluated, the shape on every port, its share of the model's weights and compute, and its documentation. Use it to answer "why is this block this size" without reading the whole design.
| Parameter | Type | Description |
|---|---|---|
design_id * | string | Handle returned by tensorcad_new_design or tensorcad_open_design, e.g. "dsn_1". |
path * | string | Full path of the block, e.g. "layers/block/attn". |
B | integer | Micro-batch size. |
S | integer | Source length, for an encoder-decoder: the second sequence its encoder runs along. Defaults to the document's own S; ignored by a design that declares none. |
T | integer | Sequence length. Defaults to the document's own T. |
concurrency | integer | Concurrent sequences when serving. |
dp | integer | Data parallel degree. |
dtype | string | Training dtype. Default bf16. |
ep | integer | Expert parallel degree. |
gpus | integer | |
hardware | string | Hardware id: h100-sxm, h200-sxm, b200, a100-80, rtx5080 or rtx4090. Default h100-sxm. |
mfu | number | Model FLOPs utilization, 0..1. |
optimizer | string | |
packing | object | Training rows packed with documents, for a design whose mask keeps them apart (doc(b, q) == doc(b, kv)). Moves the training figures and the cost, not serving. |
pp | integer | Pipeline parallel degree. |
recompute | string | |
tokens | number | Training token budget. Defaults to Chinchilla-optimal. |
tp | integer | Tensor parallel degree. |
zero | integer | ZeRO/FSDP sharding stage. |
tensorcad_scale Scale a design
Shrink a design towards a parameter budget while keeping its proportions, and save the result as a new design. Use it to get a bench-sized proxy of a large architecture: the widths and depth move together, the head dimension stays sane, and the result is reported with how close it landed.
| Parameter | Type | Description |
|---|---|---|
design_id * | string | Handle returned by tensorcad_new_design or tensorcad_open_design, e.g. "dsn_1". |
target_params * | number | The parameter count to aim for. |
keep_depth | boolean | Hold the layer count fixed and move only the width. |
target_basis | string | Whether target_params counts the embedding tables. At bench sizes "non-embedding" is usually meant. |
tie_head | boolean | Share the output projection with the embedding. |
vocab | integer | Replace the vocabulary, for a smaller tokenizer. |
tensorcad_mup Build a width ladder
The same design at several widths, with what to multiply the initialization and the learning rate by at each, following Tensor Programs V. Sweep hyperparameters at the narrow end and carry the answer up: a learning rate tuned at the base rung is the right one at every rung, scaled per class. Every rung is saved as a design of its own, ready to analyze or generate. It does not choose a learning rate; that is what the sweep is for.
| Parameter | Type | Description |
|---|---|---|
design_id * | string | Handle returned by tensorcad_new_design or tensorcad_open_design, e.g. "dsn_1". |
base_width | number | The width the sweep happens at. Omit for the narrowest. |
widths | array | The widths to build. Omit to halve the design's own width down to a width worth sweeping at. |
tensorcad_plan Plan a cluster
Every way of splitting the training across a cluster that fits, least demanding first. Prices data, tensor, pipeline and expert parallelism, the four ZeRO stages, sequence parallelism and the three recompute settings. Memory is the claim and it is arithmetic; which plan is fastest is not claimed, so each one carries a note about what it costs to run.
| Parameter | Type | Description |
|---|---|---|
design_id * | string | Handle returned by tensorcad_new_design or tensorcad_open_design, e.g. "dsn_1". |
gpus * | integer | How many devices there are. |
B | integer | Micro-batch size. |
S | integer | Source length, for an encoder-decoder: the second sequence its encoder runs along. Defaults to the document's own S; ignored by a design that declares none. |
T | integer | Sequence length. Defaults to the document's own T. |
concurrency | integer | Concurrent sequences when serving. |
dp | integer | Data parallel degree. |
dtype | string | Training dtype. Default bf16. |
ep | integer | Expert parallel degree. |
gpus_per_node | integer | Bounds the tensor-parallel degree. Default 8. |
hardware | string | Hardware id: h100-sxm, h200-sxm, b200, a100-80, rtx5080 or rtx4090. Default h100-sxm. |
headroom | number | Fraction of device memory left free. Default 0.1. |
limit | integer | How many plans to return. Default 8. |
mfu | number | Model FLOPs utilization, 0..1. |
optimizer | string | |
packing | object | Training rows packed with documents, for a design whose mask keeps them apart (doc(b, q) == doc(b, kv)). Moves the training figures and the cost, not serving. |
pp | integer | Pipeline parallel degree. |
recompute | string | |
tokens | number | Training token budget. Defaults to Chinchilla-optimal. |
tp | integer | Tensor parallel degree. |
zero | integer | ZeRO/FSDP sharding stage. |
tensorcad_diff Compare two designs
What changed between two designs and what it cost: the symbols, blocks and wires that moved, then the parameters, FLOPs, cache and memory. Both sides are measured at one operating point, so the attention terms are comparable. Use it after an edit, or against a preset, to check the change did what was meant.
| Parameter | Type | Description |
|---|---|---|
a * | string | The design to compare from. |
b * | string | The design to compare to. |
B | integer | Micro-batch size. |
S | integer | Source length, for an encoder-decoder: the second sequence its encoder runs along. Defaults to the document's own S; ignored by a design that declares none. |
T | integer | Sequence length. Defaults to the document's own T. |
concurrency | integer | Concurrent sequences when serving. |
dp | integer | Data parallel degree. |
dtype | string | Training dtype. Default bf16. |
ep | integer | Expert parallel degree. |
gpus | integer | |
hardware | string | Hardware id: h100-sxm, h200-sxm, b200, a100-80, rtx5080 or rtx4090. Default h100-sxm. |
mfu | number | Model FLOPs utilization, 0..1. |
optimizer | string | |
packing | object | Training rows packed with documents, for a design whose mask keeps them apart (doc(b, q) == doc(b, kv)). Moves the training figures and the cost, not serving. |
pp | integer | Pipeline parallel degree. |
recompute | string | |
tokens | number | Training token budget. Defaults to Chinchilla-optimal. |
tp | integer | Tensor parallel degree. |
zero | integer | ZeRO/FSDP sharding stage. |
tensorcad_import_hf Import a Hugging Face config
Read a Hugging Face `config.json` into a design and save it in this session. Covers the Llama, Mistral, Qwen, Gemma, Mixtral, DeepSeek and GPT-2 families. Anything the importer cannot model faithfully comes back as a warning rather than being approximated silently.
| Parameter | Type | Description |
|---|---|---|
config * | string | The contents of config.json. |
name | string | A name for the design; the config's own is used otherwise. |