Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: en
|
| 3 |
+
license: mit
|
| 4 |
+
tags:
|
| 5 |
+
- continual-learning
|
| 6 |
+
- task-arithmetic
|
| 7 |
+
- kfac
|
| 8 |
+
- clip
|
| 9 |
+
- mammoth
|
| 10 |
+
pipeline_tag: image-classification
|
| 11 |
+
library_name: mammoth
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# TAK
|
| 15 |
+
|
| 16 |
+
This repository hosts artifacts for **TAK** in Mammoth (`--model tak`).
|
| 17 |
+
|
| 18 |
+
TAK v2 applies Task Arithmetic in a continual-learning setup and regularizes task-vector interactions with a **dataless** approximation based on **Kronecker-Factored Approximate Curvature (KFAC)** to reduce representation drift and interference.
|
| 19 |
+
|
| 20 |
+
## Paper
|
| 21 |
+
|
| 22 |
+
- **Title**: Dataless Weight Disentanglement in Task Arithmetic via Kronecker-Factored Approximate Curvature
|
| 23 |
+
- **Venue**: ICLR 2026
|
| 24 |
+
- **arXiv**: https://arxiv.org/abs/2602.17385
|
| 25 |
+
|
| 26 |
+
## What is stored here
|
| 27 |
+
|
| 28 |
+
This repository is intended to store artifacts needed to reproduce or run TAK v2, such as:
|
| 29 |
+
|
| 30 |
+
- Fisher/KFAC cache files,
|
| 31 |
+
- task vectors,
|
| 32 |
+
- classifier heads and metadata,
|
| 33 |
+
- optional checkpoints and run notes.
|
| 34 |
+
|
| 35 |
+
For Fisher loading via Mammoth, keep naming consistent with the loader expectations, e.g.:
|
| 36 |
+
|
| 37 |
+
- `<dataset>_task_<task_id>_aaT.pt`
|
| 38 |
+
- `<dataset>_task_<task_id>_ggT.pt`
|
| 39 |
+
- `<dataset>_task_<task_id>_ffT.pt`
|
| 40 |
+
- `<dataset>_task_<task_id>_num_aaT.pt`
|
| 41 |
+
- `<dataset>_task_<task_id>_num_ggT.pt`
|
| 42 |
+
|
| 43 |
+
## How to use with Mammoth
|
| 44 |
+
|
| 45 |
+
Example command with Fisher cache hosted on this repo:
|
| 46 |
+
|
| 47 |
+
```bash
|
| 48 |
+
uv run python main.py \
|
| 49 |
+
--model tak \
|
| 50 |
+
--dataset=seq-8visio \
|
| 51 |
+
--load_fisher 1 \
|
| 52 |
+
--fisher_cache hf://aimagelab-ta/TAK/vitb16/fisher_8vision/kfac/mc_full@main \
|
| 53 |
+
--alpha_merging 8.0 \
|
| 54 |
+
--batch_size 32 --virtual_bs_n 4
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
If you need to upload artifacts from local storage:
|
| 58 |
+
|
| 59 |
+
```bash
|
| 60 |
+
uv run python scripts/upload_to_hf.py \
|
| 61 |
+
--repo-id aimagelab-ta/TAK \
|
| 62 |
+
--repo-type model \
|
| 63 |
+
--local-dir /path/to/local/fisher \
|
| 64 |
+
--remote-dir fisher \
|
| 65 |
+
--pattern "**/*"
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
## Method overview
|
| 69 |
+
|
| 70 |
+
- Continual adaptation is built from per-task deltas (task vectors).
|
| 71 |
+
- During/after task training, KFAC statistics are used to approximate curvature terms for drift-aware regularization.
|
| 72 |
+
- At inference, merged vectors are applied over the visual backbone under the selected merging strategy.
|
| 73 |
+
|
| 74 |
+
## Limitations
|
| 75 |
+
|
| 76 |
+
- Artifact compatibility depends on matching dataset split/order and preprocessing assumptions.
|
| 77 |
+
- Fisher files are backend- and run-dependent; mixing incompatible runs can degrade results.
|
| 78 |
+
- This repository may contain research artifacts, not production-hardened models.
|
| 79 |
+
|
| 80 |
+
## Citation
|
| 81 |
+
|
| 82 |
+
```bibtex
|
| 83 |
+
@inproceedings{porrello2026dataless,
|
| 84 |
+
title={Dataless Weight Disentanglement in Task Arithmetic via Kronecker-Factored Approximate Curvature},
|
| 85 |
+
author={Porrello, Angelo and Buzzega, Pietro and Dangel, Felix and Sommariva, Thomas and Salami, Riccardo and Bonicelli, Lorenzo and Calderara, Simone},
|
| 86 |
+
booktitle={International Conference on Learning Representations (ICLR)},
|
| 87 |
+
year={2026}
|
| 88 |
+
}
|
| 89 |
+
```
|
| 90 |
+
|
| 91 |
+
## Resources
|
| 92 |
+
|
| 93 |
+
- Mammoth framework: https://github.com/aimagelab/mammoth
|
| 94 |
+
- TAK v2 implementation: `models/tak.py`
|