{"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/arxiv-2508-19564","title":"Bi-LoRA: Efficient Sharpness-Aware Minimization for Fine-Tuning Large-Scale Models","arxiv_id":"2508.19564","date":"2025-08-27","proceeding":"ICLR","authors":["Yuhang Liu","Tao Li","Zhehao Huang","Zuopeng Yang","Xiaolin Huang"],"abstract":"Fine-tuning large-scale pre-trained models with limited data presents significant challenges for generalization. While Sharpness-Aware Minimization (SAM) has proven effective in improving generalization by seeking flat minima, its substantial extra memory and computation overhead make it impractical for large models. Integrating SAM with parameter-efficient fine-tuning methods like Low-Rank Adaptation (LoRA) is a promising direction. However, we find that directly applying SAM to LoRA parameters limits the sharpness optimization to a restricted subspace, hindering its effectiveness. To address this limitation, we propose Bi-directional Low-Rank Adaptation (Bi-LoRA), which introduces an auxiliary LoRA module to model SAM's adversarial weight perturbations. It decouples SAM's weight perturbations from LoRA optimization: the primary LoRA module adapts to specific tasks via standard gradient descent, while the auxiliary module captures the sharpness of the loss landscape through gradient ascent. Such dual-module design enables Bi-LoRA to capture broader sharpness for achieving flatter minima while remaining memory-efficient. Another important benefit is that the dual design allows for simultaneous optimization and perturbation, eliminating SAM's doubled training costs. Extensive experiments across diverse tasks and architectures demonstrate Bi-LoRA's efficiency and effectiveness in enhancing generalization.","url_abs":"https://arxiv.org/abs/2508.19564","url_pdf":"https://arxiv.org/pdf/2508.19564","source":{"archive":null,"snapshot":"2025-07-28","note":"not in the Papers with Code archive (frozen at the snapshot)","row_kind":"graph","title_abstract_authors_date":"arXiv metadata, CC0 1.0 (https://info.arxiv.org/help/license)"},"code_links":[],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2508.19564","atlas_url":"https://app.syntology.ai/?focus=2508.19564","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2508.19564"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+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":[{"mentioned_in_github":null,"is_official":null,"provenance":"deterministic:regex_extraction","mentioned_in_paper":null,"url":"https://github.com/CrazyElements/Bi-LoRA","reach":{"status":"ok"}}],"summary":{"unverified":10},"by_repo_kind":{"found_in_text":{"samples":10,"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":10,"samples":[{"code_sha256_prefix":"45db30ac52f3cd6d","entry":"SeqToSeqEncode","repo":"CrazyElements/Bi-LoRA","repo_kind":"found_in_text","path":"utils.py","file_url":"https://github.com/CrazyElements/Bi-LoRA/blob/HEAD/utils.py","link_basis":"plan_row","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":"45db30ac52f3cd6d"}},{"code_sha256_prefix":"1d0db22ae067b53c","entry":"cache_to_disk","repo":"CrazyElements/Bi-LoRA","repo_kind":"found_in_text","path":"data.py","file_url":"https://github.com/CrazyElements/Bi-LoRA/blob/HEAD/data.py","link_basis":"plan_row","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":"1d0db22ae067b53c"}},{"code_sha256_prefix":"38de4191703bb96a","entry":"causalLMEncode","repo":"CrazyElements/Bi-LoRA","repo_kind":"found_in_text","path":"utils.py","file_url":"https://github.com/CrazyElements/Bi-LoRA/blob/HEAD/utils.py","link_basis":"plan_row","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":"38de4191703bb96a"}},{"code_sha256_prefix":"37956805de2d38a5","entry":"extract_num","repo":"CrazyElements/Bi-LoRA","repo_kind":"found_in_text","path":"eval_gsm8k.py","file_url":"https://github.com/CrazyElements/Bi-LoRA/blob/HEAD/eval_gsm8k.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":"37956805de2d38a5"}},{"code_sha256_prefix":"65f3cc97d3e5034f","entry":"find_all_linear_modules","repo":"CrazyElements/Bi-LoRA","repo_kind":"found_in_text","path":"run_exp.py","file_url":"https://github.com/CrazyElements/Bi-LoRA/blob/HEAD/run_exp.py","link_basis":"plan_row","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":"65f3cc97d3e5034f"}},{"code_sha256_prefix":"573cdad4d6e25842","entry":"find_hidden_state_size","repo":"CrazyElements/Bi-LoRA","repo_kind":"found_in_text","path":"run_exp.py","file_url":"https://github.com/CrazyElements/Bi-LoRA/blob/HEAD/run_exp.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":"573cdad4d6e25842"}},{"code_sha256_prefix":"3d89ae379c578057","entry":"get_forward_hook","repo":"CrazyElements/Bi-LoRA","repo_kind":"found_in_text","path":"logTrainer.py","file_url":"https://github.com/CrazyElements/Bi-LoRA/blob/HEAD/logTrainer.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":"3d89ae379c578057"}},{"code_sha256_prefix":"1b37d30c5eaded49","entry":"load_flan_v2","repo":"CrazyElements/Bi-LoRA","repo_kind":"found_in_text","path":"data.py","file_url":"https://github.com/CrazyElements/Bi-LoRA/blob/HEAD/data.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":"1b37d30c5eaded49"}},{"code_sha256_prefix":"963559e86ce91fd8","entry":"load_meta_math","repo":"CrazyElements/Bi-LoRA","repo_kind":"found_in_text","path":"data.py","file_url":"https://github.com/CrazyElements/Bi-LoRA/blob/HEAD/data.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":"963559e86ce91fd8"}},{"code_sha256_prefix":"11121e01fff2c974","entry":"setup_logger","repo":"CrazyElements/Bi-LoRA","repo_kind":"found_in_text","path":"run_exp.py","file_url":"https://github.com/CrazyElements/Bi-LoRA/blob/HEAD/run_exp.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":"11121e01fff2c974"}}]},"arxiv_metadata":{"licence":"arXiv metadata, CC0 1.0 (https://info.arxiv.org/help/license)","fields":["title","abstract","authors","date"],"primary_category":"cs.LG","source":"arxiv_api"},"syntology_extracted_results":null}