[NeurIPS 2024] Mitigating Object Hallucination via Concentric Causal Attention
Python
69
104 commits
updated Aug 30, 2025
pope, chair, amber for hallucination, and mmstar, gqa, seed, vizwiz_vqa, scienceqa for general LVLM multiple-choice questions. Please refer to this doc for details.
conda create -n cca-llava python=3.10 -y
conda activate cca-llava
pip install --upgrade pip # enable PEP 660 support
pip install torch==2.1.1 torchvision==0.16.1 torchaudio==2.1.1 --index-url https://download.pytorch.org/whl/cu121
pip install -e .
pip install -e ".[train]"
pip install triton==2.1.0 pynvml==11.5.0 --upgrade
pip install flash-attn==2.5.8 --no-build-isolation --no-cache-dir
Please refer to Data.md for preparation of training data.
CCA-LLaVA training pipeline follows LLaVA-1.5. The training consists of two stages:
bash scripts/v1_5/pretrain.cca-llava-1.5-7b.sh
bash scripts/v1_5/finetune.cca-llava-1.5-7b.sh
Please refer to Eval.md for details.
The two core modifications concentric positions and concentric causal masking can be found in llava/cca_utils folder. To replace default causal scheme with our proposed cca, you can prepend following code to either training or evaluation code, subject to your own use case.
import transformers
from llava.cca_utils.cca import llamaforcausallm_forward, cca_forward
transformers.models.llama.LlamaForCausalLM.forward = llamaforcausallm_forward
transformers.models.llama.LlamaModel.forward = cca_forward
@article{xing2024mitigating,
title={Mitigating Object Hallucination via Concentric Causal Attention},
author={Xing, Yun and Li, Yiheng and Laptev, Ivan and Lu, Shijian},
journal={arXiv preprint arXiv:2410.15926},
year={2024}
}
Thanks for their wonderful work!
Python
90.4%
Jupyter Notebook
7.9%
Shell
1.0%
[NeurIPS 2024] Mitigating Object Hallucination via Concentric Causal Attention
Python
69
104 commits
updated Aug 30, 2025
pope, chair, amber for hallucination, and mmstar, gqa, seed, vizwiz_vqa, scienceqa for general LVLM multiple-choice questions. Please refer to this doc for details.
conda create -n cca-llava python=3.10 -y
conda activate cca-llava
pip install --upgrade pip # enable PEP 660 support
pip install torch==2.1.1 torchvision==0.16.1 torchaudio==2.1.1 --index-url https://download.pytorch.org/whl/cu121
pip install -e .
pip install -e ".[train]"
pip install triton==2.1.0 pynvml==11.5.0 --upgrade
pip install flash-attn==2.5.8 --no-build-isolation --no-cache-dir
Please refer to Data.md for preparation of training data.
CCA-LLaVA training pipeline follows LLaVA-1.5. The training consists of two stages:
bash scripts/v1_5/pretrain.cca-llava-1.5-7b.sh
bash scripts/v1_5/finetune.cca-llava-1.5-7b.sh
Please refer to Eval.md for details.
The two core modifications concentric positions and concentric causal masking can be found in llava/cca_utils folder. To replace default causal scheme with our proposed cca, you can prepend following code to either training or evaluation code, subject to your own use case.
import transformers
from llava.cca_utils.cca import llamaforcausallm_forward, cca_forward
transformers.models.llama.LlamaForCausalLM.forward = llamaforcausallm_forward
transformers.models.llama.LlamaModel.forward = cca_forward
@article{xing2024mitigating,
title={Mitigating Object Hallucination via Concentric Causal Attention},
author={Xing, Yun and Li, Yiheng and Laptev, Ivan and Lu, Shijian},
journal={arXiv preprint arXiv:2410.15926},
year={2024}
}
Thanks for their wonderful work!
Python
90.4%
Jupyter Notebook
7.9%
Shell
1.0%