rwightman/timm-optim-caution

Model

Comparisons of timm Optimizers w/ Caution

9

10 commits

1 linked in READMEs

updated Dec 6, 2024

See the code

README

Comparisons of timm Optimizers w/ Caution

This repo contains summaries of several sets of experiments comparing a number of optimizers with and without caution (https://huggingface.co/papers/2411.16085) enabled.

The runs were all performed training a smaller ViT (vit_wee_patch16_reg1_gap_256) for 200 epochs (10M samples seen) from scratch on the timm 'mini-imagenet' dataset, a 100 class subset of imagenet with same image sizes as originals.

So far I have results for adamw, laprop, and mars (https://huggingface.co/papers/2411.10438). You can find full results in sub-folders by optimizer names. In all of these runs, the experiments with 'c' prefix in the name have caution enabled.

This is what the 'caution' addition looks like in an optimizer:

    mask = (exp_avg * grad > 0).to(grad.dtype)
    mask.div_(mask.mean().clamp_(min=1e-3))
    exp_avg = exp_avg * mask

Train args:

./distributed_train.sh 2 --dataset hfds/timm/mini-imagenet --num-classes 100 --model vit_wee_patch16_reg1_gap_256 -j 8 --epochs 200 --warmup-prefix --sched-on-updates --warmup-lr 0 --mixup .2 --model-ema --model-ema-decay 0.999 --model-ema-warmup --aa rand-m9-mstd0.5-inc1 --remode pixel --reprob 0.25 --amp --weight-decay .05 --drop 0.1 --drop-path .1 -b 288 --opt cadamw --lr 1e-3

LaProp

optimbest_epochtrain_losseval_losseval_top1eval_top5lr
claprop, lr=1e-03204.02.21736192703247071.093177946853637873.92000039062591.330000097656240.0
claprop, lr=5e-04183.02.2621927261352541.091262722206115873.7700007324218891.220002600097661.3478660293113704e-05
laprop, lr=5e-04198.02.24256420135498051.142610278129577571.7300021362304790.550001464843761.109508849230001e-06
laprop, lr=1e-03179.02.2900409698486331.16838713531494171.1500010498046990.180001892089833.806023374435663e-05
claprop, lr=2e-04195.02.5461723804473881.247544664573669468.3000016357421989.150001538085939.97634228344235e-07
laprop, lr=2e-04204.02.67023515701293951.30917842369079667.0799999023437488.670002709960940.0
claprop, lr=2e-03193.02.6780588626861571.523988691711425862.0800017700195384.81.4890673845226132e-05
laprop, lr=2e-03200.02.704672098159791.52290725593566961.4600013549804785.280001623535161.9732715717284413e-06

LaProp Top-1 Evaluation Accuracy on Mini-ImageNet

Top-1

LaProp Train Loss

Loss

AdamW

optimbest_epochtrain_losseval_losseval_top1eval_top5
cadamw, lr=1e-03184.02.26888513565063481.086813684082031373.5200014160156391.60000036621092
cadamw, lr=5e-04199.02.1632781028747561.097603464698791673.390000585937591.31000137939454
cadamw, lr=1e-03, clip grads203.02.13606262207031251.104311390781402673.3300015869140791.41000042724608
adamw, lr=1e-03, clip grads195.02.27463865280151371.14299844036102372.1100015136718890.47000052490236
adamw, lr=5e-04185.02.30402469635009771.153579185676574771.5000012084960990.4800001953125
adamw, lr=1e-03199.02.2236843109130861.165795856094360471.2299999389648490.30999958496092
cadamw, lr=2e-04189.02.5386278629302981.232592906379699668.9499999511718889.61000139160156
adamw, lr=2e-04203.02.5796246528625491.308552214813232567.1100002685546988.66000164794922

AdamW Top-1 Evaluation Accuracy on Mini-ImageNet

Top-1

AdamW Train Loss

Loss

MARS

optimbest_epochtrain_losseval_losseval_top1eval_top5
cmars, lr=1e-03198.02.0547809600830081.043562701034545874.9100018554687592.08000146484376
cmars, lr=2e-03203.02.02724695205688481.070579524421691874.3100018554687691.54000092773435
mars, lr=1e-03184.02.2197678089141851.0721562566757274.0600017822265691.6200013671875
mars, lr=2e-03197.02.14539909362792971.096378148174285873.7300009887695391.1500006225586
cmars, lr=5e-04198.02.20186305046081541.08355738410949773.3200004516601591.67000092773438
mars, lr=5e-04189.02.3228452205657961.119982813262939772.0299999511718790.86000173339843

MARS Top-1 Evaluation Accuracy on Mini-ImageNet

Top-1

MARS Train Loss

Loss

rwightman/timm-optim-caution

Model

Comparisons of timm Optimizers w/ Caution

9

10 commits

1 linked in READMEs

updated Dec 6, 2024

See the code

README

Comparisons of timm Optimizers w/ Caution

This repo contains summaries of several sets of experiments comparing a number of optimizers with and without caution (https://huggingface.co/papers/2411.16085) enabled.

The runs were all performed training a smaller ViT (vit_wee_patch16_reg1_gap_256) for 200 epochs (10M samples seen) from scratch on the timm 'mini-imagenet' dataset, a 100 class subset of imagenet with same image sizes as originals.

So far I have results for adamw, laprop, and mars (https://huggingface.co/papers/2411.10438). You can find full results in sub-folders by optimizer names. In all of these runs, the experiments with 'c' prefix in the name have caution enabled.

This is what the 'caution' addition looks like in an optimizer:

    mask = (exp_avg * grad > 0).to(grad.dtype)
    mask.div_(mask.mean().clamp_(min=1e-3))
    exp_avg = exp_avg * mask

Train args:

./distributed_train.sh 2 --dataset hfds/timm/mini-imagenet --num-classes 100 --model vit_wee_patch16_reg1_gap_256 -j 8 --epochs 200 --warmup-prefix --sched-on-updates --warmup-lr 0 --mixup .2 --model-ema --model-ema-decay 0.999 --model-ema-warmup --aa rand-m9-mstd0.5-inc1 --remode pixel --reprob 0.25 --amp --weight-decay .05 --drop 0.1 --drop-path .1 -b 288 --opt cadamw --lr 1e-3

LaProp

optimbest_epochtrain_losseval_losseval_top1eval_top5lr
claprop, lr=1e-03204.02.21736192703247071.093177946853637873.92000039062591.330000097656240.0
claprop, lr=5e-04183.02.2621927261352541.091262722206115873.7700007324218891.220002600097661.3478660293113704e-05
laprop, lr=5e-04198.02.24256420135498051.142610278129577571.7300021362304790.550001464843761.109508849230001e-06
laprop, lr=1e-03179.02.2900409698486331.16838713531494171.1500010498046990.180001892089833.806023374435663e-05
claprop, lr=2e-04195.02.5461723804473881.247544664573669468.3000016357421989.150001538085939.97634228344235e-07
laprop, lr=2e-04204.02.67023515701293951.30917842369079667.0799999023437488.670002709960940.0
claprop, lr=2e-03193.02.6780588626861571.523988691711425862.0800017700195384.81.4890673845226132e-05
laprop, lr=2e-03200.02.704672098159791.52290725593566961.4600013549804785.280001623535161.9732715717284413e-06

LaProp Top-1 Evaluation Accuracy on Mini-ImageNet

Top-1

LaProp Train Loss

Loss

AdamW

optimbest_epochtrain_losseval_losseval_top1eval_top5
cadamw, lr=1e-03184.02.26888513565063481.086813684082031373.5200014160156391.60000036621092
cadamw, lr=5e-04199.02.1632781028747561.097603464698791673.390000585937591.31000137939454
cadamw, lr=1e-03, clip grads203.02.13606262207031251.104311390781402673.3300015869140791.41000042724608
adamw, lr=1e-03, clip grads195.02.27463865280151371.14299844036102372.1100015136718890.47000052490236
adamw, lr=5e-04185.02.30402469635009771.153579185676574771.5000012084960990.4800001953125
adamw, lr=1e-03199.02.2236843109130861.165795856094360471.2299999389648490.30999958496092
cadamw, lr=2e-04189.02.5386278629302981.232592906379699668.9499999511718889.61000139160156
adamw, lr=2e-04203.02.5796246528625491.308552214813232567.1100002685546988.66000164794922

AdamW Top-1 Evaluation Accuracy on Mini-ImageNet

Top-1

AdamW Train Loss

Loss

MARS

optimbest_epochtrain_losseval_losseval_top1eval_top5
cmars, lr=1e-03198.02.0547809600830081.043562701034545874.9100018554687592.08000146484376
cmars, lr=2e-03203.02.02724695205688481.070579524421691874.3100018554687691.54000092773435
mars, lr=1e-03184.02.2197678089141851.0721562566757274.0600017822265691.6200013671875
mars, lr=2e-03197.02.14539909362792971.096378148174285873.7300009887695391.1500006225586
cmars, lr=5e-04198.02.20186305046081541.08355738410949773.3200004516601591.67000092773438
mars, lr=5e-04189.02.3228452205657961.119982813262939772.0299999511718790.86000173339843

MARS Top-1 Evaluation Accuracy on Mini-ImageNet

Top-1

MARS Train Loss

Loss