{"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/few-bit-backward-quantized-gradients-of","title":"Few-Bit Backward: Quantized Gradients of Activation Functions for Memory Footprint Reduction","arxiv_id":"2202.00441","date":"2022-02-01","proceeding":null,"authors":["Georgii Novikov","Daniel Bershatsky","Julia Gusak","Alex Shonenkov","Denis Dimitrov","Ivan Oseledets"],"abstract":"Memory footprint is one of the main limiting factors for large neural network training. In backpropagation, one needs to store the input to each operation in the computational graph. Every modern neural network model has quite a few pointwise nonlinearities in its architecture, and such operation induces additional memory costs which -- as we show -- can be significantly reduced by quantization of the gradients. We propose a systematic approach to compute optimal quantization of the retained gradients of the pointwise nonlinear functions with only a few bits per each element. We show that such approximation can be achieved by computing optimal piecewise-constant approximation of the derivative of the activation function, which can be done by dynamic programming. The drop-in replacements are implemented for all popular nonlinearities and can be used in any existing pipeline. We confirm the memory reduction and the same convergence on several open benchmarks.","url_abs":"https://arxiv.org/abs/2202.00441v2","url_pdf":"https://arxiv.org/pdf/2202.00441v2.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":"few-bit-backward-quantized-gradients-of","repo_url":"https://github.com/SkoltechAI/fewbit","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"BSD-3-Clause"}},{"paper_slug":"few-bit-backward-quantized-gradients-of","repo_url":"https://github.com/daskol/fewbit","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"BSD-3-Clause"}}],"tasks":[{"task_slug":"neural-network-compression","task_name":"Neural Network Compression"},{"task_slug":"quantization","task_name":"Quantization"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2202.00441","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2202.00441"}},"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/SkoltechAI/fewbit","reach":{"status":"ok","spdx":"BSD-3-Clause"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/daskol/fewbit","reach":{"status":"ok","spdx":"BSD-3-Clause"}}],"summary":{"unverified":17},"by_repo_kind":{"official":{"samples":17,"ran":0,"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":0,"samples":[{"code_sha256_prefix":"ffdba334e16081d0","entry":"append_reference","repo":"SkoltechAI/fewbit","repo_kind":"official","path":"fewbit/modules/activations.py","file_url":"https://github.com/SkoltechAI/fewbit/blob/HEAD/fewbit/modules/activations.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"ffdba334e16081d0"}},{"code_sha256_prefix":"1f6d08cef9a84d45","entry":"approximate","repo":"SkoltechAI/fewbit","repo_kind":"official","path":"fewbit/approx.py","file_url":"https://github.com/SkoltechAI/fewbit/blob/HEAD/fewbit/approx.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"1f6d08cef9a84d45"}},{"code_sha256_prefix":"c8f42186142a2a86","entry":"clamp","repo":"SkoltechAI/fewbit","repo_kind":"official","path":"fewbit/functional/linear.py","file_url":"https://github.com/SkoltechAI/fewbit/blob/HEAD/fewbit/functional/linear.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"c8f42186142a2a86"}},{"code_sha256_prefix":"0984394a69efa89b","entry":"dct","repo":"SkoltechAI/fewbit","repo_kind":"official","path":"fewbit/fft.py","file_url":"https://github.com/SkoltechAI/fewbit/blob/HEAD/fewbit/fft.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"0984394a69efa89b"}},{"code_sha256_prefix":"0490b30beebe8a38","entry":"dispatch","repo":"SkoltechAI/fewbit","repo_kind":"official","path":"fewbit/functional/activations.py","file_url":"https://github.com/SkoltechAI/fewbit/blob/HEAD/fewbit/functional/activations.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"0490b30beebe8a38"}},{"code_sha256_prefix":"3ae5fdf58952210a","entry":"estimate_correlation","repo":"SkoltechAI/fewbit","repo_kind":"official","path":"fewbit/modules/variance.py","file_url":"https://github.com/SkoltechAI/fewbit/blob/HEAD/fewbit/modules/variance.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"3ae5fdf58952210a"}},{"code_sha256_prefix":"a5c843a81567e736","entry":"estimate_error","repo":"SkoltechAI/fewbit","repo_kind":"official","path":"fewbit/approx.py","file_url":"https://github.com/SkoltechAI/fewbit/blob/HEAD/fewbit/approx.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"a5c843a81567e736"}},{"code_sha256_prefix":"11e69fa774fc1892","entry":"estimate_memory_usage","repo":"SkoltechAI/fewbit","repo_kind":"official","path":"fewbit/util.py","file_url":"https://github.com/SkoltechAI/fewbit/blob/HEAD/fewbit/util.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"11e69fa774fc1892"}},{"code_sha256_prefix":"6fc8638c18f0ce42","entry":"estimate_variance_rmm","repo":"SkoltechAI/fewbit","repo_kind":"official","path":"fewbit/modules/variance.py","file_url":"https://github.com/SkoltechAI/fewbit/blob/HEAD/fewbit/modules/variance.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"6fc8638c18f0ce42"}},{"code_sha256_prefix":"68f0decf99978fcb","entry":"estimate_variance_sgd","repo":"SkoltechAI/fewbit","repo_kind":"official","path":"fewbit/modules/variance.py","file_url":"https://github.com/SkoltechAI/fewbit/blob/HEAD/fewbit/modules/variance.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"68f0decf99978fcb"}},{"code_sha256_prefix":"227e256653d49044","entry":"idct","repo":"SkoltechAI/fewbit","repo_kind":"official","path":"fewbit/fft.py","file_url":"https://github.com/SkoltechAI/fewbit/blob/HEAD/fewbit/fft.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"227e256653d49044"}},{"code_sha256_prefix":"920472b6219d42b5","entry":"insert_args","repo":"SkoltechAI/fewbit","repo_kind":"official","path":"fewbit/modules/activations.py","file_url":"https://github.com/SkoltechAI/fewbit/blob/HEAD/fewbit/modules/activations.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"920472b6219d42b5"}},{"code_sha256_prefix":"5d477abefd44b2d0","entry":"load_func","repo":"SkoltechAI/fewbit","repo_kind":"official","path":"fewbit/functional/activations.py","file_url":"https://github.com/SkoltechAI/fewbit/blob/HEAD/fewbit/functional/activations.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"5d477abefd44b2d0"}},{"code_sha256_prefix":"2adbb1ba9627b56f","entry":"map_module","repo":"SkoltechAI/fewbit","repo_kind":"official","path":"fewbit/util.py","file_url":"https://github.com/SkoltechAI/fewbit/blob/HEAD/fewbit/util.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"2adbb1ba9627b56f"}},{"code_sha256_prefix":"b43ba240a309b25f","entry":"stepwise","repo":"SkoltechAI/fewbit","repo_kind":"official","path":"fewbit/approx.py","file_url":"https://github.com/SkoltechAI/fewbit/blob/HEAD/fewbit/approx.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"b43ba240a309b25f"}},{"code_sha256_prefix":"9a1cb09a2c15016b","entry":"teniter","repo":"SkoltechAI/fewbit","repo_kind":"official","path":"fewbit/util.py","file_url":"https://github.com/SkoltechAI/fewbit/blob/HEAD/fewbit/util.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"9a1cb09a2c15016b"}},{"code_sha256_prefix":"e093939e7df95a04","entry":"update_args","repo":"SkoltechAI/fewbit","repo_kind":"official","path":"fewbit/modules/activations.py","file_url":"https://github.com/SkoltechAI/fewbit/blob/HEAD/fewbit/modules/activations.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"e093939e7df95a04"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}