SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2303.06865 · 2023

FlexGen: High-Throughput Generative Inference of Large Language Models with a Single GPU

arXiv · PDF · Open in the Atlas

Code that ran

10 of 12 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 9 have no contract verdict; 1 failure of our instrument; 2 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2303.06865.json · badge: /api/ran/2303.06865.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
fminference/flexgen canonical (classifier label)
classifier basis not recorded on the link
10 ran · 2 no recorded run
FunctionStatusWhere it lives
benchmark_func Ran
ran on a synthesized input
fminference/flexgen/flexllmgen/profile_bandwidth.py
code served (permissive licence) · get_code("1f5e7e1302edb8b7")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import time

torch.manual_seed(0)

# Define a simple callable function to benchmark
def simple_func():
    x = torch.randn(2, 4)
    y = torch.randn(2, 4)
    z = x + y
    return z

ARGS = {
    "func": simple_func,
    "number": 5,
    "repeat": 3,
    "warmup": 2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
best Ran
ran on a synthesized input
fminference/flexgen/experimental/cost_model.py
code served (permissive licence) · get_code("d456b3368cd9ef2c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Create simple policy objects - the function doesn't call methods on them,
# just passes them through, so simple objects suffice
class SimplePolicy:
    def __init__(self, name):
        self.name = name
    
    def __repr__(self):
        return f"Policy({self.name})"

policy1 = SimplePolicy("policy_1")
policy2 = SimplePolicy("policy_2")

# Throughput values - the function compares these numerically
throughput1 = 42.5
throughput2 = 55.3

ARGS = {
    "policy1": policy1,
    "throughput1": throughput1,
    "policy2": policy2,
    "throughput2": throughput2,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
compress Ran
ran; our contract draft was wrong, not the code
fminference/flexgen/flexllmgen/compression.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from Git-King-Zhan/LoReC, is pointer only (licence: NONE) · get_code("80dde39da1ba3708")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from Git-King-Zhan/LoReC, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

cut_indices Ran
ran on a synthesized input
fminference/flexgen/flexllmgen/pytorch_backend.py
code served (permissive licence) · get_code("58fb93e90d4ca515")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Construct indices tuple with slices
# indices is a tuple of slices, where SEG_DIM=1 points to the second element
# The function accesses indices[SEG_DIM] which should be a slice with start/stop attributes
# It also uses indices[:SEG_DIM] and indices[SEG_DIM + 1:] for tuple slicing

indices = (
    slice(0, 10),           # indices[0]
    slice(5, 15),           # indices[1] - this is SEG_DIM
    slice(0, 20),           # indices[2]
)

start = 3
stop = 12
base = 1

ARGS = {
    "indices": indices,
    "start": start,
    "stop": stop,
    "base": base,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_choice Ran
ran on a synthesized input
fminference/flexgen/flexllmgen/flex_opt.py
code served (permissive licence) · get_code("66b0a9c4c8b9fac3")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Construct arguments for get_choice function
cur_percent = 25.5
percents = [30.0, 40.0, 30.0]  # These will sum to 100 after cumsum operations
choices = ['option_a', 'option_b', 'option_c']

ARGS = {
    'cur_percent': cur_percent,
    'percents': percents,
    'choices': choices
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_compressed_indices Ran
ran on a synthesized input
fminference/flexgen/flexllmgen/compression.py
code served (permissive licence) · get_code("9c97f67de32d17d9")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Create a small stand-in class for the compression config
class CompressionConfig:
    def __init__(self, group_size, group_dim, num_bits):
        self.group_size = group_size
        self.group_dim = group_dim
        self.num_bits = num_bits

# Create a simple container to hold the config
class TensorContainer:
    def __init__(self, config):
        self.data = [None, None, config]

# Set up the compression config
comp_config = CompressionConfig(group_size=4, group_dim=1, num_bits=4)

# Create a tensor-like object with the config stored in .data[2]
tensor_obj = TensorContainer(comp_config)

# Define shape that aligns with group_dim and allows proper slicing
# shape[0] = 2, shape[1] = 8 (divisible by group_size=4), shape[2] = 3
shape = (2, 8, 3)

# indices can be None or a list of slices
indices = None

ARGS = {
    "tensor": tensor_obj,
    "indices": indices,
    "shape": shape
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_filename Ran
ran on a synthesized input
fminference/flexgen/flexllmgen/flex_opt.py
code served (permissive licence) · get_code("aa4fd60bcb4735f7")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

class Args:
    def __init__(self):
        self.model = "llama-7b"
        self.gpu_batch_size = 32
        self.num_gpu_batches = 4
        self.prompt_len = 512
        self.gen_len = 128
        self.percent = [0.5, 0.3, 0.2]
        self.cpu_cache_compute = False
        self.compress_weight = False
        self.compress_cache = False

ARGS = {
    'args': Args()
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
piecewise_linear_func Ran
ran on a synthesized input
fminference/flexgen/flexllmgen/utils.py
code served (permissive licence) · get_code("96b89b9b7d6de29e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned partial. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import functools
import numpy as np

# Construct arguments for piecewise_linear_func
# The function takes xs (x-coordinates) and ys (y-coordinates) for interpolation

xs = [1.0, 2.0, 3.0, 4.0, 5.0]
ys = [2.0, 4.0, 5.0, 4.5, 3.0]

ARGS = {
    "xs": xs,
    "ys": ys,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type partial — a partial output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a partial output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
piecewise_linear_func_ret_func Ran
ran on a synthesized input
fminference/flexgen/flexllmgen/utils.py
code served (permissive licence) · get_code("5bd88c5dd640a26b")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned float64, ndim 0, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Construct arguments for piecewise_linear_func_ret_func
# The function performs linear interpolation using np.interp
# It requires:
# - xs: array of x coordinates (must be sorted)
# - ys: array of corresponding y values
# - x: a single point to interpolate at (must be within [xs[0], xs[-1]])

xs = np.array([0.0, 1.0, 2.0, 3.0, 4.0])
ys = np.array([0.0, 2.0, 1.5, 3.5, 4.0])
x = 2.5

ARGS = {
    "xs": xs,
    "ys": ys,
    "x": x
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
sample_from_range Ran
ran on a synthesized input
fminference/flexgen/flexllmgen/utils.py
code served (permissive licence) · get_code("41f5cd8d4fcde903")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# Analyze the function:
# - n: an integer >= 1, used in comparisons and range operations
# - k: an integer, used in conditionals (-1 check, 1 check, and arithmetic)
# The function samples indices from 1 to n, either exponentially (k=-1) or linearly (k>1)

# Test case 1: k == -1 (exponential sampling)
ARGS = {
    "n": 16,
    "k": -1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family int — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
decompress Not yet run
unverified (harvested, no recorded run)
fminference/flexgen/flexllmgen/compression.py
code served (permissive licence) · get_code("a2b79de775636d17")
How it ran

no invocation recorded.

get_opt_config Not yet run
unverified (harvested, no recorded run)
fminference/flexgen/flexllmgen/opt_config.py
code served (permissive licence) · get_code("3ade24c053a86925")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 5 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 5 later) and 7 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
compress 17 other papers
1 dated earlier, 16 later
2112.05682 (2021-12)
Self-attention Does Not Need $O(n^2)$ Memory
2304.10453 (2023-04)
Phoenix: Democratizing ChatGPT across Languages
2307.12981 (2023-07)
3D-LLM: Injecting the 3D World into Large Language Models
and 14 more not named here
decompress 3 other papers
3 later
2304.10453 (2023-04)
Phoenix: Democratizing ChatGPT across Languages
2307.12981 (2023-07)
3D-LLM: Injecting the 3D World into Large Language Models
2310.19740 (2023-10)
Exploring the Reliability of Large Language Models as Customized Evaluators for Diverse NLP Tasks
cut_indices 1 other paper
1 later
2406.19707 (2024-06)
InfiniGen: Efficient Generative Inference of Large Language Models with Dynamic KV Cache Management
get_choice 1 other paper
1 later
2406.19707 (2024-06)
InfiniGen: Efficient Generative Inference of Large Language Models with Dynamic KV Cache Management
get_filename 1 other paper
1 later
2406.19707 (2024-06)
InfiniGen: Efficient Generative Inference of Large Language Models with Dynamic KV Cache Management

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

The high computational and memory requirements of large language model (LLM) inference make it feasible only with multiple high-end accelerators. Motivated by the emerging demand for latency-insensitive tasks with batched processing, this paper initiates the study of high-throughput LLM inference using limited resources, such as a single commodity GPU. We present FlexGen, a high-throughput generation engine for running LLMs with limited GPU memory. FlexGen can be flexibly configured under various hardware resource constraints by aggregating memory and computation from the GPU, CPU, and disk. By solving a linear programming problem, it searches for efficient patterns to store and access tensors. FlexGen further compresses the weights and the attention cache to 4 bits with negligible accuracy loss. These techniques enable FlexGen to have a larger space of batch size choices and thus significantly increase maximum throughput. As a result, when running OPT-175B on a single 16GB GPU, FlexGen achieves significantly higher throughput compared to state-of-the-art offloading systems, reaching a generation throughput of 1 token/s for the first time with an effective batch size of 144. On the HELM benchmark, FlexGen can benchmark a 30B model with a 16GB GPU on 7 representative sub-scenarios in 21 hours. The code is available at https://github.com/FMInference/FlexGen

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2303.06865")
get_code_for_paper("2303.06865")
have("2303.06865")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2303.06865.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2303.06865.svg)](https://syntology.ai/paper/2303.06865)

Connect an agent — have() is free.