
Sizing 560B and 708B Models in JavaScript: Weights, Active Parameters, and KV Cache
This post builds a small JavaScript sizing estimator for two reported large-model releases: GigaChat 4 at 708B parameters and LingSante-3.1-flash at 560B total with 25B active per token. The goal is to keep three deployment budgets separate — weight residency, active-parameter compute, and KV cache growth — because both announcements invite the same lazy arithmetic: divide the parameter count by a byte-per-parameter figure, get a number, call it a hardware requirement. That arithmetic isn't wrong so much as incomplete. Weight residency is one budget. Per-token compute is a second. KV cache under context length and concurrency is a third, and at the context lengths being advertised here, that third one usually decides the deployment.
The estimator refuses to guess at missing architecture fields and produces numbers you can audit line by line against your own arithmetic. Nothing here benchmarks GigaChat 4 or LingSante-3.1-flash. I ran neither model. This is sizing arithmetic plus a clear statement of what is still unknown.
On this page
Two Reported Releases, Three Separate Deployment Budgets
Frame the walkthrough around three budgets
Three quantities drive a serving budget, and each one scales with different inputs:
- Weight residency — every stored parameter occupies memory for as long as the model is loaded. It scales with total parameters and stored bits per parameter. How many parameters are active per token does not enter this budget.
- Active-parameter compute — the multiply-accumulate work per generated token scales with active parameters. In a mixture-of-experts model that can be a small fraction of the total.
- KV cache — the key and value tensors retained for every token still in context, for every concurrent request. It scales with layers, KV heads, head dimension, cache precision, retained tokens, and concurrency. It is independent of parameter count.
A model can be cheap on one axis and ruinous on another. The reported GigaChat 4 configuration, 708B parameters with a 1M-token context, is the interesting case precisely because those two facts interact badly.
Preserve the source timeline for both releases
The supplied material is two pieces of news coverage, both dated the same day:
- MLQ.ai, coverage timestamp
2026-11-28T22:43:45Z, reports that Sber has open-sourced GigaChat 4, described as a 708B-parameter model with a 1M-token context. - MarkTechPost, coverage timestamp
2026-11-28T09:45:33Z, reports an open-weight LingSante-3.1-flash release from Ant Group with 560B total parameters and 25B activated per token.
Those are publication timestamps for articles, not verified release times for artifacts. A news article can go up before a repository is public, after it was quietly pushed, or against a pre-announcement briefing. Treat the timestamps as "when the claim entered circulation," nothing stronger.
State the evidence boundary for reported specifications
Everything specification-shaped in this post comes from those two secondary reports:
| Claim | Reported value | Source tier |
|---|---|---|
| GigaChat 4 total parameters | 708B | Secondary (MLQ.ai) |
| GigaChat 4 context length | 1M tokens | Secondary (MLQ.ai) |
| LingSante-3.1-flash total parameters | 560B | Secondary (MarkTechPost) |
| LingSante-3.1-flash active parameters per token | 25B | Secondary (MarkTechPost) |
| LingSante-3.1-flash architecture family | MoE (implied by active/total split) | Secondary |
| GigaChat 4 architecture | not reported | Unresolved |
| Layer counts, KV head counts, head dims | not reported | Unresolved |
| Quantization formats shipped | not reported | Unresolved |
| License terms | headline says "open-source" / "open-weight" | Unresolved |
Note what the second row does not say. "1M-token context" is a capability claim. It does not mean a 1M-token request is servable on any particular machine, and it certainly does not mean a thousand concurrent 1M-token requests are.
Establish the technical position: weights are not serving budgets
The position this post argues: parameter headlines are not serving budgets, and for long-context models the KV cache — not the weight count — is usually the binding constraint. A 560B model with a 25B activation path is much cheaper to run per token than its total suggests, and barely cheaper to hold in memory than a dense 560B model. The reverse case makes the same point: a 708B model advertising 1M tokens is making a claim whose cost lands almost entirely in the cache budget.
Treat any deployment conclusion drawn before you have the model's config.json as provisional. Layer count, KV head count, and head dimension are not derivable from a total parameter count, and they dominate the long-context budget.
Build an Evidence Ledger Before Filling In the Calculator
Separate reported specifications from assumptions
The estimator needs numeric inputs. The release coverage supplies almost none of them. So build a ledger that marks every cell as reported, verified, assumed, or missing, and then refuse to fill missing cells with plausible-looking defaults.
| Field | GigaChat 4 | LingSante-3.1-flash | Needed for |
|---|---|---|---|
| Total parameters | 708B (reported) | 560B (reported) | Weight payload |
| Active parameters/token | unknown | 25B (reported) | Compute proxy |
| Dense vs MoE | unknown | MoE per reporting | Expert residency |
| Layer count | unknown | unknown | KV cache |
| KV heads | unknown | unknown | KV cache |
| Head dimension | unknown | unknown | KV cache |
| Cache dtype support | unknown | unknown | KV cache |
| Weight quant formats | unknown | unknown | Residency floor |
| Max context | 1M tokens (reported) | unknown | Admission budget |
| License | unknown | unknown | Deployment legality |
| Checkpoint revision | unknown | unknown | Reproducibility |
That table holds only a few useful numbers. Everything else is a hole, and a sizing tool that silently fills holes with 32 layers and 32 KV heads is producing fiction with a decimal point.
Collect the missing primary artifacts
Before the estimator can produce a defensible answer, these need to exist and be read:
- Official repository and exact revision — a commit hash or tagged release, not a branch name.
- Checkpoint index — the
*.safetensors.index.jsonequivalent, which reveals tensor sharding and total on-disk size. - Architecture configuration —
num_hidden_layers,num_key_value_heads,head_dim,hidden_size,num_experts,num_experts_per_tok,max_position_embeddings. - Supported inference backend — which runtime the authors actually validated, at which version.
- Quantization documentation — which formats exist, what the group sizes are, which kernels are tested.
- License text — the actual file, not the adjective in a headline.
Do not infer architecture from the headline
Two traps here. First, 708B parameters tells you nothing about whether GigaChat 4 is dense or sparse, and nothing about its attention pattern. A dense 708B transformer and a 708B MoE with a 30B activation path have identical weight payloads and wildly different compute profiles. Guess dense and you overstate decode cost; guess MoE and you understate it.
Second, the MoE label on LingSante-3.1-flash describes the feed-forward blocks. It says nothing about the attention blocks. MoE models still carry a KV cache from their attention layers, and the KV layout depends on the attention configuration, which the reporting does not include. Writing "MoE, so cheap" in that cell is not analysis.
Calculate Weight Storage From Total Parameters
Derive the idealized payload formula
The floor is simple arithmetic:
bytes = ceil(total_parameters × bits_per_parameter / 8)
Two unit notes matter more than they look. First, GB ≠ GiB. 1 GB = 10^9 bytes; 1 GiB = 2^30 = 1,073,741,824 bytes. A 354 GB payload is 329.69 GiB, and accelerator capacity is nearly always quoted in GiB. Mixing the two produces a 7.4% error, which is enough to turn a fit into an out-of-memory.
Second, the ceiling matters at the margins for packed formats. A 4-bit payload of 3 parameters is 12 bits, which occupies 2 bytes, not 1.5.
Show the baseline weight-payload table
For the two reported parameter counts:
| Model (reported) | 16-bit | 8-bit | 4-bit |
|---|---|---|---|
| 708B | 1,416.00 GB / 1,318.75 GiB | 708.00 GB / 659.38 GiB | 354.00 GB / 329.69 GiB |
| 560B | 1,120.00 GB / 1,043.08 GiB | 560.00 GB / 521.54 GiB | 280.00 GB / 260.77 GiB |
These are the numbers the JavaScript reproduces exactly later. They are also the numbers most likely to be quoted out of context, so state their limits immediately.
Explain why payload is not VRAM
The payload is pure tensor data. A real loaded model carries more:
- Quantization metadata — block scales and zero points. A 4-bit format with a 16-bit scale per 32-parameter group costs an extra 0.5 bits per parameter, so "4-bit" is really ~4.5 bits, roughly 12% above the naive figure. Double quantization reduces this but does not eliminate it.
- Embedding and output layers — frequently kept at higher precision than the body, and proportionally large when the vocabulary is large.
- Norms, routers, biases — small in total but usually stored in fp32 or bf16 regardless of body precision.
- Padding and alignment — tensor alignment, packed-format block padding at layer boundaries, and file-format headers.
- Replicated tensors — some tensors are replicated per rank rather than sharded, which changes per-device totals even when the aggregate is unchanged.
- Runtime allocations — CUDA context, kernel workspaces, communication buffers. Small per device, nonzero, worth naming.
If you only ever quote one number, quote the 4-bit payload plus a stated overhead percentage. "354 GB of weights" and "a 4-bit configuration that measured ~395 GB resident" are different claims, and only the second one is deployable.
Distinguish the four memory numbers
Four numbers get conflated constantly, and each fails in a different way:
| Number | What it measures | Fails as |
|---|---|---|
| Checkpoint download size | Bytes transferred from the registry | Disk space, transfer time |
| Host-memory loading requirement | Bytes held in RAM during load | OOM on the host, swap thrash |
| Steady-state accelerator residency | Bytes resident after warmup | Accelerator OOM mid-run |
| Temporary loading/conversion peak | Bytes touched during load or requantization | OOM only during startup, which is easy to miss |
That last one is the quiet killer. Shard-by-shard loading, on-the-fly dequantization, or dtype conversion can transiently need noticeably more than the steady state.
Explain What 25B Active Parameters Does—and Does Not—Buy
Use the reported 560B/25B split for conditional execution
LingSante-3.1-flash is reported at 560B total with 25B activated per token. That split is the signature of conditional expert execution: the model stores a large pool of feed-forward experts and routes each token through a small subset. In a typical arrangement the attention blocks and some shared feed-forward path run for every token while the routed experts vary.
The caveat: the reporting does not include routing details. Top-k value, expert count per layer, whether routing is per-token or per-group, whether shared experts exist, and whether 25B is a per-layer figure or an average are all unknown. The mechanics are well understood; this model's specific parameters are not.
Inactive experts still occupy storage
The reported 25B is an activation count, not a residency count. In a fully resident deployment the other ~535B parameters are still in memory, occupying the same bytes you computed from 560B. Sparsity buys compute, not capacity.
What sparsity does enable is a different placement decision: keeping cold experts on host memory or NVMe and pulling them in on demand. That converts a capacity problem into a bandwidth problem. Each token may then require transferring whatever expert weights its routing selects, and since routing changes token to token, that traffic is bursty and hard to predict. Offload is a placement strategy, not free capacity.
Introduce the operations-per-participating-weight proxy
A crude but useful compute proxy: a matrix multiplication touches each participating weight once with a multiply and once with an add, so
operations_per_token ≈ 2 × active_parameters
For 25B active parameters that is roughly 50 billion operations per token for the routed matrix multiplications. Sanity check on magnitude: at 20 tokens/second that is 1 TFLOP/s of arithmetic. Modern accelerators sit far above that, which tells you immediately that decode is not arithmetic-bound.
Treat this as an upper-bound-shaped estimate, not a measurement. It excludes attention over the KV cache, normalization, routing computation, and sampling. It also assumes every "active" parameter participates in a dense matmul, which is only approximately true for grouped or sparse expert dispatch.
The ratio is not a throughput prediction
A 560B/25B model is not "22× faster" than a dense 560B model. Several things break that arithmetic:
- Memory bandwidth dominates decode. Single-stream decode reads the active weights once per token. 25B active at 4 bits is ~12.5 GB per token; at ~3 TB/s of HBM bandwidth that is a floor of roughly 4 ms/token, a few hundred tokens per second of pure weight streaming, before KV reads, before realistic bandwidth utilization, before batching. This is inference from bandwidth figures, not a benchmark of either model.
- Routing is a load-balancing problem. Experts receive uneven token counts. A hot expert serializes. Capacity factors in serving stacks exist precisely to spread load, and they change the effective batch shape.
- Attention and shared layers do not shrink. For long contexts, attention work and KV-cache reads sit outside the 25B entirely.
- Interconnect traffic grows under expert parallelism. If experts are distributed, every routed token may cross a link.
Derive KV-Cache Memory From the Attention Architecture
The conventional full-attention formula
For standard multi-head attention with grouped-query attention, the per-token cache is:
bytes_per_token = 2 × layers × kv_heads × head_dim × bytes_per_cache_element
The leading 2 is keys plus values. kv_heads is the number of key/value heads — not the query head count. Getting this wrong is the single most common KV sizing error, and with GQA the error factor equals the query-to-KV head ratio, often 4× or 8×.
Note that bytes_per_cache_element is independent of weight precision. A 4-bit weight configuration commonly runs an fp16 or bf16 cache; some stacks support fp8 KV cache with quality tradeoffs. The two precisions are separate decisions.
GQA, MQA, and where the formula breaks
- MHA —
kv_heads == query_heads. Maximum cache, best quality per head. - GQA —
kv_heads < query_heads, groups of queries share a KV head. Cache divides by the group factor. - MQA —
kv_heads == 1. Smallest conventional cache, largest quality risk.
The formula also stops applying as written under several real architectures: sliding-window attention (only the window is retained, so effective tokens per layer differ), hybrid stacks mixing full and local layers, latent or compressed attention where the cache stores a compressed representation rather than per-head K and V, cross-layer cache sharing, and backend-specific layouts with padding or interleaving. Each requires an architecture-aware calculation, and none of them is inferable from a parameter count.
Work a synthetic KV-cache example
To make the arithmetic checkable, use a made-up configuration and label it loudly as synthetic:
- 80 layers
- 8 KV heads
- head dimension 128
- 2 bytes per cache element (fp16/bf16)
bytes_per_token = 2 × 80 × 8 × 128 × 2 = 327,680 bytes = 320 KiB
This is not GigaChat 4's configuration. It is not LingSante-3.1-flash's configuration. It is a number chosen so the arithmetic is clean and the scaling is obvious.
Show reproducible KV-cache outputs
| Retained tokens | Cache bytes | Binary | Decimal |
|---|---|---|---|
| 32,768 | 10,737,418,240 | 10.00 GiB | 10.74 GB |
| 131,072 | 42,949,672,960 | 40.00 GiB | 42.95 GB |
| 1,000,000 | 327,680,000,000 | 305.18 GiB | 327.68 GB |
Read that last row next to the weight table. At these synthetic attention parameters, a single 1M-token request costs 305.18 GiB of cache, comparable to the 329.69 GiB of 4-bit weights for the 708B model. Context length is not a free feature bolted onto the model; it is a second model-sized memory reservation.
Turn Context Length and Concurrency Into an Admission Budget
A reported context limit is not an affordable context
Two clarifications are needed before any 1M-token claim becomes a budget line:
- Is 1M exactly 1,000,000 or 1,048,576? The difference is 4.86%, and it propagates straight into the cache figure.
- Does the limit include generated output? If the maximum is a combined prompt-plus-output budget, a 1M-token prompt leaves no room for a response and the practical prompt ceiling is lower.
Neither answer is in the supplied reporting. Both move the admission math by several percent, which at 305 GiB is several GiB.
Budget retained plus reserved tokens per request
Admission control should multiply a reservation, not a nominal maximum:
retained_tokens_total = Σ over requests (prompt_tokens + reserved_output_tokens)
Reserving output up front is conservative, since the cache grows token by token rather than materializing at once, but it is the right shape for admission: a request admitted without room to finish will fail mid-generation. Mid-generation OOM is worse than admission rejection. It wastes the prefill work and looks like a server bug to the caller.
How batching, paging, prefix sharing, and block rounding change the math
Four runtime mechanisms change the arithmetic. Be precise about how much each one buys:
- Continuous batching interleaves requests at the token level so slots are reused as requests finish. It raises utilization; it does not reduce per-token cache bytes.
- Paged cache allocation splits the cache into fixed-size blocks so memory is allocated as needed rather than preallocated for a worst case. The saving is the gap between reserved and actually used, real but bounded by block rounding.
- Block rounding inflates every request to a block boundary. With 16-token blocks and thousands of requests that is noise; with 1M-token requests and generous blocks it is not.
- Prefix sharing deduplicates identical prompt prefixes across requests, a large win for shared system prompts. It requires the serving stack to have prefix caching enabled and to actually match block hashes. Assuming it is always on is how capacity plans go wrong.
Prefill and decode are different constraints
- Prefill processes the whole prompt. Attention work for conventional full attention grows roughly quadratically in prompt length, so a 1M-token prompt is a compute and workspace event, not just a memory event. Time to first token is dominated here, and the transient workspace can exceed steady-state usage.
- Decode processes one token at a time and reads the cache back. Retained KV state constrains how many requests can be in flight; memory bandwidth constrains per-token latency.
That quadratic prefill estimate is explicitly conditional on conventional full attention. Sliding-window or hybrid attention reduces it, and if either model uses such a pattern the estimate does not apply. Which is exactly the kind of unresolved question that should block a confident capacity plan.
Implement a Small, Auditable JavaScript Sizing Tool
Define explicit inputs and reject missing fields
The module below takes every architecture quantity as an argument and throws when one is absent or nonsensical. There are no defaults for layers, KV heads, or head dimension, deliberately.
// sizing.mjs — arithmetic only. No claims about any real model.
const GB = 1_000_000_000n; // decimal gigabyte
const GIB = 1_073_741_824n; // binary gibibyte
function requirePositiveInt(name, value) {
if (!Number.isInteger(value) || value <= 0) {
throw new RangeError(`${name} must be a positive integer, got ${String(value)}`);
}
}
function asBig(name, value) {
if (typeof value !== "bigint" || value < 0n) {
throw new TypeError(`${name} must be a non-negative BigInt`);
}
return value;
}
function asParams(name, value) {
if (typeof value === "bigint") {
if (value <= 0n) throw new RangeError(`${name} must be > 0, got ${value}`);
return value;
}
if (!Number.isSafeInteger(value) || value <= 0) {
throw new TypeError(`${name} must be a positive safe integer or BigInt, got ${String(value)}`);
}
return BigInt(value);
}
export function divFixed(numerator, denominator, places = 2) {
if (denominator <= 0n) throw new RangeError("denominator must be > 0");
const scale = 10n ** BigInt(places);
const scaled = (numerator * scale + denominator / 2n) / denominator;
const whole = scaled / scale;
const fraction = (scaled % scale).toString().padStart(places, "0");
return places === 0 ? String(whole) : `${whole}.${fraction}`;
}
export function formatBytes(bytes) {
if (typeof bytes !== "bigint" || bytes < 0n) {
throw new TypeError("bytes must be a non-negative BigInt");
}
// bytes serialized as a string so large values never pass through Number
return { bytes: bytes.toString(), GB: divFixed(bytes, GB), GiB: divFixed(bytes, GIB) };
}
export function weightPayloadBytes({ totalParams, bitsPerParam }) {
const params = asParams("totalParams", totalParams);
requirePositiveInt("bitsPerParam", bitsPerParam);
if (bitsPerParam > 32) throw new RangeError("bitsPerParam > 32 is not a weight format");
const totalBits = params * BigInt(bitsPerParam);
return (totalBits + 7n) / 8n; // ceiling: packed payloads round up to a byte
}
export function kvBytesPerToken({ layers, kvHeads, headDim, bytesPerElement }) {
requirePositiveInt("layers", layers);
requirePositiveInt("kvHeads", kvHeads);
requirePositiveInt("headDim", headDim);
requirePositiveInt("bytesPerElement", bytesPerElement);
return 2n * BigInt(layers) * BigInt(kvHeads) * BigInt(headDim) * BigInt(bytesPerElement);
}
export function reservedTokens({ requests, promptTokens, outputTokens }) {
requirePositiveInt("requests", requests);
if (!Number.isInteger(promptTokens) || promptTokens < 0) throw new RangeError("promptTokens must be >= 0");
if (!Number.isInteger(outputTokens) || outputTokens < 0) throw new RangeError("outputTokens must be >= 0");
if (promptTokens + outputTokens === 0) throw new RangeError("a zero-token request reserves nothing");
return BigInt(requests) * BigInt(promptTokens + outputTokens);
}
export function scenarioTotal({
weightsBytes, kvPerTokenBytes, retainedTokens,
activationsBytes, workspaceBytes, commBufferBytes, headroomPercent,
}) {
requirePositiveInt("headroomPercent", headroomPercent);
const parts = {
weights: asBig("weightsBytes", weightsBytes),
kvCache: asBig("kvPerTokenBytes", kvPerTokenBytes) * asBig("retainedTokens", retainedTokens),
activations: asBig("activationsBytes", activationsBytes),
workspace: asBig("workspaceBytes", workspaceBytes),
commBuffers: asBig("commBufferBytes", commBufferBytes),
};
const subtotal = Object.values(parts).reduce((a, b) => a + b, 0n);
const headroom = (subtotal * BigInt(headroomPercent)) / 100n;
return { ...parts, subtotal, headroom, total: subtotal + headroom };
}
BigInt, ceiling division, labeled units
Three decisions carry the weight here. Parameter counts and byte totals are BigInt throughout, so neither exceeds Number.MAX_SAFE_INTEGER nor accumulates floating-point error. Ceiling division is explicit: (bits + 7n) / 8n. And formatBytes labels both units rather than emitting an unlabeled number, because most capacity mistakes in this space are unit mistakes.
Separate functions keep uncertainty visible
weightPayloadBytes, kvBytesPerToken, reservedTokens, and scenarioTotal are four separate functions so a wrong assumption stays attached to the number it corrupted. If the architecture fields are unknown, kvBytesPerToken cannot be called at all. The failure is a thrown exception, not a plausible-looking answer.
Run the JavaScript sizing tool locally and compare output
// report.mjs
formatBytes, weightPayloadBytes, kvBytesPerToken,
reservedTokens, scenarioTotal,
} from "./sizing.mjs";
const GIB = 1_073_741_824n;
const gib = (n) => BigInt(n) * GIB;
const REPORTED = [
{ label: "GigaChat 4 (reported)", params: 708_000_000_000n },
{ label: "LingSante-3.1-flash (reported)", params: 560_000_000_000n },
];
console.log("== weight payload (arithmetic, not measured) ==");
for (const { label, params } of REPORTED) {
console.log(`${label} total=${params}`);
for (const bits of [16, 8, 4]) {
const f = formatBytes(weightPayloadBytes({ totalParams: params, bitsPerParam: bits }));
console.log(` ${String(bits).padStart(2)} bits: ${f.GB} GB | ${f.GiB} GiB | ${f.bytes} bytes`);
}
}
console.log("== synthetic KV cache: 80 layers, 8 KV heads, head dim 128, 2 bytes ==");
const SYNTH = { layers: 80, kvHeads: 8, headDim: 128, bytesPerElement: 2 };
const perToken = kvBytesPerToken(SYNTH);
console.log(`per token: ${perToken} bytes`);
for (const tokens of [32_768n, 131_072n, 1_000_000n]) {
const f = formatBytes(perToken * tokens);
console.log(` ${String(tokens).padStart(8)} tokens: ${f.GiB} GiB | ${f.bytes} bytes`);
}
console.log("== admission: 8192 prompt + 1024 reserved output per request ==");
for (const requests of [8, 32, 64]) {
const tokens = reservedTokens({ requests, promptTokens: 8192, outputTokens: 1024 });
console.log(` ${String(requests).padStart(2)} requests: ${tokens} retained tokens | ${formatBytes(perToken * tokens).GiB} GiB`);
}
console.log("== synthetic scenarios: 8 devices x 76 GiB usable = 608 GiB ==");
const usable = 8n * gib(76);
const base = {
kvPerTokenBytes: perToken, activationsBytes: gib(8), workspaceBytes: gib(4),
commBufferBytes: gib(2), headroomPercent: 10,
};
const SCENARIOS = [
{ name: "708B @4-bit, 1 x 1M", weights: weightPayloadBytes({ totalParams: 708_000_000_000n, bitsPerParam: 4 }), tokens: 1_000_000n },
{ name: "560B @4-bit, 1 x 1M", weights: weightPayloadBytes({ totalParams: 560_000_000_000n, bitsPerParam: 4 }), tokens: 1_000_000n },
{ name: "560B @4-bit, 8 x (8192+1024)", weights: weightPayloadBytes({ totalParams: 560_000_000_000n, bitsPerParam: 4 }), tokens: reservedTokens({ requests: 8, promptTokens: 8192, outputTokens: 1024 }) },
{ name: "708B @8-bit, 4 x (2048+512)", weights: weightPayloadBytes({ totalParams: 708_000_000_000n, bitsPerParam: 8 }), tokens: reservedTokens({ requests: 4, promptTokens: 2048, outputTokens: 512 }) },
];
for (const s of SCENARIOS) {
const total = scenarioTotal({ ...base, weightsBytes: s.weights, retainedTokens: s.tokens });
const verdict = total.total <= usable ? "capacity candidate" : "arithmetic rejection";
console.log(`${s.name}: ${formatBytes(total.total).GiB} GiB total -> ${verdict} (usable ${formatBytes(usable).GiB} GiB)`);
}
node report.mjs
== weight payload (arithmetic, not measured) ==
GigaChat 4 (reported) total=708000000000
16 bits: 1416.00 GB | 1318.75 GiB | 1416000000000 bytes
8 bits: 708.00 GB | 659.38 GiB | 708000000000 bytes
4 bits: 354.00 GB | 329.69 GiB | 354000000000 bytes
LingSante-3.1-flash (reported) total=560000000000
16 bits: 1120.00 GB | 1043.08 GiB | 1120000000000 bytes
8 bits: 560.00 GB | 521.54 GiB | 560000000000 bytes
4 bits: 280.00 GB | 260.77 GiB | 280000000000 bytes
== synthetic KV cache: 80 layers, 8 KV heads, head dim 128, 2 bytes ==
per token: 327680 bytes
32768 tokens: 10.00 GiB | 10737418240 bytes
131072 tokens: 40.00 GiB | 42949672960 bytes
1000000 tokens: 305.18 GiB | 327680000000 bytes
== admission: 8192 prompt + 1024 reserved output per request ==
8 requests: 73728 retained tokens | 22.50 GiB
32 requests: 294912 retained tokens | 90.00 GiB
64 requests: 589824 retained tokens | 180.00 GiB
== synthetic scenarios: 8 devices x 76 GiB usable = 608 GiB ==
708B @4-bit, 1 x 1M: 713.75 GiB total -> arithmetic rejection (usable 608.00 GiB)
560B @4-bit, 1 x 1M: 637.94 GiB total -> arithmetic rejection (usable 608.00 GiB)
560B @4-bit, 8 x (8192+1024): 327.00 GiB total -> capacity candidate (usable 608.00 GiB)
708B @8-bit, 4 x (2048+512): 744.15 GiB total -> arithmetic rejection (usable 608.00 GiB)
Every number in that output is an arithmetic fixture, produced by the formulas above from inputs I typed in. None of it is a measurement of either model. The last scenario deserves a stare: 708B at 8 bits needs 659.38 GiB of weights, which is 82.42 GiB per device across 8 devices, already past the 76 GiB usable per device before a single token is cached or any workspace is allocated. Short contexts do not rescue a configuration whose weights do not fit.
Add node:test assertions
// sizing.test.mjs
divFixed, formatBytes, weightPayloadBytes, kvBytesPerToken,
reservedTokens, scenarioTotal,
} from "./sizing.mjs";
const GIB = 1_073_741_824n;
test("weight payload matches the reported-parameter table", () => {
assert.equal(weightPayloadBytes({ totalParams: 708_000_000_000n, bitsPerParam: 16 }), 1_416_000_000_000n);
assert.equal(weightPayloadBytes({ totalParams: 708_000_000_000n, bitsPerParam: 8 }), 708_000_000_000n);
assert.equal(weightPayloadBytes({ totalParams: 708_000_000_000n, bitsPerParam: 4 }), 354_000_000_000n);
assert.equal(weightPayloadBytes({ totalParams: 560_000_000_000n, bitsPerParam: 16 }), 1_120_000_000_000n);
assert.equal(weightPayloadBytes({ totalParams: 560_000_000_000n, bitsPerParam: 8 }), 560_000_000_000n);
assert.equal(weightPayloadBytes({ totalParams: 560_000_000_000n, bitsPerParam: 4 }), 280_000_000_000n);
});
test("packed payloads round up to a whole byte", () => {
assert.equal(weightPayloadBytes({ totalParams: 2n, bitsPerParam: 4 }), 1n); // 8 bits
assert.equal(weightPayloadBytes({ totalParams: 3n, bitsPerParam: 4 }), 2n); // 12 bits
assert.equal(weightPayloadBytes({ totalParams: 1n, bitsPerParam: 3 }), 1n); // 3 bits
});
test("synthetic KV examples match the worked numbers", () => {
const perToken = kvBytesPerToken({ layers: 80, kvHeads: 8, headDim: 128, bytesPerElement: 2 });
assert.equal(perToken, 327_680n);
assert.equal(perToken * 32_768n, 10n * GIB);
assert.equal(perToken * 131_072n, 40n * GIB);
assert.equal(formatBytes(perToken * 1_000_000n).GiB, "305.18");
});
test("concurrency and output reservations scale linearly", () => {
const perToken = 327_680n;
const t8 = reservedTokens({ requests: 8, promptTokens: 8192, outputTokens: 1024 });
assert.equal(t8, 73_728n);
assert.equal(perToken * t8, 22n * GIB + GIB / 2n); // exactly 22.5 GiB
assert.equal(reservedTokens({ requests: 32, promptTokens: 8192, outputTokens: 1024 }), 4n * t8);
});
test("invalid inputs are rejected rather than guessed", () => {
assert.throws(() => weightPayloadBytes({ totalParams: 0n, bitsPerParam: 16 }), RangeError);
assert.throws(() => weightPayloadBytes({ totalParams: 1n, bitsPerParam: 0 }), RangeError);
assert.throws(() => weightPayloadBytes({ totalParams: 1n, bitsPerParam: 64 }), RangeError);
assert.throws(() => kvBytesPerToken({ layers: 0, kvHeads: 8, headDim: 128, bytesPerElement: 2 }), RangeError);
assert.throws(() => reservedTokens({ requests: 1, promptTokens: 0, outputTokens: 0 }), RangeError);
assert.throws(() => scenarioTotal({
weightsBytes: 1n, kvPerTokenBytes: 1n, retainedTokens: 1n,
activationsBytes: 0n, workspaceBytes: 0n, commBufferBytes: 0n, headroomPercent: 0,
}), RangeError);
});
test("GB and GiB formatting stays in BigInt", () => {
assert.equal(divFixed(1_416_000_000_000n, GIB), "1318.75");
assert.equal(formatBytes(1_416_000_000_000n).GB, "1416.00");
assert.equal(formatBytes(2n * GIB).GiB, "2.00");
assert.equal(formatBytes(999n).GiB, "0.00");
});
node --test
✔ weight payload matches the reported-parameter table (1.2ms)
✔ packed payloads round up to a whole byte (0.3ms)
✔ synthetic KV examples match the worked numbers (0.5ms)
✔ concurrency and output reservations scale linearly (0.4ms)
✔ invalid inputs are rejected rather than guessed (0.6ms)
✔ GB and GiB formatting stays in BigInt (0.3ms)
ℹ tests 6
ℹ pass 6
ℹ fail 0
These tests assert my formulas, not any model's behavior. They exist so that when you swap in real architecture fields, a unit or rounding regression fails loudly instead of quietly shifting a capacity plan by 7%.
Map the Estimate Onto Real Hardware Without Hiding Placement
Build the memory equation
Per deployment, the budget is:
required = resident_weights
+ kv_cache
+ activations
+ workspaces
+ communication_buffers
+ explicit_safety_headroom
scenarioTotal encodes exactly that, with headroom as an integer percentage so it stays in BigInt. Naming each term is the point: an unlabeled "plus 20% for stuff" hides which term is actually killing you.
Aggregate division is a lower bound
Dividing total bytes by aggregate accelerator memory gives a lower bound and nothing more. The real check is per-rank:
- Per-rank weight placement — with tensor parallelism, each rank holds a shard of most tensors but full copies of others.
- Replicated tensors — norms, some embeddings, and pipeline-stage boundaries are frequently replicated.
- Expert imbalance — if experts are distributed across ranks unevenly, the busiest rank sets the floor.
- Cache sharding — KV heads divide across ranks, but only if
kv_headsdivides cleanly by the parallel width. Eight KV heads across twelve ranks does not shard evenly.
The 708B/8-bit scenario above is the demonstration. Aggregate capacity says 744 GiB against 608 GiB usable, but the sharper statement is that weight shards alone exceed per-device capacity.
Compare parallelism strategies by placement cost
| Strategy | What is split | Placement consequence | Communication cost |
|---|---|---|---|
| Tensor parallel | Individual matrices within a layer | Every rank participates in every layer; per-rank weights roughly total/width plus replicas | All-reduce per layer, latency-sensitive |
| Pipeline parallel | Layers into stages | Fewer, larger transfers; stages must be balanced | Activation passing between stages, bubbles |
| Expert parallel | Routed experts across ranks | Enables residency when experts exceed one device | All-to-all per routed token, load-sensitive |
All three are conditioned on backend support. A quantization format that only has kernels for a particular layout, or a runtime that lacks expert parallelism, removes options from the table regardless of what the arithmetic prefers.
Evaluate offload honestly
Offloading weights to host memory or NVMe is a capacity trade, and the price is transfer volume. Compute it explicitly:
transfer_per_token ≈ active_expert_bytes not resident
transfer_bandwidth_needed ≈ transfer_per_token × tokens_per_second
At 25B active parameters with 4-bit weights, pulling the entire active set per token would be ~12.5 GB per token, which is not viable over PCIe. Real offload designs keep hot experts resident and stream cold ones at a much lower rate, which makes the achievable rate a routing-distribution question. Add NUMA placement and link topology to the model too; a host memory pool spread across sockets is not uniformly fast.
Present illustrative scenarios with explicit verdicts
The four scenarios in the report output classify as:
| Scenario | Verdict | Why |
|---|---|---|
| 708B @4-bit, 1 × 1M tokens | Arithmetic rejection | 713.75 GiB needed vs 608 GiB usable |
| 560B @4-bit, 1 × 1M tokens | Arithmetic rejection | 637.94 GiB needed vs 608 GiB usable |
| 560B @4-bit, 8 × (8192+1024) | Capacity candidate | 327.00 GiB of 608 GiB, ~41 GiB/rank |
| 708B @8-bit, 4 × (2048+512) | Arithmetic rejection | 82.42 GiB of weights per rank > 76 GiB usable |
"Capacity candidate" means the arithmetic does not rule it out. It does not mean the configuration runs. Note also how much the 1M-token context dominates: dropping from 708B to 560B cuts weights by 68.92 GiB, while the cache line stays at 305.18 GiB. At long context, the parameter count is no longer the deciding term.
Validate Precision, Runtime Behavior, and Performance
Verify kernel support before believing the 4-bit number
A 4-bit payload of 329.69 GiB is a storage fact. Whether 4-bit runs at acceptable quality and speed depends on whether the serving backend has tested quantization kernels for that architecture, on that accelerator generation, at that group size. A format without kernels either fails to load or falls back to dequantize-then-run, which changes both memory and latency. Check cache dtype separately: fp8 KV cache is a distinct capability from 4-bit weights, with its own quality tradeoff.
Define an authorized benchmark matrix
When you do test, fix every axis so the result means something:
| Axis | Record |
|---|---|
| Model revision | Commit hash or tag |
| Backend | Name and exact version |
| Hardware | Accelerator model, count, topology, host RAM |
| Quantization | Weight format and group size; KV dtype |
| Parallelism | TP/PP/EP degrees |
| Load | Prompt length, output length, concurrency, arrival pattern |
| Quality | Task-specific pass criteria |
Specify the measurements
- Load-time peak memory — catches conversion and sharding spikes.
- Steady-state memory — the number your capacity plan uses.
- Peak prefill memory — reported separately from steady state, because long prompts spike workspace.
- Time to first token — prefill cost, dominated by prompt length.
- Inter-token latency — decode cost, dominated by bandwidth.
- Throughput at a stated concurrency — never quote it without the concurrency.
- Out-of-memory events — count them. A run that survived by falling back to a smaller batch is a different configuration.
Require distributions, not point estimates
Report run counts and the latency distribution, not an average. A p99 inter-token latency three times the median means scheduling trouble or expert imbalance, and it changes the concurrency you can honestly promise. For both reported models, the status is unmeasured. No numbers in this post came from running them.
Match mitigations to failure modes
| Symptom | Likely budget | Mitigation |
|---|---|---|
| OOM grows with context or concurrency | KV cache | Reduce retained context, cap concurrency, enable prefix caching, consider fp8 cache |
| OOM at load, stable afterward | Weight residency | Use a validated lower-precision format; add devices; shard further |
| Fine at low concurrency, degrades at scale | Placement/communication | Rebalance parallelism, check expert skew, reduce cross-rank traffic |
| Good memory, bad latency | Bandwidth or batching | Check active-weight streaming rate and batch shape |
Verify License and Artifact Safety Before Deployment
Keep reported availability unendorsed
The headlines say "open-sourced" and "open-weight." Those are the reporters' characterizations, not license grants. "Open-weight" in particular has been used for artifacts that permit research use but prohibit commercial serving, and for artifacts with acceptable-use terms attached. No license terms are asserted for either release in this post, because none were available in the supplied material.
Check the exact revision's terms
For the specific revision you intend to deploy, verify:
- commercial use and serving-as-a-service
- redistribution of weights, and of derivatives
- whether modified weights must carry the same terms
- acceptable-use restrictions and termination clauses
- separate licenses for tokenizer files, tokenizer code, and any bundled inference code
Pin, verify, isolate
- Pin the artifact to an immutable revision.
- Verify any published checksums before loading.
- Avoid unreviewed remote-code execution. Model repositories can ship custom loading code, and
trust_remote_code-style flags execute it. - Do the first load in an isolated environment with no production credentials and no network egress.
Make the Deployment Decision From Verified Inputs
A practical checklist
| # | Check | Pass condition |
|---|---|---|
| 1 | Evidence quality | Every specification traced to a primary artifact, not a news article |
| 2 | Weight payload | Computed at the intended precision, with metadata overhead stated |
| 3 | Runtime overhead | Activations, workspace, comm buffers, headroom named explicitly |
| 4 | Active-parameter compute | Understood as a compute proxy only, not a throughput prediction |
| 5 | KV cache | Computed from the model's own layers/KV heads/head dim, not borrowed |
| 6 | Context and concurrency | Admission budget uses prompt + reserved output × requests |
| 7 | Per-rank placement | Weight shard, replicas, and cache shard fit each device individually |
| 8 | Measured performance | Load peak, steady state, TTFT, ITL, throughput, OOM count, distributions |
| 9 | License approval | Exact revision's terms reviewed and accepted |
| 10 | Artifact integrity | Revision pinned, checksums verified, first load isolated |
Restate the conclusion
Neither reported specification demonstrates affordability. A 25B active-parameter path lowers per-token compute and leaves residency essentially untouched, so the 560B payload still has to live somewhere. A 1M-token context claim is a memory claim of the same order as the weights themselves: 305.18 GiB for a single request under clearly synthetic attention assumptions, and multiples of that under concurrency.
The sizing exercise is incomplete for both models, and not because the arithmetic is hard. It is incomplete because the inputs that matter most — layer count, KV head count, head dimension, cache dtype support, quantization formats, license terms — are not in the public material available here. Until they arrive, the correct output of a sizing tool is an exception, not a number.
Sources and Verification Status
Supplied references (secondary reporting)
Both items below are news coverage, not primary release documentation. They are the origin of every specification claim in this post.
- MLQ.ai — "Sber open-sources GigaChat 4, a 708B model with a 1M-token context." Coverage timestamp
2026-11-28T22:43:45Z. Google News reference - MarkTechPost — "Ant Group Releases LingSante-3.1-flash: An Open-Weight MoE Model with 560B Total Parameters and 25B Activations per Token." Coverage timestamp
2026-11-28T09:45:33Z. Google News reference
Primary evidence still unavailable
The following were not available in the supplied material and would materially change the numbers:
- Official model cards for either release
config.json/ architecture configuration files (layers, KV heads, head dim, expert counts)- Checkpoint index files and published parameter/byte totals
- Serving documentation with supported backends and validated quantization formats
- License texts for weights, tokenizer, and any bundled code
- Official repository URLs and revision identifiers
Until those exist and are read, treat every figure in this post as arithmetic about reported specifications: reproducible, auditable, and explicitly not a measurement.
More posts

A JavaScript Cost Calculator for Choosing Between $0.10/M APIs and Self-Hosted Models
Build a JavaScript cost calculator that models per-token API pricing against self-hosted open-weight inference, including GPU, utilization, and ops overhead, to decide when $0.10/M APIs beat owning the stack.

Measuring Cost per Verified Change in JavaScript Coding Agents
This deep walkthrough builds a reproducible evaluation harness for JavaScript coding agents, measuring verified task completion, regressions, tool calls, latency, and cost per verified change beyond Hurdle benchmarks and VS Code's growing agent autonomy.

Gating a NixOS 26.11 Upgrade for Node.js Services in CI
A step-by-step CI gating strategy for adopting NixOS 26.11 (Linux 7.3) across Node.js services, covering flake pinning, native addon and ABI regression checks, service compatibility smoke tests, and rollback validation before rollout.
Loading comments…