MIT License

项目介绍

tum-pbs/ConFIG 是一个托管在 GitHub 上的开源项目,主要使用 Python 编写,采用 MIT License 许可证,目前获得 125 个 Star、10 次 Fork。

仓库全名
tum-pbs/ConFIG
开源许可证
MIT License
Star 数
125
Fork 数
10
未关闭 Issue
2

README 摘要

Official implementation of Conflict-Free Inverse Gradients Method [ICLR2025 Spotlight] Towards Conflict-free Training for Everything and Everyone! [ 📄 Research Paper ]•[ 📖 Documentation & Examples ] News Recently, the ConFIG method has also been applied to train physics-constrained generative models: Flow Matching Meets PDEs: A Unified Framework for Physics-Constrained Generation, Giacomo Baldan, Qiang Liu,…

完整内容见 GitHub 原始 README 或本页 。

常见问题

ConFIG 用什么语言开发?

主要使用 Python 编写,采用 MIT License 许可证,目前有 125 个 Star。

ConFIG 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 ConFIG 的源码?

可以直接克隆仓库:git clone https://github.com/tum-pbs/ConFIG.git,默认分支为 main;安装与运行步骤见仓库 README。

ConFIG 最近还在维护吗?

仓库最近一次更新为 6月1日,当前有 2 个未关闭 Issue;Star 数为 125,可作为社区活跃度的参考。

关于

[ICLR2025 Spotlight] Official implementation of Conflict-Free Inverse Gradients Method

描述取自 GitHub 官方 API,中文内容由 GitRead 中文社区 编辑团队整理。

简要分析

热度分
148
价值分
78
活跃状态
活跃

语言占比

HTML
Python
Shell

Release

贡献者

README

Official implementation of Conflict-Free Inverse Gradients Method [ICLR2025 Spotlight]
Towards Conflict-free Training for Everything and Everyone!

[📄 Research Paper]•[📖 Documentation & Examples]

News

Recently, the ConFIG method has also been applied to train physics-constrained generative models:

  • Flow Matching Meets PDEs: A Unified Framework for Physics-Constrained Generation, Giacomo Baldan, Qiang Liu, Alberto Guardone, Nils Thuerey, https://arxiv.org/abs/2506.08604

  • Guiding diffusion models to reconstruct flow fields from sparse data, Marc Amorós-Trepat, Luis Medrano-Navarro, Qiang Liu, Luca Guastoni, Nils Thuerey, https://arxiv.org/abs/2506.11908

About

  • What is the ConFIG method?

​ The conFIG method is a generic method for optimization problems involving multiple loss terms (e.g., Multi-task Learning, Continuous Learning, and Physics Informed Neural Networks). It prevents the optimization from getting stuck into a local minimum of a specific loss term due to the conflict between losses. On the contrary, it leads the optimization to the shared minimum of all losses by providing a conflict-free update direction.

  • How does the ConFIG work?

​ The ConFIG method obtains the conflict-free direction by calculating the inverse of the loss-specific gradients matrix:

\boldsymbol{g}_{ConFIG}=\left(\sum_{i=1}^{m} \boldsymbol{g}_{i}^\top\boldsymbol{g}_{u}\right)\boldsymbol{g}_u,
\boldsymbol{g}_u = \mathcal{U}\left[
[\mathcal{U}(\boldsymbol{g}_1),\mathcal{U}(\boldsymbol{g}_2),\cdots, \mathcal{U}(\boldsymbol{g}_m)]^{-\top} \mathbf{1}_m\right].

Then the dot product between $\boldsymbol{g}_{ConFIG}$ and each loss-specific gradient is always positive and equal, i.e., $\boldsymbol{g}_{i}^{\top}\boldsymbol{g}_{ConFIG}=\boldsymbol{g}_{j}^{\top}\boldsymbol{g}_{ConFIG}> 0 \quad \forall i,j \in [1,m]$​.

  • Is the ConFIG computationally expensive?

​ Like many other gradient-based methods, ConFIG needs to calculate each loss’s gradient in every optimization iteration, which could be computationally expensive when the number of losses increases. However, we also introduce a momentum-based method where we can reduce the computational cost close to or even lower than a standard optimization procedure with a slight degeneration in accuracy. This momentum-based method is also applicable to other gradient-based methods.

Paper Info

ConFIG: Towards Conflict-free Training of Physics Informed Neural Networks
Qiang Liu, Mengyu Chu, and Nils Thuerey
Technical University of Munich Peking University

Abstract: The loss functions of many learning problems contain multiple additive terms that can disagree and yield conflicting update directions. For Physics-Informed Neural Networks (PINNs), loss terms on initial/boundary conditions and physics equations are particularly interesting as they are well-established as highly difficult tasks. To improve learning the challenging multi-objective task posed by PINNs, we propose the ConFIG method, which provides conflict-free updates by ensuring a positive dot product between the final update and each loss-specific gradient. It also maintains consistent optimization rates for all loss terms and dynamically adjusts gradient magnitudes based on conflict levels. We additionally leverage momentum to accelerate optimizations by alternating the back-propagation of different loss terms. The proposed method is evaluated across a range of challenging PINN scenarios, consistently showing superior performance and runtime compared to baseline methods. We also test the proposed method in a classic multi-task benchmark, where the ConFIG method likewise exhibits a highly promising performance.

Read from: [Arxiv]

Cite as:

@inproceedings{Liu2024ConFIG,
  author = {Qiang Liu and Mengyu Chu and Nils Thuerey},
  title = {ConFIG: Towards Conflict-free Training of Physics Informed Neural Networks},
  booktitle = {The Thirteenth International Conference on Learning Representations},
  year={2024},
  url={https://arxiv.org/abs/2408.11104},
}

Installation

  • Install through pip: pip install conflictfree
  • Install from repository online: pip install git+https://github.com/tum-pbs/ConFIG
  • Install from repository offline: Download the repository and run pip install . or install.sh in terminal.
  • Install from released wheel: Download the wheel and run pip install conflictfree-x.x.x-py3-none-any.whl in terminal.

Usage

For a muti-loss optimization, you can simply use ConFIG method as follows:

Without ConFIG:

optimizer=torch.Adam(network.parameters(),lr=1e-3)
for input_i in dataset:
    losses=[]
    optimizer.zero_grad()
    for loss_fn in loss_fns:
        losses.append(loss_fn(network,input_i))
    torch.cat(losses).sum().backward()
    optimizer.step()

With ConFIG:

from conflictfree.grad_operator import ConFIG_update
from conflictfree.utils import get_gradient_vector,apply_gradient_vector
optimizer=torch.Adam(network.parameters(),lr=1e-3)
for input_i in dataset:
    grads=[]
    for loss_fn in loss_fns:
    	optimizer.zero_grad()
    	loss_i=loss_fn(input_i)
        loss_i.backward()
        grads.append(get_gradient_vector(network)) #get loss-specfic gradient
    g_config=ConFIG_update(grads) # calculate the conflict-free direction
    apply_gradient_vector(network,g_config) # set the conflict-free direction to the network
    optimizer.step()

More details and examples can be found in our doc page.

To reproduce the result in our paper, please check the experiments folder.

Additional Info

This project is part of the physics-based deep learning topic in Physics-based Simulation group at TUM.

评论

暂无评论