{"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/can-textual-gradient-work-in-federated","title":"Can Textual Gradient Work in Federated Learning?","arxiv_id":"2502.19980","date":"2025-02-27","proceeding":null,"authors":["Minghui Chen","Ruinan Jin","Wenlong Deng","YuanYuan Chen","Zhi Huang","Han Yu","Xiaoxiao Li"],"abstract":"Recent studies highlight the promise of LLM-based prompt optimization, especially with TextGrad, which automates differentiation'' via texts and backpropagates textual feedback. This approach facilitates training in various real-world applications that do not support numerical gradient propagation or loss calculation. In this paper, we systematically explore the potential and challenges of incorporating textual gradient into Federated Learning (FL). Our contributions are fourfold. Firstly, we introduce a novel FL paradigm, Federated Textual Gradient (FedTextGrad), that allows clients to upload locally optimized prompts derived from textual gradients, while the server aggregates the received prompts. Unlike traditional FL frameworks, which are designed for numerical aggregation, FedTextGrad is specifically tailored for handling textual data, expanding the applicability of FL to a broader range of problems that lack well-defined numerical loss functions. Secondly, building on this design, we conduct extensive experiments to explore the feasibility of FedTextGrad. Our findings highlight the importance of properly tuning key factors (e.g., local steps) in FL training. Thirdly, we highlight a major challenge in FedTextGrad aggregation: retaining essential information from distributed prompt updates. Last but not least, in response to this issue, we improve the vanilla variant of FedTextGrad by providing actionable guidance to the LLM when summarizing client prompts by leveraging the Uniform Information Density principle. Through this principled study, we enable the adoption of textual gradients in FL for optimizing LLMs, identify important issues, and pinpoint future directions, thereby opening up a new research area that warrants further investigation.","url_abs":"https://arxiv.org/abs/2502.19980v1","url_pdf":"https://arxiv.org/pdf/2502.19980v1.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":"can-textual-gradient-work-in-federated","repo_url":"https://github.com/ubc-tea/FedTextGrad","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":null}],"tasks":[{"task_slug":"federated-learning","task_name":"Federated Learning"}],"methods":[{"method_slug":"textgrad","method_name":"TextGrad"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2502.19980","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2502.19980"}},"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/ubc-tea/FedTextGrad","reach":null}],"summary":{"ran":1,"ran_violates":2,"ran_draft_wrong":2,"ran_fixture":1,"unverified":6},"by_repo_kind":{"official":{"samples":12,"ran":6,"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":12,"samples":[{"code_sha256_prefix":"5008a349531d9698","entry":"SingletonBackwardEngine","repo":"ubc-tea/FedTextGrad","repo_kind":"official","path":"textgrad/optimizer/optimizer.py","file_url":"https://github.com/ubc-tea/FedTextGrad/blob/HEAD/textgrad/optimizer/optimizer.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":"5008a349531d9698"}},{"code_sha256_prefix":"6c6b64c6f227a73e","entry":"_check_if_multimodal","repo":"ubc-tea/FedTextGrad","repo_kind":"official","path":"textgrad/optimizer/optimizer.py","file_url":"https://github.com/ubc-tea/FedTextGrad/blob/HEAD/textgrad/optimizer/optimizer.py","link_basis":"first_harvest_node","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"6c6b64c6f227a73e"}},{"code_sha256_prefix":"792feffeafa114cd","entry":"construct_tgd_prompt","repo":"ubc-tea/FedTextGrad","repo_kind":"official","path":"textgrad/optimizer/optimizer.py","file_url":"https://github.com/ubc-tea/FedTextGrad/blob/HEAD/textgrad/optimizer/optimizer.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"792feffeafa114cd"}},{"code_sha256_prefix":"ce12de8593347921","entry":"get_gradient_and_context_text","repo":"ubc-tea/FedTextGrad","repo_kind":"official","path":"textgrad/optimizer/optimizer.py","file_url":"https://github.com/ubc-tea/FedTextGrad/blob/HEAD/textgrad/optimizer/optimizer.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"ce12de8593347921"}},{"code_sha256_prefix":"a5790751e1d60937","entry":"is_valid_url","repo":"ubc-tea/FedTextGrad","repo_kind":"official","path":"textgrad/optimizer/optimizer.py","file_url":"https://github.com/ubc-tea/FedTextGrad/blob/HEAD/textgrad/optimizer/optimizer.py","link_basis":"first_harvest_node","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"a5790751e1d60937"}},{"code_sha256_prefix":"1bebe4ea01268cce","entry":"validate_engine_or_get_default","repo":"ubc-tea/FedTextGrad","repo_kind":"official","path":"textgrad/optimizer/optimizer.py","file_url":"https://github.com/ubc-tea/FedTextGrad/blob/HEAD/textgrad/optimizer/optimizer.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"DEP_MISSING","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"1bebe4ea01268cce"}},{"code_sha256_prefix":"4742d5b210b29ae7","entry":"EngineLM","repo":"ubc-tea/FedTextGrad","repo_kind":"official","path":"textgrad/optimizer/optimizer.py","file_url":"https://github.com/ubc-tea/FedTextGrad/blob/HEAD/textgrad/optimizer/optimizer.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":"4742d5b210b29ae7"}},{"code_sha256_prefix":"564ea28ae44d788f","entry":"Optimizer","repo":"ubc-tea/FedTextGrad","repo_kind":"official","path":"textgrad/optimizer/optimizer.py","file_url":"https://github.com/ubc-tea/FedTextGrad/blob/HEAD/textgrad/optimizer/optimizer.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":"564ea28ae44d788f"}},{"code_sha256_prefix":"37c7ec07ab37ca27","entry":"TextualGradientDescent","repo":"ubc-tea/FedTextGrad","repo_kind":"official","path":"textgrad/optimizer/optimizer.py","file_url":"https://github.com/ubc-tea/FedTextGrad/blob/HEAD/textgrad/optimizer/optimizer.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":"37c7ec07ab37ca27"}},{"code_sha256_prefix":"6facfd654eb7db2e","entry":"_backward_idempotent","repo":"ubc-tea/FedTextGrad","repo_kind":"official","path":"textgrad/optimizer/optimizer.py","file_url":"https://github.com/ubc-tea/FedTextGrad/blob/HEAD/textgrad/optimizer/optimizer.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":"6facfd654eb7db2e"}},{"code_sha256_prefix":"b40994628dd26d87","entry":"_check_and_reduce_gradients","repo":"ubc-tea/FedTextGrad","repo_kind":"official","path":"textgrad/optimizer/optimizer.py","file_url":"https://github.com/ubc-tea/FedTextGrad/blob/HEAD/textgrad/optimizer/optimizer.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":"b40994628dd26d87"}},{"code_sha256_prefix":"d0b6421efc2f659d","entry":"get_engine","repo":"ubc-tea/FedTextGrad","repo_kind":"official","path":"textgrad/optimizer/optimizer.py","file_url":"https://github.com/ubc-tea/FedTextGrad/blob/HEAD/textgrad/optimizer/optimizer.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":"d0b6421efc2f659d"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}