{"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/lookbehind-optimizer-k-steps-back-1-step","title":"Lookbehind-SAM: k steps back, 1 step forward","arxiv_id":"2307.16704","date":"2023-07-31","proceeding":null,"authors":["Gonçalo Mordido","Pranshu Malviya","Aristide Baratin","Sarath Chandar"],"abstract":"Sharpness-aware minimization (SAM) methods have gained increasing popularity by formulating the problem of minimizing both loss value and loss sharpness as a minimax objective. In this work, we increase the efficiency of the maximization and minimization parts of SAM's objective to achieve a better loss-sharpness trade-off. By taking inspiration from the Lookahead optimizer, which uses multiple descent steps ahead, we propose Lookbehind, which performs multiple ascent steps behind to enhance the maximization step of SAM and find a worst-case perturbation with higher loss. Then, to mitigate the variance in the descent step arising from the gathered gradients across the multiple ascent steps, we employ linear interpolation to refine the minimization step. Lookbehind leads to a myriad of benefits across a variety of tasks. Particularly, we show increased generalization performance, greater robustness against noisy weights, as well as improved learning and less catastrophic forgetting in lifelong learning settings. Our code is available at https://github.com/chandar-lab/Lookbehind-SAM.","url_abs":"https://arxiv.org/abs/2307.16704v3","url_pdf":"https://arxiv.org/pdf/2307.16704v3.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":"lookbehind-optimizer-k-steps-back-1-step","repo_url":"https://github.com/chandar-lab/lookbehind-sam","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"lifelong-learning","task_name":"Lifelong learning"}],"methods":[{"method_slug":"lookahead","method_name":"Lookahead"},{"method_slug":"sam","method_name":"SAM"},{"method_slug":"sharpness-aware-minimization","method_name":"Sharpness-Aware Minimization"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2307.16704","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2307.16704"}},"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":"deterministic:regex_extraction","url":"https://github.com/facebookresearch/fairseq","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/chandar-lab/lookbehind-sam","reach":null}],"summary":{"ran":3},"by_repo_kind":{"official":{"samples":3,"ran":3,"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":"377a566d40489664","entry":"ASAM","repo":"chandar-lab/lookbehind-sam","repo_kind":"official","path":"lookbehind.py","file_url":"https://github.com/chandar-lab/lookbehind-sam/blob/HEAD/lookbehind.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"377a566d40489664"}},{"code_sha256_prefix":"391d3b4aa8a9268c","entry":"LookbehindASAM","repo":"chandar-lab/lookbehind-sam","repo_kind":"official","path":"lookbehind.py","file_url":"https://github.com/chandar-lab/lookbehind-sam/blob/HEAD/lookbehind.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"391d3b4aa8a9268c"}},{"code_sha256_prefix":"d98cd5182a1c6055","entry":"LookbehindSAM","repo":"chandar-lab/lookbehind-sam","repo_kind":"official","path":"lookbehind.py","file_url":"https://github.com/chandar-lab/lookbehind-sam/blob/HEAD/lookbehind.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"d98cd5182a1c6055"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}