Skip to content

Add E0 re-estimation and LoRA improvements#1297

Merged
ilyes319 merged 26 commits intoACEsuit:developfrom
vue1999:merge-lora-weights
Feb 10, 2026
Merged

Add E0 re-estimation and LoRA improvements#1297
ilyes319 merged 26 commits intoACEsuit:developfrom
vue1999:merge-lora-weights

Conversation

@ttompa
Copy link
Copy Markdown
Contributor

@ttompa ttompa commented Dec 1, 2025

Add LoRA weight merging and improved E0 estimation for fine-tuning

This PR introduces two main improvements for model fine-tuning:

  1. LoRA weight merging: After training with LoRA adapters, the learned weights are now automatically merged back into the base model weights before saving. This produces a standard model file without unnecessary overhead.

  2. Enhanced E0 estimation: Added a new --E0s="estimated" option for fine-tuning foundation models. Instead of simple averaging, this estimates atomic reference energies by:

    • Running the foundation model on all training configurations
    • Computing prediction errors (reference - predicted energies)
    • Solving a least-squares system to find optimal E0 corrections for each element

    This approach provides a better estimate for the E0s compared to the existing "average" method when isolated energies are not available.

Additional changes include LoRA delta caching in eval mode for faster training and additional unit tests.

@ttompa ttompa marked this pull request as ready for review December 1, 2025 21:34
@ttompa ttompa marked this pull request as draft December 1, 2025 21:35
@vue1999 vue1999 changed the title Merge LoRA weights back into base model Add E0 re-estimation and LoRA improvements Feb 6, 2026
@ttompa ttompa marked this pull request as ready for review February 6, 2026 00:06
@ilyes319
Copy link
Copy Markdown
Contributor

ilyes319 commented Feb 6, 2026

hey @ttompa thx for that! could you move the lora_tools.py to the modules folder. The philosophy is that heavy pytorch codes that changes things in the model belongs to the modules folder and the tools are more python or less model architecture code.

@ilyes319 ilyes319 merged commit 959920b into ACEsuit:develop Feb 10, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants