DEV Community

Cover image for FLUNG 8B: a text flow model with 9.03B stored parameters, 4.8 tokens per forward pass, and a 476 KiB-per-token cache: what it takes to self-host
ai maya
ai maya

Posted on

FLUNG 8B: a text flow model with 9.03B stored parameters, 4.8 tokens per forward pass, and a 476 KiB-per-token cache: what it takes to self-host

TL;DR

  • black-forest-labs/flung-8b is a language model that does not write one token at a time. It drafts a 128-token block as noise and refines all 128 positions in parallel, then moves to the next block. The Hub entry was created on December 4, 2026, with the paper "Towards Training Your Language Flow Model from Scratch" (arXiv 2612.06003) and a CC BY-NC 4.0 license.
  • I rebuilt the count from the safetensors header. The file stores 9,032,087,168 BF16 values (18.06 GB, 16.8 GiB). The card's "7.9B parameters, 9.0B including embeddings" is exact: 7,943,009,920 outside the two untied 0.545B tables. About 2.62B (29%) sit in adaLN modulation layers that read a conditioning vector, not the token stream.
  • The card's headline speed number is 4.8 tokens per forward pass at the default sampler (64 steps with early stop) and 6.5 at 32 steps with early stop. Because each pass runs over a full 128-token block, the compute per generated token is roughly 27 times that of a comparable autoregressive model, while the weight traffic per token falls by about 4.8 times.
  • The surprise for anyone sizing hardware: attention is plain multi-head, 56 KV heads of dimension 64 in 34 layers. That is 476 KiB of cache per token, about 17 times the 28 KiB per token of a recent small MoE I audited last week. A 32K context costs 14.9 GiB per sequence.
  • It is a research artifact. The license is non-commercial and the card says not to deploy it in production.

What is a language flow model, and how does FLUNG 8B decode?

The card describes it in one sentence: FLUNG "brings the flow models behind FLUX to text." Instead of the usual loop, where each forward pass produces the next token and appends it to a cache, FLUNG starts a block of 128 positions from noise in embedding space and denoises the whole block over a number of steps. When the block is done, the model moves on to the following block and keeps the finished one as context.

Three details from the config and the code shape everything that follows:

  • sampler_fixed.block_size is 128. generation_defaults set steps to 64, stable_stop to 4, temperature 0.3, top-p 0.9 and max_new_tokens 2048.
  • With 64 steps per block, a block of 128 tokens needs 64 passes, which is 2.0 tokens per pass. With 32 steps it is 4.0. The card's early stop ends a block once the argmax readout has not changed for 4 consecutive steps. That brings the average to 4.8 tokens per pass at 64 steps, and 6.5 at 32 steps. Those figures translate to roughly 26.7 and 19.7 passes per block.
  • The modeling file contains a semi-autoregressive path: past_kv, return_kv and decode_caches. Finished blocks are cached as keys and values, so the model is autoregressive across blocks and parallel inside a block.

The training recipe on the card is public in outline: about 1T tokens of open-source data, in five stages (pre-training, mid-training, SFT, distillation, preference tuning). Pre-training is 0.82T tokens, mid-training 200B and SFT 4.7B. The distillation step is guidance distillation followed by flow-map step distillation, which is what makes 32 to 64 steps per block possible at all. The preference stage is offline DPO followed by online GRPO.

How many parameters does FLUNG 8B actually store, and where?

I read the first 8 bytes of model.safetensors for the header length, then the JSON header itself with an HTTP range request. No weights were downloaded.

import json, struct, urllib.request, collections, math, re

URL = "https://huggingface.co/black-forest-labs/flung-8b/resolve/main/model.safetensors"

def rng(a, b):
    req = urllib.request.Request(URL, headers={"Range": f"bytes={a}-{b}"})
    return urllib.request.urlopen(req).read()

n = struct.unpack("<Q", rng(0, 7))[0]
hdr = json.loads(rng(8, 8 + n - 1))
hdr.pop("__metadata__", None)

groups = collections.Counter()
for name, meta in hdr.items():
    groups[re.sub(r"\.\d+\.", ".N.", name)] += math.prod(meta["shape"])

print(sum(groups.values()))            # 9032087168
for k, v in groups.most_common(8):
    print(f"{k:34s} {v/1e9:6.3f} B")
Enter fullscreen mode Exit fullscreen mode

The totals match the Hub's own safetensors summary of 9,032,087,168 BF16 parameters. The breakdown:

Bar chart of parameter groups: MLP 3.51B, attention qkv 1.31B, two modulation groups 1.31B each, embedding and output head 0.545B each, attention output 0.437B

Group Parameters Share
MLP, SwiGLU, hidden 9,600 (34 layers) 3.509B 38.9%
Attention qkv (fused, no GQA) 1.310B 14.5%
Attention output projection 0.437B 4.8%
Modulation mod1 + mod2 (adaLN) 2.620B 29.0%
Embedding table + output head (untied) 1.089B 12.1%
Time embeddings, self-conditioning, flow head 0.066B 0.7%

Two things stand out. First, the "7.9B" on the card is the non-embedding count, and it is correct: 9,032,087,168 minus 1,089,077,248 is 7,943,009,920. Second, almost a third of the model is modulation. Each of the 34 blocks has two layers that map the conditioning vector c (a time embedding) to a shift, scale and gate. Each of those layers is 3,584 by 10,752, which is 38.5M parameters, and 68 of them make up 2.62B. In the block code c goes into self.mod1(c) and self.mod2(c), and the result modulates the normalized hidden states. I read this as a per-sequence vector rather than a per-position one, which means these weights are read from memory on every pass but cost little arithmetic. That is my reading of the code and it is worth confirming with a profiler before you build a capacity plan around it.

The path that does arithmetic for every one of the 128 positions is attention (1.747B), MLP (3.509B) and the output head (0.545B), plus the 0.026B self-conditioning projection and the 0.013B flow-velocity head. That is 5.84B parameters on the per-position path, against 9.03B stored.

How much memory does FLUNG 8B need on one GPU?

Weights are straightforward. 9.03B values at 2 bytes is 18.06 GB, or 16.8 GiB. That fits an 80 GB card with a lot of room, a 24 GB card with about 7 GiB left over, and not a 16 GB card without quantization. The card says "runs on a single GPU" and that holds.

The cache is where this model differs from recent releases. The attention block fuses q, k and v into one Linear(3584, 10752). Hidden size 3,584 divided by 56 heads gives a head dimension of 64, and there is one KV head per query head. Per token, the cache is:

2 (K and V) x 34 layers x 56 heads x 64 dim x 2 bytes = 487,424 bytes = 476 KiB
Enter fullscreen mode Exit fullscreen mode

For one 128-token block that is 59.5 MiB. Scaled to common context lengths:

Bar chart of BF16 KV cache per sequence: 0.93 GiB at 2K, 3.72 GiB at 8K, 14.88 GiB at 32K, 59.5 GiB at 128K

Context KV cache, BF16, one sequence
2,048 (the default max_new_tokens) 0.93 GiB
8,192 3.72 GiB
32,768 14.88 GiB
131,072 59.5 GiB

The card does not advertise a long context and the default generation length is 2,048 tokens, so these larger rows are a formula, not a tested configuration. The point is the slope. On an 80 GB card with 16.8 GiB of weights, there is room for roughly 60 concurrent 2K sequences before activations (74.5 GiB total minus weights leaves about 57 GiB), and about 3 sequences at 32K. A model with grouped-query attention at the same depth would need a fraction of this. If you plan to serve many users at moderate length, the cache and not the weights sets your batch size.

Is FLUNG 8B faster than an autoregressive 8B model?

Per token, it moves less data and does more arithmetic. Here is the arithmetic, with the caveat that it is a roofline estimate and not a measurement.

A normal autoregressive decode step at batch size 1 reads every weight once to produce one token. That is memory bound, and the ceiling is bandwidth divided by weight bytes. FLUNG reads the same 18.06 GB on each pass, but a pass yields 2.0, 4.0, 4.8 or 6.5 tokens depending on the sampler. At the 3.35 TB/s bandwidth on NVIDIA's spec sheet for the H100 SXM, one pass takes at best 5.39 ms:

Bar chart of illustrative batch-1 decode ceilings: 370, 741, 890 and 1,206 tokens per second for the four sampler settings

That is 185 tokens per second for a hypothetical dense autoregressive model with the same 18 GB of weights, against about 890 for FLUNG at 4.8 tokens per pass and about 1,206 at 6.5. These are ceilings. They ignore the KV cache reads, attention, kernel launch overhead and the sampler's own cost, and I have not run them.

The compute side is less friendly. One pass over 128 positions on the 5.84B per-position path is about 2 x 5.84e9 x 128 = 1.50 TFLOP. At the spec-sheet 989 TFLOPS of dense BF16, that is 1.5 ms, still below the 5.39 ms weight read, so batch 1 stays memory bound. The two curves cross at around 3.6 concurrent sequences at peak throughput and sooner at realistic utilization. Beyond that, the extra arithmetic per token (about 312 GFLOP per accepted token at 4.8 tokens per pass, against roughly 11.6 GFLOP for an autoregressive model with the same per-token path) becomes the bottleneck. Parallel decoding trades compute for latency, which is a good deal for a single user on one GPU and a worse one for a busy batch server.

How does FLUNG 8B score, and what do the step settings cost?

The card reports zero-shot generative results, a mean of 3 seeds, with MT-Bench judged by GPT-4.1:

Sampler tok/fwd GSM8K MATH HumanEval HE+ MBPP MBPP+ IFEval MT-Bench
64 steps + early stop (default) 4.8 87.9 50.5 70.7 65.7 56.5 60.8 76.0 5.68
64 steps 2.0 88.9 51.0 71.7 67.1 57.7 62.7 76.3 5.78
32 steps + early stop 6.5 88.5 49.7 70.3 65.7 56.1 61.9 75.6 5.71
32 steps 4.0 89.1 50.3 70.5 65.9 56.8 62.5 76.1 5.64

The practical reading is that step count barely moves quality. Going from 64 steps to 32 steps with early stop raises throughput from 2.0 to 6.5 tokens per pass, a 3.25 times gain, and the largest drop in any column is 1.6 points (MBPP, 57.7 to 56.1), with GSM8K within half a point (88.5 versus 88.9). The card states that the 6.5 setting is within 2 points of full 64-step denoising on every benchmark, and the table agrees. The card says the model is competitive with open-source discrete diffusion models on math, code and instruction following. The paper has the baselines, and I did not re-run any of them, so I make no claim about where it ranks against autoregressive models of similar size.

How do I run FLUNG 8B locally?

The model uses custom code, so trust_remote_code=True is required, and the card lists transformers 4.57.6 as the tested version. Read the three Python files before you run them, since remote code executes on your machine.

import torch
from transformers import AutoModel, AutoTokenizer

repo = "black-forest-labs/flung-8b"
tok = AutoTokenizer.from_pretrained(repo, trust_remote_code=True)
model = AutoModel.from_pretrained(repo, trust_remote_code=True,
                                  dtype=torch.bfloat16).to("cuda").eval()

msgs = [{"role": "user",
         "content": "A train leaves at 9:40 and arrives at 13:15. How long is the trip in minutes?"}]

out = model.generate_chat(msgs, tok)   # 64 steps per block, early stop n=4
print(out["text"])

fast = model.generate_chat(msgs, tok, steps=32, stable_stop=0,
                           max_new_tokens=512, seed=1973)
Enter fullscreen mode Exit fullscreen mode

Note the stable_stop argument: setting it to 0 disables early stopping, so the second call runs a plain 32 steps per block. The tokenizer is the Qwen3 tokenizer under Apache 2.0, with a vocabulary of 151,936 entries.

What are the limits of FLUNG 8B for production use?

  • License. CC BY-NC 4.0 for weights and code. The card names commercial use and production deployment as out of scope.
  • Language. Trained mostly on English text and code, and other languages are not evaluated.
  • Context. No long-context claim. The 128-token block structure and a 2,048-token default output suggest short to medium answers.
  • Serving stack. The model ships as a custom transformers implementation with SDPA attention. Mainstream inference servers have no flow-decoding loop, so a serving setup means writing that loop yourself.
  • Cache cost. 476 KiB per token with no GQA, as computed above.

FAQ

Is FLUNG 8B an 8B or a 9B model? Both numbers are right. The transformer body has 7.94B parameters. With the untied input embedding table and output head (0.545B each), the file stores 9.03B.

How many tokens per second does FLUNG 8B generate? I do not have a measured figure and the card does not publish one. The card gives 4.8 tokens per forward pass by default and 6.5 with 32 steps and early stop. A bandwidth roofline on an H100 puts the batch-1 ceiling near 890 and 1,206 tokens per second respectively, before cache and overhead costs.

How much VRAM does FLUNG 8B need? 16.8 GiB for BF16 weights, plus 0.93 GiB of cache for a full 2,048-token generation and working memory for the 128-token block. A 24 GB GPU is enough for a single sequence.

Can I use FLUNG 8B commercially? No. The license is CC BY-NC 4.0 and the card lists commercial use as out of scope.

Why does FLUNG need so much KV cache? The config has 56 heads, a hidden size of 3,584 and a fused qkv projection of 10,752 outputs, so keys and values are stored for all 56 heads in every one of the 34 layers. That is 476 KiB per token in BF16.

Further reading

Sources

Top comments (0)