{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/framequant-flexible-low-bit-quantization-for","title":"FrameQuant: Flexible Low-Bit Quantization for Transformers","arxiv_id":"2403.06082","date":"2024-03-10","proceeding":null,"authors":["Harshavardhan Adepu","Zhanpeng Zeng","Li Zhang","Vikas Singh"],"abstract":"Transformers are the backbone of powerful foundation models for many Vision and Natural Language Processing tasks. But their compute and memory/storage footprint is large, and so, serving such models is expensive often requiring high-end hardware. To mitigate this difficulty, Post-Training Quantization seeks to modify a pre-trained model and quantize it to eight bits or lower, significantly boosting compute/memory/latency efficiency. Such models have been successfully quantized to four bits with some performance loss. In this work, we outline a simple scheme to quantize Transformer-based models to just two bits (plus some overhead) with only a small drop in accuracy. Key to our formulation is a concept borrowed from Harmonic analysis called Fusion Frames. Our main finding is that the quantization must take place not in the original weight space, but instead in the Fusion Frame representations. If quantization is interpreted as the addition of noise, our casting of the problem allows invoking an extensive body of known consistent recovery and noise robustness guarantees. Further, if desired, de-noising filters are known in closed form. We show empirically, via a variety of experiments, that (almost) two-bit quantization for Transformer models promises sizable efficiency gains. The code is available at https://github.com/vsingh-group/FrameQuant","url_abs":"https://arxiv.org/abs/2403.06082v2","url_pdf":"https://arxiv.org/pdf/2403.06082v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"framequant-flexible-low-bit-quantization-for","repo_url":"https://github.com/vsingh-group/framequant","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"quantization","task_name":"Quantization"}],"methods":[{"method_slug":"absolute-position-encodings","method_name":"Absolute Position Encodings"},{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"label-smoothing","method_name":"Label Smoothing"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"position-wise-feed-forward-layer","method_name":"Position-Wise Feed-Forward Layer"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"transformer","method_name":"Transformer"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2403.06082","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2403.06082"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/vsingh-group/framequant","reach":{"status":"ok"}}],"summary":{"ran":11,"ran_draft_wrong":1,"unverified":6},"by_repo_kind":{"official":{"samples":18,"ran":12,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":18,"samples":[{"code_sha256_prefix":"5e48070287726d38","entry":"array_code_gen","repo":"vsingh-group/framequant","repo_kind":"official","path":"fast-hadamard-transform/csrc/code_gen.py","file_url":"https://github.com/vsingh-group/framequant/blob/HEAD/fast-hadamard-transform/csrc/code_gen.py","link_basis":"plan_row","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"5e48070287726d38"}},{"code_sha256_prefix":"04cf3834e0e305e6","entry":"construct_real_tff","repo":"vsingh-group/framequant","repo_kind":"official","path":"utils/construct_tff.py","file_url":"https://github.com/vsingh-group/framequant/blob/HEAD/utils/construct_tff.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"04cf3834e0e305e6"}},{"code_sha256_prefix":"decbe159fea96172","entry":"construct_tight_frames","repo":"vsingh-group/framequant","repo_kind":"official","path":"utils/construct_tff.py","file_url":"https://github.com/vsingh-group/framequant/blob/HEAD/utils/construct_tff.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"decbe159fea96172"}},{"code_sha256_prefix":"a9e7f2cdf016b88b","entry":"find_layers","repo":"vsingh-group/framequant","repo_kind":"official","path":"modelutils.py","file_url":"https://github.com/vsingh-group/framequant/blob/HEAD/modelutils.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"a9e7f2cdf016b88b"}},{"code_sha256_prefix":"0f5810ef333bc3dc","entry":"llama_eval","repo":"vsingh-group/framequant","repo_kind":"official","path":"utils/eval_utils.py","file_url":"https://github.com/vsingh-group/framequant/blob/HEAD/utils/eval_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"0f5810ef333bc3dc"}},{"code_sha256_prefix":"9f18bcbf55043e12","entry":"load_llama_from_config","repo":"vsingh-group/framequant","repo_kind":"official","path":"inference.py","file_url":"https://github.com/vsingh-group/framequant/blob/HEAD/inference.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"9f18bcbf55043e12"}},{"code_sha256_prefix":"7e27a0f1e3ced11b","entry":"profile","repo":"vsingh-group/framequant","repo_kind":"official","path":"packbit/kernel.py","file_url":"https://github.com/vsingh-group/framequant/blob/HEAD/packbit/kernel.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"7e27a0f1e3ced11b"}},{"code_sha256_prefix":"ff8ffe5499b035fb","entry":"quantize","repo":"vsingh-group/framequant","repo_kind":"official","path":"quant.py","file_url":"https://github.com/vsingh-group/framequant/blob/HEAD/quant.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"ff8ffe5499b035fb"}},{"code_sha256_prefix":"80cef67ba93a9352","entry":"quantize_float_bias","repo":"vsingh-group/framequant","repo_kind":"official","path":"quant.py","file_url":"https://github.com/vsingh-group/framequant/blob/HEAD/quant.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"80cef67ba93a9352"}},{"code_sha256_prefix":"c36798d3ae59a462","entry":"quantize_int_bias","repo":"vsingh-group/framequant","repo_kind":"official","path":"quant.py","file_url":"https://github.com/vsingh-group/framequant/blob/HEAD/quant.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"c36798d3ae59a462"}},{"code_sha256_prefix":"d4a256fbc9029891","entry":"string_to_array","repo":"vsingh-group/framequant","repo_kind":"official","path":"fast-hadamard-transform/csrc/code_gen.py","file_url":"https://github.com/vsingh-group/framequant/blob/HEAD/fast-hadamard-transform/csrc/code_gen.py","link_basis":"plan_row","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"d4a256fbc9029891"}},{"code_sha256_prefix":"4c72411332a6c17d","entry":"tffet","repo":"vsingh-group/framequant","repo_kind":"official","path":"utils/construct_tff.py","file_url":"https://github.com/vsingh-group/framequant/blob/HEAD/utils/construct_tff.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"4c72411332a6c17d"}},{"code_sha256_prefix":"4d29e98e5f0e4149","entry":"get_c4","repo":"vsingh-group/framequant","repo_kind":"official","path":"datautils.py","file_url":"https://github.com/vsingh-group/framequant/blob/HEAD/datautils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"4d29e98e5f0e4149"}},{"code_sha256_prefix":"7ca52cb5d1719b2f","entry":"get_llama","repo":"vsingh-group/framequant","repo_kind":"official","path":"llama.py","file_url":"https://github.com/vsingh-group/framequant/blob/HEAD/llama.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"7ca52cb5d1719b2f"}},{"code_sha256_prefix":"3265f727a396f15d","entry":"get_ptb","repo":"vsingh-group/framequant","repo_kind":"official","path":"datautils.py","file_url":"https://github.com/vsingh-group/framequant/blob/HEAD/datautils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"3265f727a396f15d"}},{"code_sha256_prefix":"ab19b8a72ceae217","entry":"get_wikitext2","repo":"vsingh-group/framequant","repo_kind":"official","path":"datautils.py","file_url":"https://github.com/vsingh-group/framequant/blob/HEAD/datautils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"ab19b8a72ceae217"}},{"code_sha256_prefix":"effa493c10026adc","entry":"llama_pack3","repo":"vsingh-group/framequant","repo_kind":"official","path":"llama.py","file_url":"https://github.com/vsingh-group/framequant/blob/HEAD/llama.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"effa493c10026adc"}},{"code_sha256_prefix":"e6ca4726f327dc2c","entry":"load_quant","repo":"vsingh-group/framequant","repo_kind":"official","path":"inference.py","file_url":"https://github.com/vsingh-group/framequant/blob/HEAD/inference.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"e6ca4726f327dc2c"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}