FlexPosit: Tunable Fractional Precision for LLM Inference Accelerators (MICRO 2026)
FlexPosit received all three MICRO 2026 artifact badges. To reproduce the paper's results exactly, use FlexPosit_artifact.
FlexPosit is a Posit-based mixed-precision quantization framework for LLMs. It allocates higher precision to the channel windows whose quantization most affects perplexity. The paper tunes precision by combining Posit(4,1) and Posit(5,1) across channel windows; other Posit formats can be selected through the configuration. This repo contains:
flexposit, a Python package for quantizing HuggingFace models with FlexPosit.hardware/, the RTL of the FlexPosit datapath, part of the test-chip version of FlexPosit in an ongoing 12 nm tapeout shuttle.
Install
pip install flexposit # Python >= 3.10; includes WikiText-2 perplexity
pip install "flexposit[eval]" # optional: adds lm-evaluation-harness for downstream tasks (ARC, HellaSwag, ...)
For the command-line scripts and the hardware, clone the repo and install it in editable mode instead:
git clone https://github.com/hplp/FlexPosit && cd FlexPosit
pip install -e ".[dev]"
Quick start
Use the Python API to quantize a model from your own code: load it, quantize it to a target average bit width, then evaluate or save it. For example, Mistral-7B at 4.4 bits:
import flexposit
model, tok = flexposit.load_model("mistral-7b") # preset name, HF id or local path
# 4.4 bits on average, using the sensitivity ranking shipped for this model
# (uniform Posit(4,1) is bits=4.0 and needs no sensitivity)
state = flexposit.quantize(model, flexposit.FlexPositConfig(bits=4.4), sensitivity="mistral-7b")
print(flexposit.wikitext2_perplexity(model, tok)) # WikiText-2, seqlen 2048
flexposit.eval.lm_eval(model, tok, ["arc_easy"]) # any lm-eval task
flexposit.save(model, tok, state, "out/mistral-7b-flexposit-4.4")
quantize rounds each weight to its channel's Posit format in place, so the
model runs anywhere a HuggingFace model runs; state records each channel's
Posit size and scale. To sweep many bit widths, use the command line below.
Command line
The scripts run the paper's workflow from the shell: quantize every weight to
Posit(4,1), then sweep the average bit width from 4.0 to 5.0 and record
WikiText-2 perplexity at each step. Results go to out/.
bash scripts/01_quantize_base.sh phi-2 # quantize weights to Posit(4,1)
bash scripts/02_mpq_sweep.sh phi-2 # mixed-precision sweep over 4.0–5.0 bits
The shipped sensitivity CSVs hold the PPL-based sensitivity used in the paper. You can also profile your own, with a different configuration (e.g. the channel-window size, i.e. the granularity) or a different method (a Fisher-based one is provided). See docs/cli.md for these options and the tests.
Hardware
hardware/ holds the RTL of a bit-serial FlexPosit accelerator
whose Posit precision (4–8 bits) changes per channel window at runtime.
sudo apt install iverilog # or on macOS: brew install icarus-verilog
pip install numpy # used by the Python reference model
cd hardware && make test
make test (about a minute) simulates the RTL and checks it bit for bit against
a Python model: every FP8 × Posit product on a single PE, then random matrix
tiles through the whole array.
Supported models
Each has a pre-computed sensitivity CSV bundled with the package
(flexposit.shipped_sensitivity()); the CLIs and the Python API accept the
short names, both for the model and for sensitivity=.
| Short name | HuggingFace id |
|---|---|
gpt2-large |
gpt2-large |
gpt2-xl |
gpt2-xl |
phi-2 |
microsoft/phi-2 |
opt-2.7b |
facebook/opt-2.7b |
llama-2-7b |
meta-llama/Llama-2-7b-hf |
mistral-7b |
mistralai/Mistral-7B-v0.1 |
deepseek-llm-7b |
deepseek-ai/deepseek-llm-7b-base |
qwen2.5-7b |
Qwen/Qwen2.5-7B |
qwen2.5-14b |
Qwen/Qwen2.5-14B |
Layout
src/flexposit/ Python package (API, quantizers, mixed precision, sensitivity)
src/flexposit/data/ sensitivity CSVs for the supported models
scripts/ shell wrappers for the command-line workflow
hardware/ RTL, testbenches and bit-exact model
docs/cli.md command-line guide
tests/ test suite
Development
pip install -e ".[dev]"
ruff check src tests
pytest # CPU, a few seconds, no downloads
make -C hardware test # RTL regression, needs Icarus Verilog
Issues and pull requests are welcome.
Paper & citation
Preprint (arXiv): https://arxiv.org/abs/2609.04724
@misc{gao2026flexposit,
title = {FlexPosit: Tunable Fractional Precision for LLM Inference Accelerators},
author = {Gao, Yimin and Dai, Liangtao and Yin, Jun and Guo, Xinfei and Stan, Mircea},
year = {2026},
eprint = {2609.04724},
archivePrefix = {arXiv},
primaryClass = {cs.AR},
doi = {10.48550/arXiv.2609.04724}
}
License
MIT; see LICENSE.
Contact
Yimin Gao yg9bq@virginia.edu
Release files for flexposit 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| flexposit-0.2.0.tar.gz | 1.3 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flexposit-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 2.5 MB
Release files / flexposit-0.2.0.tar.gz
| Download URL | flexposit-0.2.0.tar.gz |
|---|---|
| Size | 1.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ed3f66084f31d7fae08082fa4302857bffbb595ab83502fbcb0be26f4e05bcda
|
|
BLAKE2b-256 checksum How to use checksums |
d2e6b2232e898e05cfd9c353dc03703f9f7f9621cddae5de1c8a636b7e6a9313
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / flexposit-0.2.0-py3-none-any.whl
| Download URL | flexposit-0.2.0-py3-none-any.whl |
|---|---|
| Size | 1.3 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
45edf0e693b70344e30c7e0a9f43e4b66e300bda3596acdaec0c4e70a5ef4002
|
|
BLAKE2b-256 checksum How to use checksums |
585a79ab572fdf1044b70da2f0630473939c0be952f324edd983cb3a88849922
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency log