Skip to content

sprintml/MultiMem

Repository files navigation

MultiMem: Measuring and Mitigating Memorization in Multimodal Models

Keywords: Memorization, Multi-modal, Vision-language-text models

TL;DR: We propose a metric to quantify memorization in multi-modal models, study their memorization behavior, and propose novel mitigation strategies.

Abstract: Memorization in machine learning models enables robust performance on rare in-distribution samples by capturing atypical patterns, however, it simultaneously harms generalization by retaining knowledge about mislabeled or outlier data points. Although memorization has been extensively studied in supervised and self-supervised paradigms, both in the vision domain, it remains unexplored in multi-modal models. We address this gap by introducing MultiMem, a novel metric to quantify memorization in multi-modal models. Through systematic analysis, we demonstrate that cross-modal mislabeling has the strongest influence on memorization, with text emerging as the dominant modality, followed by video, image, and audio. To alleviate the problem of memorization in multi-modal models, we show that targeted augmentation across all modalities not only reduces memorization but also improves model performance. Our findings provide the first framework for diagnosing and mitigating memorization in multi-modal models, contributing to less overfitting and higher-performing models.


Description of the code
The code mainly contains files below

Working under environment of requirements_dino.txt: 
1.	DINO_train.py (with file folder 'DINO')
	This file will train the DINO model based on ViT-Base with COCO Dataset. Please first install the requirements_Dino.txt and then download COCO dataset. Then make sure the DINO_train.py is in same folder with the model files in DINO folder. Finally, modify the 	datapath, savingpath and other parameters according to your device and experiment needs. The output is the trained model without checkpoint (add checkpoint saving if you needed!)

2.	VIT_sl.py
	This file will train the ViT-Base model with a supervised multi-label classifier (one full connection layer) on COCO Dataset. Please first 	install the requirements_Dino.txt and then download Coco Dataset for Multi-label Image Classification (you can download it here: https://www.kaggle.com/datasets/shubham2703/coco-dataset-for-multi-label-image-classification/data) . Then modify the datapath, 	savingpath and other parameters according to your device and experiment needs. The output is the trained model without checkpoint 	(add checkpoint saving if you needed!)

Working under environment of requirements.txt:
1.	Multimem.py
	This file will calculate the Multimem for multi-modal model. Then modify the datapath, savingpath and other 	parameters according to 	your device and experiment needs. The output is a .mat file with all Multimem results. 

2.	avtclip_model.py & weight_ini.py
	These two Python files define the architecture and initialization parameters of our custom-built AVT-CLIP model. In all experiments, 	he paired models f and g re trained from the same initialization to ensure the reliability and consistency of the results.

3.	clip_train.py
	This file will train the clip model with COCO Dataset. Please download COCO dataset. Then modify the datapath, savingpath and 	other parameters according to your device and experiment needs. The output is the trained model 	ithout checkpoint (add checkpoint saving if you needed!)

4.	avtclip_train.py
	This file will train the AVTCLIP model on MSRVTT dataset. Please download MSRVTT dataset. Then modify the datapath, savingpath	and other parameters according to your device and experiment needs. The output is the trained model with checkpoints.

5.	avitclip_train.py
	This file will train the AVITCLIP model on MSRVTT dataset with image generated from stable diffusion v1.5. Please download MSRVTT 	dataset. Then modify the datapath, savingpath	and other parameters according to your device and experiment needs. The output is the trained model with checkpoints.

6.	audioclip_train_regrouping.py
	This file will perform the experiment that mitigating memorization during training for AudioCLIP. Please download UrbanSound8K 	dataset. Then modify the datapath, savingpath	and other parameters according to your device and experiment needs. The output is the trained model with checkpoints.

7.	unitmem_audioclip
	This file will evaluate the per-layer unitmem for vision encoder of audioclip model. Please modify the datapath, savingpath and other parameters according to your device and experiment needs. The output is a .mat file with all unitmem results for each neuron.

8.	MI.py
	This file will calculate the mutual information between modality-specific encoders. Then modify the datapath, savingpath and other parameters according to your device and experiment needs. 

Other code used in this work:

1.	AudioCLIP
	address for repo:
	https://github.com/AndreyGuzhov/AudioCLIP
2.	VideoCLIP
	address for repo:
	https://github.com/facebookresearch/fairseq/tree/main/examples/MMPT
	
	


About

Code and supplementary materials for MultiMem paper (ECCV26)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages