[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-median-research-group--LibMTL":3,"tool-median-research-group--LibMTL":61},[4,18,26,36,44,52],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":17},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[13,14,15,16],"Agent","开发框架","图像","数据工具","ready",{"id":19,"name":20,"github_repo":21,"description_zh":22,"stars":23,"difficulty_score":10,"last_commit_at":24,"category_tags":25,"status":17},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,"2026-04-05T11:01:52",[14,15,13],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":32,"last_commit_at":33,"category_tags":34,"status":17},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",141543,2,"2026-04-06T11:32:54",[14,13,35],"语言模型",{"id":37,"name":38,"github_repo":39,"description_zh":40,"stars":41,"difficulty_score":32,"last_commit_at":42,"category_tags":43,"status":17},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",107888,"2026-04-06T11:32:50",[14,15,13],{"id":45,"name":46,"github_repo":47,"description_zh":48,"stars":49,"difficulty_score":10,"last_commit_at":50,"category_tags":51,"status":17},4487,"LLMs-from-scratch","rasbt\u002FLLMs-from-scratch","LLMs-from-scratch 是一个基于 PyTorch 的开源教育项目，旨在引导用户从零开始一步步构建一个类似 ChatGPT 的大型语言模型（LLM）。它不仅是同名技术著作的官方代码库，更提供了一套完整的实践方案，涵盖模型开发、预训练及微调的全过程。\n\n该项目主要解决了大模型领域“黑盒化”的学习痛点。许多开发者虽能调用现成模型，却难以深入理解其内部架构与训练机制。通过亲手编写每一行核心代码，用户能够透彻掌握 Transformer 架构、注意力机制等关键原理，从而真正理解大模型是如何“思考”的。此外，项目还包含了加载大型预训练权重进行微调的代码，帮助用户将理论知识延伸至实际应用。\n\nLLMs-from-scratch 特别适合希望深入底层原理的 AI 开发者、研究人员以及计算机专业的学生。对于不满足于仅使用 API，而是渴望探究模型构建细节的技术人员而言，这是极佳的学习资源。其独特的技术亮点在于“循序渐进”的教学设计：将复杂的系统工程拆解为清晰的步骤，配合详细的图表与示例，让构建一个虽小但功能完备的大模型变得触手可及。无论你是想夯实理论基础，还是为未来研发更大规模的模型做准备",90106,"2026-04-06T11:19:32",[35,15,13,14],{"id":53,"name":54,"github_repo":55,"description_zh":56,"stars":57,"difficulty_score":10,"last_commit_at":58,"category_tags":59,"status":17},4292,"Deep-Live-Cam","hacksider\u002FDeep-Live-Cam","Deep-Live-Cam 是一款专注于实时换脸与视频生成的开源工具，用户仅需一张静态照片，即可通过“一键操作”实现摄像头画面的即时变脸或制作深度伪造视频。它有效解决了传统换脸技术流程繁琐、对硬件配置要求极高以及难以实时预览的痛点，让高质量的数字内容创作变得触手可及。\n\n这款工具不仅适合开发者和技术研究人员探索算法边界，更因其极简的操作逻辑（仅需三步：选脸、选摄像头、启动），广泛适用于普通用户、内容创作者、设计师及直播主播。无论是为了动画角色定制、服装展示模特替换，还是制作趣味短视频和直播互动，Deep-Live-Cam 都能提供流畅的支持。\n\n其核心技术亮点在于强大的实时处理能力，支持口型遮罩（Mouth Mask）以保留使用者原始的嘴部动作，确保表情自然精准；同时具备“人脸映射”功能，可同时对画面中的多个主体应用不同面孔。此外，项目内置了严格的内容安全过滤机制，自动拦截涉及裸露、暴力等不当素材，并倡导用户在获得授权及明确标注的前提下合规使用，体现了技术发展与伦理责任的平衡。",88924,"2026-04-06T03:28:53",[14,15,13,60],"视频",{"id":62,"github_repo":63,"name":64,"description_en":65,"description_zh":66,"ai_summary_zh":66,"readme_en":67,"readme_zh":68,"quickstart_zh":69,"use_case_zh":70,"hero_image_url":71,"owner_login":72,"owner_name":73,"owner_avatar_url":74,"owner_bio":73,"owner_company":73,"owner_location":73,"owner_email":73,"owner_twitter":73,"owner_website":73,"owner_url":75,"languages":76,"stars":81,"forks":82,"last_commit_at":83,"license":84,"difficulty_score":10,"env_os":85,"env_gpu":86,"env_ram":85,"env_deps":87,"category_tags":94,"github_topics":95,"view_count":32,"oss_zip_url":73,"oss_zip_packed_at":73,"status":17,"created_at":107,"updated_at":108,"faqs":109,"releases":145},4444,"median-research-group\u002FLibMTL","LibMTL","A PyTorch Library for Multi-Task Learning","LibMTL 是一个基于 PyTorch 构建的开源多任务学习（MTL）库，旨在帮助开发者高效地训练同时处理多个相关任务的深度学习模型。在多任务学习中，如何平衡不同任务的梯度冲突、避免负迁移以及自动调整损失权重一直是核心难题，LibMTL 通过集成数十种前沿算法，为这些问题提供了标准化的解决方案。\n\n无论是学术研究人员还是工程开发者，都能利用 LibMTL 快速复现最新论文成果或构建生产级应用。其独特亮点在于拥有极广的算法覆盖面，不仅包含经典的加权求和策略，还集成了如 Nash-MTL、FairGrad、Auto-Lambda 等源自 ICML、NeurIPS、CVPR 等顶级会议的先进方法，甚至支持双层优化和基于梯度的多目标深度学习技术。此外，LibMTL 提供了清晰的 API 文档和涵盖计算机视觉、自然语言处理及分子属性预测等多个领域的示例代码，让用户无需从零编写复杂的调度逻辑，即可灵活切换并对比不同算法效果，显著提升实验效率与模型性能。","# LibMTL\n\n[![Documentation Status](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmedian-research-group_LibMTL_readme_13d664e1afd7.png)](https:\u002F\u002Flibmtl.readthedocs.io\u002Fen\u002Flatest\u002F?badge=latest) [![License: MIT](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-MIT-blue.svg)](https:\u002F\u002Fgithub.com\u002Fmedian-research-group\u002FLibMTL\u002Fblob\u002Fmain\u002FLICENSE) [![PyPI version](https:\u002F\u002Fbadge.fury.io\u002Fpy\u002FLibMTL.svg)](https:\u002F\u002Fbadge.fury.io\u002Fpy\u002FLibMTL) [![Supported Python versions](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fpyversions\u002FLibMTL.svg?logo=python&logoColor=FFE873)](https:\u002F\u002Fgithub.com\u002Fmedian-research-group\u002FLibMTL) [![CodeFactor](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmedian-research-group_LibMTL_readme_9ee0cb95ac54.png)](https:\u002F\u002Fwww.codefactor.io\u002Frepository\u002Fgithub\u002Fmedian-research-group\u002Flibmtl\u002Foverview\u002Fmain) [![paper](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FAccepted%20by-JMLR-b31b1b.svg)](https:\u002F\u002Fwww.jmlr.org\u002Fpapers\u002Fv24\u002F22-0347.html) [![coverage](.\u002Ftests\u002Fcoverage.svg)](https:\u002F\u002Fgithub.com\u002Fmedian-research-group\u002FLibMTL) [![Hits](https:\u002F\u002Fhits.seeyoufarm.com\u002Fapi\u002Fcount\u002Fincr\u002Fbadge.svg?url=https%3A%2F%2Fgithub.com%2Fmedian-research-group%2FLibMTL&count_bg=%23763DC8&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=visitors&edge_flat=false)](https:\u002F\u002Fhits.seeyoufarm.com) [![Made With Love](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FMade%20With-Love-orange.svg)](https:\u002F\u002Fgithub.com\u002Fmedian-research-group\u002FLibMTL) \n\n``LibMTL`` is an open-source library built on [PyTorch](https:\u002F\u002Fpytorch.org\u002F) for Multi-Task Learning (MTL). See the [latest documentation](https:\u002F\u002Flibmtl.readthedocs.io\u002Fen\u002Flatest\u002F) for detailed introductions and API instructions.\n\n:star: Star us on GitHub — it motivates us a lot!\n\n:bangbang: A comprehensive survey on **Gradient-based Multi-Objective Deep Learning** is now available on [arXiv](https:\u002F\u002Farxiv.org\u002Fabs\u002F2501.10945), along with an [awesome list](https:\u002F\u002Fgithub.com\u002FBaijiong-Lin\u002FAwesome-Multi-Objective-Deep-Learning). Check it out!\n\n## News\n\n- **[Apr 21 2025]** Added support for [UPGrad](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2406.16232).\n- **[Feb 18 2025]** Added support for a bilevel method [Auto-Lambda](https:\u002F\u002Fopenreview.net\u002Fforum?id=KKeCMim5VN) (TMLR 2022).\n- **[Feb 17 2025]** Added support for [FAMO](https:\u002F\u002Fopenreview.net\u002Fforum?id=zMeemcUeXL) (NeurIPS 2023), [SDMGrad](https:\u002F\u002Fopenreview.net\u002Fforum?id=4Ks8RPcXd9) (NeurIPS 2023), and [MoDo](https:\u002F\u002Fopenreview.net\u002Fforum?id=yPkbdJxQ0o) (NeurIPS 2023; JMLR 2024).\n- **[Feb 06 2025]** Added support for two bilevel methods: [MOML](https:\u002F\u002Fproceedings.neurips.cc\u002Fpaper\u002F2021\u002Fhash\u002Fb23975176653284f1f7356ba5539cfcb-Abstract.html) (NeurIPS 2021; AIJ 2024), [FORUM](https:\u002F\u002Febooks.iospress.nl\u002Fdoi\u002F10.3233\u002FFAIA240793) (ECAI 2024).\n- **[Sep 19 2024]** Added support for [FairGrad](https:\u002F\u002Fopenreview.net\u002Fforum?id=KLmWRMg6nL) (ICML 2024).\n- **[Aug 31 2024]** Added support for [ExcessMTL](https:\u002F\u002Fopenreview.net\u002Fforum?id=JzWFmMySpn) (ICML 2024).\n- **[Jul 24 2024]** Added support for [STCH](https:\u002F\u002Fopenreview.net\u002Fforum?id=m4dO5L6eCp) (ICML 2024).\n- **[Feb 08 2024]** Added support for [DB-MTL](https:\u002F\u002Farxiv.org\u002Fabs\u002F2308.12029).\n- **[Aug 16 2023]**: Added support for [MoCo](https:\u002F\u002Fopenreview.net\u002Fforum?id=dLAYGdKTi2) (ICLR 2023). Many thanks to the author's help [@heshandevaka](https:\u002F\u002Fgithub.com\u002Fheshandevaka).\n- **[Jul 11 2023]** Paper got accepted to [JMLR](https:\u002F\u002Fjmlr.org\u002Fpapers\u002Fv24\u002F22-0347.html).\n- **[Jun 19 2023]** Added support for [Aligned-MTL](https:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent\u002FCVPR2023\u002Fhtml\u002FSenushkin_Independent_Component_Alignment_for_Multi-Task_Learning_CVPR_2023_paper.html) (CVPR 2023).\n- **[Mar 10 2023]**: Added [QM9](https:\u002F\u002Fgithub.com\u002Fmedian-research-group\u002FLibMTL\u002Ftree\u002Fmain\u002Fexamples\u002Fqm9) and [PAWS-X](https:\u002F\u002Fgithub.com\u002Fmedian-research-group\u002FLibMTL\u002Ftree\u002Fmain\u002Fexamples\u002Fxtreme) examples.\n- **[Jul 22 2022]**: Added support for [Nash-MTL](https:\u002F\u002Fproceedings.mlr.press\u002Fv162\u002Fnavon22a\u002Fnavon22a.pdf) (ICML 2022).\n- **[Jul 21 2022]**: Added support for [Learning to Branch](http:\u002F\u002Fproceedings.mlr.press\u002Fv119\u002Fguo20e\u002Fguo20e.pdf) (ICML 2020). Many thanks to [@yuezhixiong](https:\u002F\u002Fgithub.com\u002Fyuezhixiong) ([#14](https:\u002F\u002Fgithub.com\u002Fmedian-research-group\u002FLibMTL\u002Fpull\u002F14)).\n- **[Mar 29 2022]**: Paper is now available on the [arXiv](https:\u002F\u002Farxiv.org\u002Fabs\u002F2203.14338).\n\n## Table of Content\n\n- [Features](#features)\n- [Overall Framework](#overall-framework)\n- [Supported Algorithms](#supported-algorithms)\n- [Supported Benchmark Datasets](#supported-benchmark-datasets)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [Download Dataset](#download-dataset)\n  - [Run a Model](#run-a-model)\n- [Citation](#citation)\n- [Contributor](#contributor)\n- [Contact Us](#contact-us)\n- [Acknowledgements](#acknowledgements)\n- [License](#license)\n\n## Features\n\n- **Unified**:  ``LibMTL`` provides a unified code base to implement and a consistent evaluation procedure including data processing, metric objectives, and hyper-parameters on several representative MTL benchmark datasets, which allows quantitative, fair, and consistent comparisons between different MTL algorithms.\n- **Comprehensive**: ``LibMTL`` supports many state-of-the-art MTL methods including 8 architectures and 16 optimization strategies. Meanwhile, ``LibMTL`` provides a fair comparison of several benchmark datasets covering different fields.\n- **Extensible**:  ``LibMTL`` follows the modular design principles, which allows users to flexibly and conveniently add customized components or make personalized modifications. Therefore, users can easily and fast develop novel optimization strategies and architectures or apply the existing MTL algorithms to new application scenarios with the support of ``LibMTL``.\n\n## Overall Framework\n\n ![framework](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmedian-research-group_LibMTL_readme_5408c2e83b54.png)\n\nEach module is introduced in [Docs](https:\u002F\u002Flibmtl.readthedocs.io\u002Fen\u002Flatest\u002Fdocs\u002Fuser_guide\u002Fframework.html).\n\n## Supported Algorithms\n\n``LibMTL`` currently supports the following algorithms:\n\n| Optimization Strategies                                                                                                                                                                                           | Venues             | Arguments                   |\n| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | --------------------------- |\n| Equal Weighting (EW)                                                                                                                                                                                              | -                  | ``--weighting EW``          |\n| Gradient Normalization ([GradNorm](http:\u002F\u002Fproceedings.mlr.press\u002Fv80\u002Fchen18a\u002Fchen18a.pdf))                                                                                                                         | ICML 2018          | ``--weighting GradNorm``    |\n| Uncertainty Weights ([UW](https:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_cvpr_2018\u002Fpapers\u002FKendall_Multi-Task_Learning_Using_CVPR_2018_paper.pdf))                                                                          | CVPR 2018          | ``--weighting UW``          |\n| [MGDA](https:\u002F\u002Fpapers.nips.cc\u002Fpaper\u002F2018\u002Fhash\u002F432aca3a1e345e339f35a30c8f65edce-Abstract.html) ([official code](https:\u002F\u002Fgithub.com\u002Fisl-org\u002FMultiObjectiveOptimization))                                            | NeurIPS 2018       | ``--weighting MGDA``        |\n| Dynamic Weight Average ([DWA](https:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_CVPR_2019\u002Fpapers\u002FLiu_End-To-End_Multi-Task_Learning_With_Attention_CVPR_2019_paper.pdf)) ([official code](https:\u002F\u002Fgithub.com\u002Florenmt\u002Fmtan))   | CVPR 2019          | ``--weighting DWA``         |\n| Geometric Loss Strategy ([GLS](https:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_CVPRW_2019\u002Fpapers\u002FWAD\u002FChennupati_MultiNet_Multi-Stream_Feature_Aggregation_and_Geometric_Loss_Strategy_for_Multi-Task_CVPRW_2019_paper.pdf)) | CVPR 2019 Workshop | ``--weighting GLS``         |\n| Projecting Conflicting Gradient ([PCGrad](https:\u002F\u002Fpapers.nips.cc\u002Fpaper\u002F2020\u002Fhash\u002F3fe78a8acf5fda99de95303940a2420c-Abstract.html))                                                                                 | NeurIPS 2020       | ``--weighting PCGrad``      |\n| Gradient sign Dropout ([GradDrop](https:\u002F\u002Fpapers.nips.cc\u002Fpaper\u002F2020\u002Fhash\u002F16002f7a455a94aa4e91cc34ebdb9f2d-Abstract.html))                                                                                         | NeurIPS 2020       | ``--weighting GradDrop``    |\n| Impartial Multi-Task Learning ([IMTL](https:\u002F\u002Fopenreview.net\u002Fforum?id=IMPnRXEWpvr))                                                                                                                               | ICLR 2021          | ``--weighting IMTL``        |\n| Gradient Vaccine ([GradVac](https:\u002F\u002Fopenreview.net\u002Fforum?id=F1vEjWK-lH_))                                                                                                                                         | ICLR 2021          | ``--weighting GradVac``     |\n| Conflict-Averse Gradient descent ([CAGrad](https:\u002F\u002Fopenreview.net\u002Fforum?id=_61Qh8tULj_)) ([official code](https:\u002F\u002Fgithub.com\u002FCranial-XIX\u002FCAGrad))                                                                 | NeurIPS 2021       | ``--weighting CAGrad``      |\n| [MOML](https:\u002F\u002Fproceedings.neurips.cc\u002Fpaper\u002F2021\u002Fhash\u002Fb23975176653284f1f7356ba5539cfcb-Abstract.html)                                                                                                             | NeurIPS 2021       | ``--weighting MOML``        |\n| [Nash-MTL](https:\u002F\u002Fproceedings.mlr.press\u002Fv162\u002Fnavon22a\u002Fnavon22a.pdf) ([official code](https:\u002F\u002Fgithub.com\u002FAvivNavon\u002Fnash-mtl))                                                                                     | ICML 2022          | ``--weighting Nash_MTL``    |\n| Random Loss Weighting ([RLW](https:\u002F\u002Fopenreview.net\u002Fforum?id=jjtFD8A1Wx))                                                                                                                                         | TMLR 2022          | ``--weighting RLW``         |\n| [Auto-Lambda](https:\u002F\u002Fopenreview.net\u002Fforum?id=KKeCMim5VN) ([official code](https:\u002F\u002Fgithub.com\u002Florenmt\u002Fauto-lambda))                                                                                               | TMLR 2022          | ``--weighting AutoLambda``  |\n| [MoCo](https:\u002F\u002Fopenreview.net\u002Fforum?id=dLAYGdKTi2)                                                                                                                                                                | ICLR 2023          | ``--weighting MoCo``        |\n| [Aligned-MTL](https:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent\u002FCVPR2023\u002Fhtml\u002FSenushkin_Independent_Component_Alignment_for_Multi-Task_Learning_CVPR_2023_paper.html) ([official code](https:\u002F\u002Fgithub.com\u002FSamsungLabs\u002FMTL))   | CVPR 2023          | ``--weighting Aligned_MTL`` |\n| [FAMO](https:\u002F\u002Fopenreview.net\u002Fforum?id=zMeemcUeXL) ([official code](https:\u002F\u002Fgithub.com\u002FCranial-XIX\u002FFAMO))                                                                                                         | NeurIPS 2023       | ``--weighting FAMO``        |\n| [SDMGrad](https:\u002F\u002Fopenreview.net\u002Fforum?id=4Ks8RPcXd9) ([official code](https:\u002F\u002Fgithub.com\u002FOptMN-Lab\u002Fsdmgrad))                                                                                                     | NeurIPS 2023       | ``--weighting SDMGrad``     |\n| [MoDo](https:\u002F\u002Fopenreview.net\u002Fforum?id=yPkbdJxQ0o) ([official code](https:\u002F\u002Fgithub.com\u002Fheshandevaka\u002FTrade-Off-MOL))                                                                                               | NeurIPS 2023       | ``--weighting MoDo``        |\n| [FORUM](https:\u002F\u002Febooks.iospress.nl\u002Fdoi\u002F10.3233\u002FFAIA240793)                                                                                                                                                        | ECAI 2024          | ``--weighting FORUM``       |\n| [STCH](https:\u002F\u002Fopenreview.net\u002Fforum?id=m4dO5L6eCp) ([official code](https:\u002F\u002Fgithub.com\u002FXi-L\u002FSTCH\u002Ftree\u002Fmain\u002FSTCH_MTL))                                                                                             | ICML 2024          | ``--weighting STCH``        |\n| [ExcessMTL](https:\u002F\u002Fopenreview.net\u002Fforum?id=JzWFmMySpn) ([official code](https:\u002F\u002Fgithub.com\u002Fyifei-he\u002FExcessMTL\u002Fblob\u002Fmain\u002FLibMTL\u002FLibMTL\u002Fweighting\u002FExcessMTL.py))                                                   | ICML 2024          | ``--weighting ExcessMTL``   |\n| [FairGrad](https:\u002F\u002Fopenreview.net\u002Fforum?id=KLmWRMg6nL) ([official code](https:\u002F\u002Fgithub.com\u002FOptMN-Lab\u002Ffairgrad))                                                                                                   | ICML 2024          | ``--weighting FairGrad``    |\n| [DB-MTL](https:\u002F\u002Farxiv.org\u002Fabs\u002F2308.12029)                                                                                                                                                                        | arXiv              | ``--weighting DB_MTL``      |\n| [UPGrad](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2406.16232) ([official code](https:\u002F\u002Fgithub.com\u002FTorchJD\u002Ftorchjd))                                                                                                                  | arXiv              | ``--weighting UPGrad``      |\n\n| Architectures                                                                                                                                                                                                          | Venues          | Arguments                      |\n| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------- | ------------------------------ |\n| Hard Parameter Sharing ([HPS](https:\u002F\u002Fdl.acm.org\u002Fdoi\u002F10.5555\u002F3091529.3091535))                                                                                                                                         | ICML 1993       | ``--arch HPS``                 |\n| Cross-stitch Networks ([Cross_stitch](https:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_cvpr_2016\u002Fpapers\u002FMisra_Cross-Stitch_Networks_for_CVPR_2016_paper.pdf))                                                                     | CVPR 2016       | ``--arch Cross_stitch``        |\n| Multi-gate Mixture-of-Experts ([MMoE](https:\u002F\u002Fdl.acm.org\u002Fdoi\u002F10.1145\u002F3219819.3220007))                                                                                                                                 | KDD 2018        | ``--arch MMoE``                |\n| Multi-Task Attention Network ([MTAN](https:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_CVPR_2019\u002Fpapers\u002FLiu_End-To-End_Multi-Task_Learning_With_Attention_CVPR_2019_paper.pdf)) ([official code](https:\u002F\u002Fgithub.com\u002Florenmt\u002Fmtan)) | CVPR 2019       | ``--arch MTAN``                |\n| Customized Gate Control ([CGC](https:\u002F\u002Fdl.acm.org\u002Fdoi\u002F10.1145\u002F3383313.3412236)), Progressive Layered Extraction ([PLE](https:\u002F\u002Fdl.acm.org\u002Fdoi\u002F10.1145\u002F3383313.3412236))                                                | ACM RecSys 2020 | ``--arch CGC``, ``--arch PLE`` |\n| Learning to Branch ([LTB](http:\u002F\u002Fproceedings.mlr.press\u002Fv119\u002Fguo20e\u002Fguo20e.pdf))                                                                                                                                        | ICML 2020       | ``--arch LTB``                 |\n| [DSelect-k](https:\u002F\u002Fproceedings.neurips.cc\u002Fpaper\u002F2021\u002Fhash\u002Ff5ac21cd0ef1b88e9848571aeb53551a-Abstract.html) ([official code](https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fgoogle-research\u002Ftree\u002Fmaster\u002Fdselect_k_moe))             | NeurIPS 2021    | ``--arch DSelect_k``           |\n\n## Supported Benchmark Datasets\n\n| Datasets                                                                                    | Problems                      | Task Number  | Tasks                                                                      | multi-input | Supported Backbone   |\n|:------------------------------------------------------------------------------------------- |:-----------------------------:|:------------:|:--------------------------------------------------------------------------:|:-----------:|:--------------------:|\n| [NYUv2](https:\u002F\u002Fgithub.com\u002Fmedian-research-group\u002FLibMTL\u002Ftree\u002Fmain\u002Fexamples\u002Fnyu)             | Scene Understanding           | 3            | Semantic Segmentation+\u003Cbr\u002F>Depth Estimation+\u003Cbr\u002F>Surface Normal Prediction | ✘           | ResNet50\u002F\u003Cbr\u002F>SegNet |\n| [Cityscapes](https:\u002F\u002Fgithub.com\u002Fmedian-research-group\u002FLibMTL\u002Ftree\u002Fmain\u002Fexamples\u002Fcityscapes) | Scene Understanding           | 2            | Semantic Segmentation+\u003Cbr\u002F>Depth Estimation                                | ✘           | ResNet50             |\n| [Office-31](https:\u002F\u002Fgithub.com\u002Fmedian-research-group\u002FLibMTL\u002Ftree\u002Fmain\u002Fexamples\u002Foffice)      | Image Recognition             | 3            | Classification                                                             | ✓           | ResNet18             |\n| [Office-Home](https:\u002F\u002Fgithub.com\u002Fmedian-research-group\u002FLibMTL\u002Ftree\u002Fmain\u002Fexamples\u002Foffice)    | Image Recognition             | 4            | Classification                                                             | ✓           | ResNet18             |\n| [QM9](https:\u002F\u002Fgithub.com\u002Fmedian-research-group\u002FLibMTL\u002Ftree\u002Fmain\u002Fexamples\u002Fqm9)               | Molecular Property Prediction | 11 (default) | Regression                                                                 | ✘           | GNN                  |\n| [PAWS-X](https:\u002F\u002Fgithub.com\u002Fmedian-research-group\u002FLibMTL\u002Ftree\u002Fmain\u002Fexamples\u002Fxtreme)         | Paraphrase Identification     | 4 (default)  | Classification                                                             | ✓           | Bert                 |\n\n## Installation\n\n1. Create a virtual environment\n   \n   ```shell\n   conda create -n libmtl python=3.10\n   conda activate libmtl\n   ```\n\n2. Clone the repository\n   \n   ```shell\n   git clone https:\u002F\u002Fgithub.com\u002Fmedian-research-group\u002FLibMTL.git\n   ```\n\n3. Install `LibMTL`\n   \n   ```shell\n   pip install torch==2.3.0+cu121 torchvision==0.18.0+cu121 -f https:\u002F\u002Fdownload.pytorch.org\u002Fwhl\u002Ftorch_stable.html\n   pip install torch-scatter==2.1.2+pt23cu121 torch_sparse==0.6.18+pt23cu121 -f https:\u002F\u002Fpytorch-geometric.com\u002Fwhl\u002Ftorch-2.3.0+cu121.html\n   \n   cd LibMTL\n   pip install -r requirements.txt\n   pip install -e .\n   ```\n\n## Quick Start\n\nWe use the NYUv2 dataset as an example to show how to use ``LibMTL``.\n\n### Download Dataset\n\nThe NYUv2 dataset we used is pre-processed by [mtan](https:\u002F\u002Fgithub.com\u002Florenmt\u002Fmtan). You can download this dataset [here](https:\u002F\u002Fwww.dropbox.com\u002Fsh\u002F86nssgwm6hm3vkb\u002FAACrnUQ4GxpdrBbLjb6n-mWNa?dl=0).\n\n### Run a Model\n\nThe complete training code for the NYUv2 dataset is provided in [examples\u002Fnyu](.\u002Fexamples\u002Fnyu). The file [main.py](.\u002Fexamples\u002Fnyu\u002Fmain.py) is the main file for training on the NYUv2 dataset.\n\nYou can find the command-line arguments by running the following command.\n\n```shell\npython main.py -h\n```\n\nFor instance, running the following command will train an MTL model with EW and HPS on NYUv2 dataset.\n\n```shell\npython main.py --weighting EW --arch HPS --dataset_path \u002Fpath\u002Fto\u002Fnyuv2 --gpu_id 0 --scheduler step --mode train --save_path PATH\n```\n\nMore details is represented in [Docs](https:\u002F\u002Flibmtl.readthedocs.io\u002Fen\u002Flatest\u002Fdocs\u002Fgetting_started\u002Fquick_start.html).\n\n## Citation\n\nIf you find ``LibMTL`` useful for your research or development, please cite the following:\n\n```latex\n@article{lin2023libmtl,\n  title={{LibMTL}: A {P}ython Library for Multi-Task Learning},\n  author={Baijiong Lin and Yu Zhang},\n  journal={Journal of Machine Learning Research},\n  volume={24},\n  number={209},\n  pages={1--7},\n  year={2023}\n}\n```\n\n## Contributor\n\n``LibMTL`` is developed and maintained by [Baijiong Lin](https:\u002F\u002Fbaijiong-lin.github.io).\n\n## Contact Us\n\nIf you have any question or suggestion, please feel free to contact us by [raising an issue](https:\u002F\u002Fgithub.com\u002Fmedian-research-group\u002FLibMTL\u002Fissues) or sending an email to ``bj.lin.email@gmail.com``.\n\n## Acknowledgements\n\nWe would like to thank the authors that release the public repositories (listed alphabetically):  [CAGrad](https:\u002F\u002Fgithub.com\u002FCranial-XIX\u002FCAGrad), [dselect_k_moe](https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fgoogle-research\u002Ftree\u002Fmaster\u002Fdselect_k_moe), [MultiObjectiveOptimization](https:\u002F\u002Fgithub.com\u002Fisl-org\u002FMultiObjectiveOptimization), [mtan](https:\u002F\u002Fgithub.com\u002Florenmt\u002Fmtan), [MTL](https:\u002F\u002Fgithub.com\u002FSamsungLabs\u002FMTL), [nash-mtl](https:\u002F\u002Fgithub.com\u002FAvivNavon\u002Fnash-mtl), [pytorch_geometric](https:\u002F\u002Fgithub.com\u002Fpyg-team\u002Fpytorch_geometric), and [xtreme](https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fxtreme).\n\n## License\n\n``LibMTL`` is released under the [MIT](.\u002FLICENSE) license.\n","# LibMTL\n\n[![Documentation Status](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmedian-research-group_LibMTL_readme_13d664e1afd7.png)](https:\u002F\u002Flibmtl.readthedocs.io\u002Fen\u002Flatest\u002F?badge=latest) [![License: MIT](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-MIT-blue.svg)](https:\u002F\u002Fgithub.com\u002Fmedian-research-group\u002FLibMTL\u002Fblob\u002Fmain\u002FLICENSE) [![PyPI version](https:\u002F\u002Fbadge.fury.io\u002Fpy\u002FLibMTL.svg)](https:\u002F\u002Fbadge.fury.io\u002Fpy\u002FLibMTL) [![Supported Python versions](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fpyversions\u002FLibMTL.svg?logo=python&logoColor=FFE873)](https:\u002F\u002Fgithub.com\u002Fmedian-research-group\u002FLibMTL) [![CodeFactor](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmedian-research-group_LibMTL_readme_9ee0cb95ac54.png)](https:\u002F\u002Fwww.codefactor.io\u002Frepository\u002Fgithub\u002Fmedian-research-group\u002Flibmtl\u002Foverview\u002Fmain) [![paper](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FAccepted%20by-JMLR-b31b1b.svg)](https:\u002F\u002Fwww.jmlr.org\u002Fpapers\u002Fv24\u002F22-0347.html) [![coverage](.\u002Ftests\u002Fcoverage.svg)](https:\u002F\u002Fgithub.com\u002Fmedian-research-group\u002FLibMTL) [![Hits](https:\u002F\u002Fhits.seeyoufarm.com\u002Fapi\u002Fcount\u002Fincr\u002Fbadge.svg?url=https%3A%2F%2Fgithub.com%2Fmedian-research-group%2FLibMTL&count_bg=%23763DC8&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=visitors&edge_flat=false)](https:\u002F\u002Fhits.seeyoufarm.com) [![Made With Love](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FMade%20With-Love-orange.svg)](https:\u002F\u002Fgithub.com\u002Fmedian-research-group\u002FLibMTL) \n\n``LibMTL`` 是一个基于 [PyTorch](https:\u002F\u002Fpytorch.org\u002F) 构建的开源多任务学习（MTL）库。有关详细介绍和 API 使用说明，请参阅 [最新文档](https:\u002F\u002Flibmtl.readthedocs.io\u002Fen\u002Flatest\u002F)。\n\n:star: 在 GitHub 上给我们点个赞吧——这对我们来说是很大的鼓励！\n\n:bangbang: 一篇关于 **基于梯度的多目标深度学习** 的全面综述现已在 [arXiv](https:\u002F\u002Farxiv.org\u002Fabs\u002F2501.10945) 上发布，同时还附带了一个 [精彩列表](https:\u002F\u002Fgithub.com\u002FBaijiong-Lin\u002FAwesome-Multi-Objective-Deep-Learning)。快来查看吧！\n\n## 新闻\n\n- **[2025年4月21日]** 增加了对 [UPGrad](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2406.16232) 的支持。\n- **[2025年2月18日]** 增加了对双层优化方法 [Auto-Lambda](https:\u002F\u002Fopenreview.net\u002Fforum?id=KKeCMim5VN)（TMLR 2022）的支持。\n- **[2025年2月17日]** 增加了对 [FAMO](https:\u002F\u002Fopenreview.net\u002Fforum?id=zMeemcUeXL)（NeurIPS 2023）、[SDMGrad](https:\u002F\u002Fopenreview.net\u002Fforum?id=4Ks8RPcXd9)（NeurIPS 2023）以及 [MoDo](https:\u002F\u002Fopenreview.net\u002Fforum?id=yPkbdJxQ0o)（NeurIPS 2023；JMLR 2024）的支持。\n- **[2025年2月6日]** 增加了对两种双层优化方法的支持：[MOML](https:\u002F\u002Fproceedings.neurips.cc\u002Fpaper\u002F2021\u002Fhash\u002Fb23975176653284f1f7356ba5539cfcb-Abstract.html)（NeurIPS 2021；AIJ 2024）、[FORUM](https:\u002F\u002Febooks.iospress.nl\u002Fdoi\u002F10.3233\u002FFAIA240793)（ECAI 2024）。\n- **[2024年9月19日]** 增加了对 [FairGrad](https:\u002F\u002Fopenreview.net\u002Fforum?id=KLmWRMg6nL)（ICML 2024）的支持。\n- **[2024年8月31日]** 增加了对 [ExcessMTL](https:\u002F\u002Fopenreview.net\u002Fforum?id=JzWFmMySpn)（ICML 2024）的支持。\n- **[2024年7月24日]** 增加了对 [STCH](https:\u002F\u002Fopenreview.net\u002Fforum?id=m4dO5L6eCp)（ICML 2024）的支持。\n- **[2024年2月8日]** 增加了对 [DB-MTL](https:\u002F\u002Farxiv.org\u002Fabs\u002F2308.12029) 的支持。\n- **[2023年8月16日]**：增加了对 [MoCo](https:\u002F\u002Fopenreview.net\u002Fforum?id=dLAYGdKTi2)（ICLR 2023）的支持。非常感谢作者 [@heshandevaka](https:\u002F\u002Fgithub.com\u002Fheshandevaka) 的帮助。\n- **[2023年7月11日]** 论文被 [JMLR](https:\u002F\u002Fjmlr.org\u002Fpapers\u002Fv24\u002F22-0347.html) 接受。\n- **[2023年6月19日]** 增加了对 [Aligned-MTL](https:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent\u002FCVPR2023\u002Fhtml\u002FSenushkin_Independent_Component_Alignment_for_Multi-Task_Learning_CVPR_2023_paper.html)（CVPR 2023）的支持。\n- **[2023年3月10日]**：新增了 [QM9](https:\u002F\u002Fgithub.com\u002Fmedian-research-group\u002FLibMTL\u002Ftree\u002Fmain\u002Fexamples\u002Fqm9) 和 [PAWS-X](https:\u002F\u002Fgithub.com\u002Fmedian-research-group\u002FLibMTL\u002Ftree\u002Fmain\u002Fexamples\u002Fxtreme) 示例。\n- **[2022年7月22日]**：增加了对 [Nash-MTL](https:\u002F\u002Fproceedings.mlr.press\u002Fv162\u002Fnavon22a\u002Fnavon22a.pdf)（ICML 2022）的支持。\n- **[2022年7月21日]**：增加了对 [Learning to Branch](http:\u002F\u002Fproceedings.mlr.press\u002Fv119\u002Fguo20e\u002Fguo20e.pdf)（ICML 2020）的支持。非常感谢 [@yuezhixiong](https:\u002F\u002Fgithub.com\u002Fyuezhixiong) 的贡献（[#14](https:\u002F\u002Fgithub.com\u002Fmedian-research-group\u002FLibMTL\u002Fpull\u002F14)）。\n- **[2022年3月29日]**：论文现已在 [arXiv](https:\u002F\u002Farxiv.org\u002Fabs\u002F2203.14338) 上发布。\n\n## 目录\n\n- [功能特性](#features)\n- [整体框架](#overall-framework)\n- [支持的算法](#supported-algorithms)\n- [支持的基准数据集](#supported-benchmark-datasets)\n- [安装指南](#installation)\n- [快速入门](#quick-start)\n  - [下载数据集](#download-dataset)\n  - [运行模型](#run-a-model)\n- [引用](#citation)\n- [贡献者](#contributor)\n- [联系我们](#contact-us)\n- [致谢](#acknowledgements)\n- [许可证](#license)\n\n## 功能特性\n\n- **统一性**：``LibMTL`` 提供了一个统一的代码库来实现多种多任务学习算法，并采用一致的评估流程，涵盖数据处理、指标计算和超参数设置等环节。该库支持多个具有代表性的多任务学习基准数据集，从而能够对不同算法进行定量、公平且一致的比较。\n- **全面性**：``LibMTL`` 支持众多最先进的多任务学习方法，包括8种架构和16种优化策略。同时，它还提供了对多个覆盖不同领域的基准数据集的公平比较。\n- **可扩展性**：``LibMTL`` 遵循模块化设计原则，允许用户灵活便捷地添加自定义组件或进行个性化修改。因此，借助 ``LibMTL`` 的支持，用户可以轻松快速地开发新的优化策略和架构，或将现有多任务学习算法应用于新的应用场景。\n\n## 整体框架\n\n![framework](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmedian-research-group_LibMTL_readme_5408c2e83b54.png)\n\n各模块的详细介绍请参见 [文档](https:\u002F\u002Flibmtl.readthedocs.io\u002Fen\u002Flatest\u002Fdocs\u002Fuser_guide\u002Fframework.html)。\n\n## 支持的算法\n\n目前，``LibMTL`` 支持以下算法：\n\n| 优化策略                                                                                                                                                                                           | 会议\u002F来源             | 参数选项                   |\n| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | --------------------------- |\n| 等权法 (EW)                                                                                                                                                                                              | -                  | ``--weighting EW``          |\n| 梯度归一化 ([GradNorm](http:\u002F\u002Fproceedings.mlr.press\u002Fv80\u002Fchen18a\u002Fchen18a.pdf))                                                                                                                         | ICML 2018          | ``--weighting GradNorm``    |\n| 不确定性权重法 ([UW](https:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_cvpr_2018\u002Fpapers\u002FKendall_Multi-Task_Learning_Using_CVPR_2018_paper.pdf))                                                                          | CVPR 2018          | ``--weighting UW``          |\n| [MGDA](https:\u002F\u002Fpapers.nips.cc\u002Fpaper\u002F2018\u002Fhash\u002F432aca3a1e345e339f35a30c8f65edce-Abstract.html) ([官方代码](https:\u002F\u002Fgithub.com\u002Fisl-org\u002FMultiObjectiveOptimization))                                            | NeurIPS 2018       | ``--weighting MGDA``        |\n| 动态权重平均法 ([DWA](https:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_CVPR_2019\u002Fpapers\u002FLiu_End-To-End_Multi-Task_Learning_With_Attention_CVPR_2019_paper.pdf)) ([官方代码](https:\u002F\u002Fgithub.com\u002Florenmt\u002Fmtan))   | CVPR 2019          | ``--weighting DWA``         |\n| 几何损失策略 ([GLS](https:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_CVPRW_2019\u002Fpapers\u002FWAD\u002FChennupati_MultiNet_Multi-Stream_Feature_Aggregation_and_Geometric_Loss_Strategy_for_Multi-Task_CVPRW_2019_paper.pdf)) | CVPR 2019研讨会    | ``--weighting GLS``         |\n| 冲突梯度投影法 ([PCGrad](https:\u002F\u002Fpapers.nips.cc\u002Fpaper\u002F2020\u002Fhash\u002F3fe78a8acf5fda99de95303940a2420c-Abstract.html))                                                                                 | NeurIPS 2020       | ``--weighting PCGrad``      |\n| 梯度符号丢弃法 ([GradDrop](https:\u002F\u002Fpapers.nips.cc\u002Fpaper\u002F2020\u002Fhash\u002F16002f7a455a94aa4e91cc34ebdb9f2d-Abstract.html))                                                                                         | NeurIPS 2020       | ``--weighting GradDrop``    |\n| 公平多任务学习法 ([IMTL](https:\u002F\u002Fopenreview.net\u002Fforum?id=IMPnRXEWpvr))                                                                                                                               | ICLR 2021          | ``--weighting IMTL``        |\n| 梯度疫苗法 ([GradVac](https:\u002F\u002Fopenreview.net\u002Fforum?id=F1vEjWK-lH_))                                                                                                                                         | ICLR 2021          | ``--weighting GradVac``     |\n| 冲突规避梯度下降法 ([CAGrad](https:\u002F\u002Fopenreview.net\u002Fforum?id=_61Qh8tULj_)）([官方代码](https:\u002F\u002Fgithub.com\u002FCranial-XIX\u002FCAGrad))                                                                 | NeurIPS 2021       | ``--weighting CAGrad``      |\n| [MOML](https:\u002F\u002Fproceedings.neurips.cc\u002Fpaper\u002F2021\u002Fhash\u002Fb23975176653284f1f7356ba5539cfcb-Abstract.html)                                                                                                             | NeurIPS 2021       | ``--weighting MOML``        |\n| [Nash-MTL](https:\u002F\u002Fproceedings.mlr.press\u002Fv162\u002Fnavon22a\u002Fnavon22a.pdf)（[官方代码](https:\u002F\u002Fgithub.com\u002FAvivNavon\u002Fnash-mtl)）                                                                                     | ICML 2022          | ``--weighting Nash_MTL``    |\n| 随机损失加权法 ([RLW](https:\u002F\u002Fopenreview.net\u002Fforum?id=jjtFD8A1Wx))                                                                                                                                         | TMLR 2022          | ``--weighting RLW``         |\n| [Auto-Lambda](https:\u002F\u002Fopenreview.net\u002Fforum?id=KKeCMim5VN) （[官方代码](https:\u002F\u002Fgithub.com\u002Florenmt\u002Fauto-lambda)）                                                                                               | TMLR 2022          | ``--weighting AutoLambda``  |\n| [MoCo](https:\u002F\u002Fopenreview.net\u002Fforum?id=dLAYGdKTi2)                                                                                                                                                                | ICLR 2023          | ``--weighting MoCo``        |\n| [Aligned-MTL](https:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent\u002FCVPR2023\u002Fhtml\u002FSenushkin_Independent_Component_Alignment_for_Multi-Task_Learning_CVPR_2023_paper.html)（[官方代码](https:\u002F\u002Fgithub.com\u002FSamsungLabs\u002FMTL)）   | CVPR 2023          | ``--weighting Aligned_MTL`` |\n| [FAMO](https:\u002F\u002Fopenreview.net\u002Fforum?id=zMeemcUeXL) （[官方代码](https:\u002F\u002Fgithub.com\u002FCranial-XIX\u002FFAMO)）                                                                                                         | NeurIPS 2023       | ``--weighting FAMO``        |\n| [SDMGrad](https:\u002F\u002Fopenreview.net\u002Fforum?id=4Ks8RPcXd9) （[官方代码](https:\u002F\u002Fgithub.com\u002FOptMN-Lab\u002Fsdmgrad)）                                                                                                     | NeurIPS 2023       | ``--weighting SDMGrad``     |\n| [MoDo](https:\u002F\u002Fopenreview.net\u002Fforum?id=yPkbdJxQ0o) （[官方代码](https:\u002F\u002Fgithub.com\u002Fheshandevaka\u002FTrade-Off-MOL)）                                                                                               | NeurIPS 2023       | ``--weighting MoDo``        |\n| [FORUM](https:\u002F\u002Febooks.iospress.nl\u002Fdoi\u002F10.3233\u002FFAIA240793)                                                                                                                                                        | ECAI 2024          | ``--weighting FORUM``       |\n| [STCH](https:\u002F\u002Fopenreview.net\u002Fforum?id=m4dO5L6eCp) （[官方代码](https:\u002F\u002Fgithub.com\u002FXi-L\u002FSTCH\u002Ftree\u002Fmain\u002FSTCH_MTL)）                                                                                             | ICML 2024          | ``--weighting STCH``        |\n| [ExcessMTL](https:\u002F\u002Fopenreview.net\u002Fforum?id=JzWFmMySpn) （[官方代码](https:\u002F\u002Fgithub.com\u002Fyifei-he\u002FExcessMTL\u002Fblob\u002Fmain\u002FLibMTL\u002FLibMTL\u002Fweighting\u002FExcessMTL.py)）                                                   | ICML 2024          | ``--weighting ExcessMTL``   |\n| [FairGrad](https:\u002F\u002Fopenreview.net\u002Fforum?id=KLmWRMg6nL) （[官方代码](https:\u002F\u002Fgithub.com\u002FOptMN-Lab\u002Ffairgrad)）                                                                                                   | ICML 2024          | ``--weighting FairGrad``    |\n| [DB-MTL](https:\u002F\u002Farxiv.org\u002Fabs\u002F2308.12029)                                                                                                                                                                        | arXiv              | ``--weighting DB_MTL``      |\n| [UPGrad](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2406.16232)（[官方代码](https:\u002F\u002Fgithub.com\u002FTorchJD\u002Ftorchjd)）                                                                                                                  | arXiv              | ``--weighting UPGrad``      |\n\n| 架构                                                                                                                                                                                                          | 会议          | 参数                      |\n| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------- | ------------------------------ |\n| 硬参数共享（[HPS](https:\u002F\u002Fdl.acm.org\u002Fdoi\u002F10.5555\u002F3091529.3091535)）                                                                                                                                         | ICML 1993       | ``--arch HPS``                 |\n| 十字绣网络（[Cross_stitch](https:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_cvpr_2016\u002Fpapers\u002FMisra_Cross-Stitch_Networks_for_CVPR_2016_paper.pdf)）                                                                     | CVPR 2016       | ``--arch Cross_stitch``        |\n| 多门混合专家模型（[MMoE](https:\u002F\u002Fdl.acm.org\u002Fdoi\u002F10.1145\u002F3219819.3220007)）                                                                                                                                 | KDD 2018        | ``--arch MMoE``                |\n| 多任务注意力网络（[MTAN](https:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_CVPR_2019\u002Fpapers\u002FLiu_End-To-End_Multi-Task_Learning_With_Attention_CVPR_2019_paper.pdf)）（[官方代码](https:\u002F\u002Fgithub.com\u002Florenmt\u002Fmtan)） | CVPR 2019       | ``--arch MTAN``                |\n| 自定义门控机制（[CGC](https:\u002F\u002Fdl.acm.org\u002Fdoi\u002F10.1145\u002F3383313.3412236)）、渐进式分层提取（[PLE](https:\u002F\u002Fdl.acm.org\u002Fdoi\u002F10.1145\u002F3383313.3412236)）                                                | ACM RecSys 2020 | ``--arch CGC``, ``--arch PLE`` |\n| 学习分支（[LTB](http:\u002F\u002Fproceedings.mlr.press\u002Fv119\u002Fguo20e\u002Fguo20e.pdf)）                                                                                                                                        | ICML 2020       | ``--arch LTB``                 |\n| [DSelect-k](https:\u002F\u002Fproceedings.neurips.cc\u002Fpaper\u002F2021\u002Fhash\u002Ff5ac21cd0ef1b88e9848571aeb53551a-Abstract.html)（[官方代码](https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fgoogle-research\u002Ftree\u002Fmaster\u002Fdselect_k_moe)）             | NeurIPS 2021    | ``--arch DSelect_k``           |\n\n\n\n## 支持的基准数据集\n\n| 数据集                                                                                    | 问题                      | 任务数量  | 任务                                                                      | 多输入 | 支持的主干网络   |\n|:------------------------------------------------------------------------------------------- |:-----------------------------:|:------------:|:--------------------------------------------------------------------------:|:-----------:|:--------------------:|\n| [NYUv2](https:\u002F\u002Fgithub.com\u002Fmedian-research-group\u002FLibMTL\u002Ftree\u002Fmain\u002Fexamples\u002Fnyu)             | 场景理解           | 3            | 语义分割+\u003Cbr\u002F>深度估计+\u003Cbr\u002F>表面法线预测 | ✘           | ResNet50\u002F\u003Cbr\u002F>SegNet |\n| [Cityscapes](https:\u002F\u002Fgithub.com\u002Fmedian-research-group\u002FLibMTL\u002Ftree\u002Fmain\u002Fexamples\u002Fcityscapes) | 场景理解           | 2            | 语义分割+\u003Cbr\u002F>深度估计                                | ✘           | ResNet50             |\n| [Office-31](https:\u002F\u002Fgithub.com\u002Fmedian-research-group\u002FLibMTL\u002Ftree\u002Fmain\u002Fexamples\u002Foffice)      | 图像识别             | 3            | 分类                                                             | ✓           | ResNet18             |\n| [Office-Home](https:\u002F\u002Fgithub.com\u002Fmedian-research-group\u002FLibMTL\u002Ftree\u002Fmain\u002Fexamples\u002Foffice)    | 图像识别             | 4            | 分类                                                             | ✓           | ResNet18             |\n| [QM9](https:\u002F\u002Fgithub.com\u002Fmedian-research-group\u002FLibMTL\u002Ftree\u002Fmain\u002Fexamples\u002Fqm9)               | 分子性质预测         | 11（默认） | 回归                                                                 | ✘           | GNN                  |\n| [PAWS-X](https:\u002F\u002Fgithub.com\u002Fmedian-research-group\u002FLibMTL\u002Ftree\u002Fmain\u002Fexamples\u002Fxtreme)         | 同义句识别           | 4（默认）  | 分类                                                             | ✓           | Bert                 |\n\n## 安装\n\n1. 创建虚拟环境\n   \n   ```shell\n   conda create -n libmtl python=3.10\n   conda activate libmtl\n   ```\n\n2. 克隆仓库\n   \n   ```shell\n   git clone https:\u002F\u002Fgithub.com\u002Fmedian-research-group\u002FLibMTL.git\n   ```\n\n3. 安装 `LibMTL`\n   \n   ```shell\n   pip install torch==2.3.0+cu121 torchvision==0.18.0+cu121 -f https:\u002F\u002Fdownload.pytorch.org\u002Fwhl\u002Ftorch_stable.html\n   pip install torch-scatter==2.1.2+pt23cu121 torch_sparse==0.6.18+pt23cu121 -f https:\u002F\u002Fpytorch-geometric.com\u002Fwhl\u002Ftorch-2.3.0+cu121.html\n   \n   cd LibMTL\n   pip install -r requirements.txt\n   pip install -e .\n   ```\n\n## 快速入门\n\n我们以 NYUv2 数据集为例，展示如何使用 ``LibMTL``。\n\n### 下载数据集\n\n我们使用的 NYUv2 数据集由 [mtan](https:\u002F\u002Fgithub.com\u002Florenmt\u002Fmtan) 预处理。您可以从 [这里](https:\u002F\u002Fwww.dropbox.com\u002Fsh\u002F86nssgwm6hm3vkb\u002FAACrnUQ4GxpdrBbLjb6n-mWNa?dl=0)下载该数据集。\n\n### 运行模型\n\nNYUv2 数据集的完整训练代码位于 [examples\u002Fnyu](.\u002Fexamples\u002Fnyu) 中。文件 [main.py](.\u002Fexamples\u002Fnyu\u002Fmain.py) 是在 NYUv2 数据集上进行训练的主文件。\n\n您可以通过运行以下命令查看命令行参数。\n\n```shell\npython main.py -h\n```\n\n例如，运行以下命令将在 NYUv2 数据集上训练一个使用 EW 和 HPS 的多任务学习模型。\n\n```shell\npython main.py --weighting EW --arch HPS --dataset_path \u002Fpath\u002Fto\u002Fnyuv2 --gpu_id 0 --scheduler step --mode train --save_path PATH\n```\n\n更多详细信息请参阅 [文档](https:\u002F\u002Flibmtl.readthedocs.io\u002Fen\u002Flatest\u002Fdocs\u002Fgetting_started\u002Fquick_start.html)。\n\n## 引用\n\n如果您发现 ``LibMTL`` 对您的研究或开发有所帮助，请引用以下内容：\n\n```latex\n@article{lin2023libmtl,\n  title={{LibMTL}: A {P}ython Library for Multi-Task Learning},\n  author={Baijiong Lin and Yu Zhang},\n  journal={Journal of Machine Learning Research},\n  volume={24},\n  number={209},\n  pages={1--7},\n  year={2023}\n}\n```\n\n## 贡献者\n\n``LibMTL`` 由 [Baijiong Lin](https:\u002F\u002Fbaijiong-lin.github.io) 开发并维护。\n\n## 联系我们\n\n如果您有任何问题或建议，请随时通过 [提交 issue](https:\u002F\u002Fgithub.com\u002Fmedian-research-group\u002FLibMTL\u002Fissues) 或发送邮件至 ``bj.lin.email@gmail.com`` 与我们联系。\n\n## 致谢\n\n我们谨向以下公开仓库的作者表示感谢（按字母顺序排列）：[CAGrad](https:\u002F\u002Fgithub.com\u002FCranial-XIX\u002FCAGrad)、[dselect_k_moe](https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fgoogle-research\u002Ftree\u002Fmaster\u002Fdselect_k_moe)、[MultiObjectiveOptimization](https:\u002F\u002Fgithub.com\u002Fisl-org\u002FMultiObjectiveOptimization)、[mtan](https:\u002F\u002Fgithub.com\u002Florenmt\u002Fmtan)、[MTL](https:\u002F\u002Fgithub.com\u002FSamsungLabs\u002FMTL)、[nash-mtl](https:\u002F\u002Fgithub.com\u002FAvivNavon\u002Fnash-mtl)、[pytorch_geometric](https:\u002F\u002Fgithub.com\u002Fpyg-team\u002Fpytorch_geometric) 和 [xtreme](https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fxtreme)。\n\n## 许可证\n\n``LibMTL`` 采用 [MIT](.\u002FLICENSE) 许可证发布。","# LibMTL 快速上手指南\n\nLibMTL 是一个基于 PyTorch 构建的开源多任务学习（Multi-Task Learning, MTL）库。它提供了统一的代码库和评估流程，支持多种主流 MTL 算法和数据集，旨在帮助开发者公平、一致地比较和复现不同的多任务学习策略。\n\n## 环境准备\n\n在开始之前，请确保您的开发环境满足以下要求：\n\n*   **操作系统**：Linux, macOS, 或 Windows\n*   **Python 版本**：3.8 - 3.11 (推荐 3.9+)\n*   **核心依赖**：\n    *   [PyTorch](https:\u002F\u002Fpytorch.org\u002F) (版本需与您的 CUDA 环境匹配)\n    *   `numpy`, `scipy`, `pandas` 等基础科学计算库\n\n> **提示**：建议先安装好 PyTorch，LibMTL 会自动检测并适配已安装的 PyTorch 版本。\n\n## 安装步骤\n\n您可以通过 PyPI 直接安装稳定版，或从 GitHub 安装最新开发版。国内用户推荐使用清华或阿里镜像源以加速下载。\n\n### 方式一：通过 PyPI 安装（推荐）\n\n```bash\n# 使用默认源\npip install LibMTL\n\n# 或使用国内镜像源（推荐中国开发者）\npip install LibMTL -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n```\n\n### 方式二：从源码安装（获取最新功能）\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fmedian-research-group\u002FLibMTL.git\ncd LibMTL\npip install -e . -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n```\n\n## 基本使用\n\nLibMTL 的设计遵循模块化原则，最简单的使用方式是通过命令行运行内置的示例脚本。以下以经典的 **NYUv2** 数据集和 **GradNorm** 算法为例。\n\n### 1. 下载数据集\n\nLibMTL 提供了自动下载脚本。首次运行时，数据将被下载到本地缓存目录。\n\n```bash\npython examples\u002Fnyu\u002Fmain.py --data_path .\u002Fdata\u002Fnyu --download\n```\n\n### 2. 运行模型\n\n使用 `--weighting` 参数指定多任务优化策略。例如，运行 **GradNorm** 算法：\n\n```bash\npython examples\u002Fnyu\u002Fmain.py \\\n    --data_path .\u002Fdata\u002Fnyu \\\n    --weighting GradNorm \\\n    --gpu_id 0 \\\n    --seed 0\n```\n\n**参数说明：**\n*   `--data_path`: 数据集存放路径。\n*   `--weighting`: 选择优化策略（如 `EW`, `GradNorm`, `PCGrad`, `Nash_MTL` 等，完整列表见官方文档）。\n*   `--gpu_id`: 指定使用的 GPU 编号。\n*   `--seed`: 随机种子，确保结果可复现。\n\n### 3. 自定义开发\n\n若需修改网络结构或添加新算法，LibMTL 允许您通过继承基类轻松扩展。以下是一个极简的代码调用示例：\n\n```python\nfrom LibMTL import Trainer\nfrom LibMTL.weighting import GradNorm\n\n# 配置参数\nargs = {\n    'weighting': 'GradNorm',\n    'data_path': '.\u002Fdata\u002Fnyu',\n    'gpu_id': 0,\n    # ... 其他参数\n}\n\n# 初始化并训练\ntrainer = Trainer(args)\ntrainer.train()\n```\n\n更多高级用法、支持的算法列表及 API 详情，请参阅 [LibMTL 官方文档](https:\u002F\u002Flibmtl.readthedocs.io\u002F)。","某自动驾驶感知团队正在开发一个端到端模型，需要同时完成道路分割、车辆检测和深度估计三个任务，以优化车载芯片的推理效率。\n\n### 没有 LibMTL 时\n- **算法复现成本极高**：团队成员需手动阅读 Nash-MTL 或 GradNorm 等论文的数学公式，从零编写复杂的梯度调整逻辑，极易引入隐蔽的 Bug。\n- **任务平衡难以调优**：不同任务的损失函数量级差异巨大，人工调整权重系数如同“大海捞针”，常导致模型偏向简单任务而忽略关键的小目标检测。\n- **实验对比混乱低效**：缺乏统一框架，每次切换多任务优化算法都需要重构代码结构，难以在相同基准下公平对比不同策略的效果。\n- **维护与扩展困难**：随着新算法（如 FairGrad 或 Auto-Lambda）的涌现，旧代码耦合度高，集成新方法往往需要推倒重来。\n\n### 使用 LibMTL 后\n- **开箱即用的算法库**：直接调用 LibMTL 内置的数十种 SOTA 算法（如 UPGrad、FAMO），仅需修改一行配置即可切换策略，将数周的复现工作缩短至几分钟。\n- **智能梯度协调机制**：利用库中成熟的梯度博弈与动态加权机制，自动平衡分割、检测与深度估计的训练节奏，显著提升了整体模型的收敛速度和精度上限。\n- **标准化的评估体系**：基于统一的 API 接口和预置数据集（如 Cityscapes），团队能快速生成多维度的性能报表，清晰量化各算法的实际收益。\n- **灵活的前沿探索**：紧跟社区更新，轻松集成最新的双层优化或公平性约束算法，让团队始终保持在多任务学习技术的最前沿。\n\nLibMTL 将研究人员从繁琐的底层梯度操作中解放出来，使其能专注于架构设计与业务场景创新，大幅降低了多任务学习的落地门槛。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmedian-research-group_LibMTL_e2555495.png","median-research-group",null,"https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fmedian-research-group_d75d5c94.png","https:\u002F\u002Fgithub.com\u002Fmedian-research-group",[77],{"name":78,"color":79,"percentage":80},"Python","#3572A5",100,2535,232,"2026-04-06T00:09:44","MIT","未说明","需要 NVIDIA GPU（基于 PyTorch），具体型号、显存大小及 CUDA 版本未说明",{"notes":88,"python":89,"dependencies":90},"该工具是基于 PyTorch 构建的多任务学习（MTL）开源库。README 中未详细列出具体的系统依赖版本或硬件最低要求，实际运行环境需根据所选的具体算法（如 GradNorm, PCGrad 等）和数据集（如 QM9, PAWS-X）的规模进行调整。建议参考官方文档获取详细的安装指南。","3.8+",[91,92,93],"torch","numpy","scikit-learn",[14],[96,97,98,99,100,101,102,103,104,105,106],"multitask-learning","multi-task-learning","pytorch","python","multi-domain-learning","deep-learning","mtl","mmoe","ple","multiobjective-optimization","multi-objective-optimization","2026-03-27T02:49:30.150509","2026-04-06T22:02:10.229489",[110,115,120,125,130,135,140],{"id":111,"question_zh":112,"answer_zh":113,"source_url":114},20212,"为什么 CAGrad 和 MoCo 方法在训练时会产生完全相同的结果？","这通常是由不同 PyTorch 版本中 `zero_grad()` 函数的 `set_to_none` 默认值不同导致的 Bug。在 Torch 2.x 中默认为 `True`，而在 Torch 1.8.1 中为 `False`。如果梯度被设为 None，框架中重置骨干网络\u002F编码器梯度的逻辑会失败，导致只有解码器参数被更新，而编码器参数未更新。建议检查 PyTorch 版本兼容性或手动处理梯度清零逻辑。","https:\u002F\u002Fgithub.com\u002Fmedian-research-group\u002FLibMTL\u002Fissues\u002F56",{"id":116,"question_zh":117,"answer_zh":118,"source_url":119},20213,"运行 trainer 时报错 'dict_keyiterator' object has no attribute 'next' 如何解决？","这是因为 Python 3 中字典迭代器不再支持 `.next()` 方法。请将代码中的 `.next()` 替换为内置函数 `next()`，例如将 `a.next()` 修改为 `next(a)`。此问题常见于从 Python 2 迁移到 Python 3 或使用较新 Python 版本运行旧代码时。","https:\u002F\u002Fgithub.com\u002Fmedian-research-group\u002FLibMTL\u002Fissues\u002F19",{"id":121,"question_zh":122,"answer_zh":123,"source_url":124},20214,"为什么不同的加权方法（如 GradDrop, PCGrad, CAGrad）对 rep_grad 参数有 True\u002FFalse 的限制？","不同算法基于其数学原理对梯度处理方式有不同要求。例如，GradDrop 必须设置 `rep_grad=True`，而 PCGrad、GradVac 和 CAGrad 通常要求 `rep_grad=False`。如果在不适用的场景下强行开启（如在 CAGrad 中设置 `rep_grad=True`），可能导致权重优化失效（例如所有任务权重均变为平均值 0.2），无法达到预期的多任务优化效果。请严格遵循各方法文档的参数限制。","https:\u002F\u002Fgithub.com\u002Fmedian-research-group\u002FLibMTL\u002Fissues\u002F49",{"id":126,"question_zh":127,"answer_zh":128,"source_url":129},20215,"如何在图神经网络（GNN）中应用多任务学习（MTL）？","可以在 GNN 上应用多任务学习。通常做法是共享图层的编码器\u002F解码器。你需要定义多个损失函数（可以是分类和回归损失的混合），然后通过求和或使用加权技术（如 GradNorm）来处理这些损失。如果是回归任务，建议先将所有特征缩放到同一尺度（如均值 0 标准差 1，或归一化到 0-100），这样可能就不需要复杂的损失加权了。","https:\u002F\u002Fgithub.com\u002Fmedian-research-group\u002FLibMTL\u002Fissues\u002F24",{"id":131,"question_zh":132,"answer_zh":133,"source_url":134},20216,"MGDA 方法中的 rep_tasks 和 rep_grad 变量具体代表什么？","`rep_tasks` 指的是由共享参数层生成的表示（representation）；`rep_grad` 是一个布尔标志，用于指示是否使用这些表示的梯度。在 MGDA 实现中，设置 `rep_grad` 的目的是为了实施 MGDA-UB（Upper Bound）策略，它会在 `_compute_grad()` 函数中保存共享层的梯度。需要注意的是，在某些实现中可能只反向传播到表示层而不更新解码器梯度，具体需参考源码确认梯度流向。","https:\u002F\u002Fgithub.com\u002Fmedian-research-group\u002FLibMTL\u002Fissues\u002F22",{"id":136,"question_zh":137,"answer_zh":138,"source_url":139},20217,"当前的多任务优化方法（如 GLS, MTAN）在实际应用中真的有效吗？","效果取决于具体数据集和任务。实验表明，某些方法（如 GLS）在部分数据集上表现良好，但在其他数据集上可能提升有限甚至不如简单的超参数网格搜索。对于类似 YOLOP 的硬参数共享架构，若要在不显著增加计算量（FLOPS）的基础上改进，可以尝试引入特定的优化策略，但需注意没有一种通用的优化方法能在所有场景下都优于基准。建议结合具体任务进行消融实验。","https:\u002F\u002Fgithub.com\u002Fmedian-research-group\u002FLibMTL\u002Fissues\u002F43",{"id":141,"question_zh":142,"answer_zh":143,"source_url":144},20218,"在多任务学习中，如何处理每一层依赖前层参数的 Loss 计算及参数共享选择？","当第 i 层的 Loss 依赖于前 i-1 层参数时，参数共享策略需谨慎选择。关于初始化，若涉及损失缩放因子（loss_scale），将其初始化为 `log(1\u002F2)` 可以使初始权重 `1\u002F(2*loss_scale.exp())` 接近 1，这是一种常见的稳定训练的技巧。具体的共享参数选择应确保梯度能够正确回传至依赖的每一层，避免梯度切断。","https:\u002F\u002Fgithub.com\u002Fmedian-research-group\u002FLibMTL\u002Fissues\u002F86",[]]