Papers › Contrastive Test-Time Adaptation

Contrastive Test-Time Adaptation

21 Apr 2022CVPR 2022 1arXiv:2204.10377archive 2025-07-28

Dian Chen, Dequan Wang, Trevor Darrell, Sayna Ebrahimi

Test-time adaptation is a special setting of unsupervised domain adaptation where a trained model on the source domain has to adapt to the target domain without accessing source data. We propose a novel way to leverage self-supervised contrastive learning to facilitate target feature learning, along with an online pseudo labeling scheme with refinement that significantly denoises pseudo labels. The contrastive learning task is applied jointly with pseudo labeling, contrasting positive and negative pairs constructed similarly as MoCo but with source-initialized encoder, and excluding same-class negative pairs indicated by pseudo labels. Meanwhile, we produce pseudo labels online and refine them via soft voting among their nearest neighbors in the target feature space, enabled by maintaining a memory queue. Our method, AdaContrast, achieves state-of-the-art performance on major benchmarks while having several desirable properties compared to existing works, including memory efficiency, insensitivity to hyper-parameters, and better model calibration. Project page: sites.google.com/view/adacontrast.

PaperPDFConference PDFCodeCode Syntology ranMethod as code

In Syntology View this paper on Syntology, its page in Syntology's graph. That page adds which of its functions are also present in other papers' code Syntology holds, with dates, and its dated run record as JSON and a README badge. It also lists the repositories linked to the paper, the abstract and the calls for agents.

Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, on Syntology's MCP service (how to connect):

Code

Syntology 32 code samples: 31 from 1 repository linked to this paper, 1 identical to code harvested from another paper's repository. Across all 32: 23 ran (of which 6 constructed an object rather than computing a result; 12 with no instrument failure: 4 honoured, 2 violated, 6 with no contract checked; 11 where Syntology's instrument failed) · 9 unverified. Where Syntology's instrument failed: 8 where our contract draft was wrong; 3 where the contract check could not run; failures of Syntology's instrument, not of the code.

By repository: official repository: 31 samples from 1 repository, 23 ran (12 with no instrument failure; 11 where Syntology's instrument failed); 1 identical to code first harvested elsewhere. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

Levels written on 2026-09-22 (UTC): the dates Syntology's graph wrote each sample's verification level, not when the code executed.

DianCh/AdaContrast officialmentioned on GitHubpytorchSyntology: 31 samples, 23 ran (11 instrument-failed) · 8 unverified report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

32 samples harvested: 23 ran (of which 6 constructed an object rather than computing a result; 12 with no instrument failure: 4 honoured, 2 violated, 6 with no contract checked; 11 where Syntology's instrument failed) · 9 unverified. “Where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Syntology's record for this page has not changed since , the first build that kept a record date for it; when this build read Syntology's graph is in the build record. That date is not when the samples ran.

4ran · honoured contract
2ran · violated contract
8ran · our draft was wrong
3ran; the contract check could not run
6ran
9unverified

Licence: 32 of the 32 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from DianCh/AdaContrast. 1 sample is listed last, in a group without a repository. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. A line beginning “fixture:” under a sample that ran gives the arguments Syntology's fixture called the sample with, each as name:type/rank/element kind (? where none was recorded), and the type of what the fixture's run returned, exactly as the harness recorded them; the arguments and the returned type were recorded by two separate runs of the same fixture. No output value is shown, and a returned type says nothing about whether the output was right. “Level recorded” gives the UTC date when Syntology's graph wrote the sample's verification level, not when the code executed; where the level was written before Syntology's graph kept that date, the row says “level recorded, date not recorded”. For 1 sample that ran, the graph records a signature this page does not show: for a class the fixture built without calling, the harness called the object with inputs it made up itself, so the recorded signature is the harness's probe, not the fixture's arguments. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself. “Our draft was wrong” and “the contract check could not run” are failures of Syntology's instrument, not of the code: the sample ran on Syntology's synthesized input, and then the drafted contract did not describe it, or the check itself raised an error (RAISES), lacked a dependency (DEP_MISSING) or ran out of time (TIMEOUT); hover the label for which. A metamorphic tier, where shown, is evidence of the output's shape, not that the sample implements the method.

Each sample ends with its code_sha256. A sample's code_sha256 is Syntology's identity for that exact code. It is printed in full (16 hexadecimal characters for every sample in this build), and get_code(code_sha256="…") takes it exactly as printed. An agent calls it on Syntology's MCP service (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples are grouped by repository: a repository marked official first, then by how directly the repository is tied to the paper, then in the archive's order; never by how many ran. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of six reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar); this paper's copy was not located, so its licence is not recorded; or this paper's copy is cleared, but the stored copy of the same code that Syntology serves is not. Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

A function or class name links to its page when the name occurs in the harvested code of at least 5 papers; the name is a string, not an identity. A census tag appears when Syntology's census ran implementations with that name on one shared input per bucket: it gives how many were compared, from how many papers, and how many distinct outputs they produced, and names this sample's bucket when this sample was one of them.

DianCh/AdaContrast official repository 31 samples, 23 ran (11 instrument-failed) · 8 unverified
AdaMoCo target.py ran · metamorphic tier: deterministic no licence file found · pointer only · 9b777416ee4b9661 · report fixture: returned AdaMoCo · level recorded 2026-09-22
AverageMeter in 26 papers target.py ran no licence file found · pointer only · 52b386c85c15f1f1 · report fixture: returned AverageMeter · level recorded 2026-09-22
GaussianBlur in 9 papers target.py ran no licence file found · pointer only · aea0d8d156ae8f0e · report fixture: returned GaussianBlur · level recorded 2026-09-22
ImageList target.py ran no licence file found · pointer only · ac8ac005970ac1fd · report fixture: returned ImageList · level recorded 2026-09-22
NCropsTransform target.py ran fingerprinted no licence file found · pointer only · dfe72857fdcd0631 · report fixture: returned NCropsTransform · level recorded 2026-09-22
ProgressMeter in 7 papers target.py ran no licence file found · pointer only · b4cae627da9d4b40 · report fixture: returned ProgressMeter · level recorded 2026-09-22
adjust_learning_rate in 125 papers target.py ran · honoured contract no licence file found · pointer only · 2944a9ae1c818935 · report fixture: signature optimizer:SGD/0/?, progress:float/0/float, args:Args/0/? · returned float · level recorded 2026-09-22
calculate_acc in 12 papers target.py ran · honoured contract fingerprinted no licence file found · pointer only · e4f0afadad927f4c · report fixture: signature logits:Tensor/2/float, labels:Tensor/1/int · returned Tensor · level recorded 2026-09-22
classification_loss in 9 papers target.py ran · our draft was wrong no licence file found · pointer only · 4769519334699711 · report fixture: signature logits_w:Tensor/2/float, logits_s:Tensor/2/float, target_labels:Tensor/1/int, args:ArgsConfig/0/? · returned tuple · level recorded 2026-09-22
cross_entropy_loss in 58 papers target.py ran · our draft was wrong no licence file found · pointer only · 7f2f33aeb9dd8ed3 · report fixture: signature logits:Tensor/2/float, labels:Tensor/1/int, args:Args/0/? · returned Tensor · level recorded 2026-09-22
div in 13 papers target.py ran · honoured contract fingerprinted no licence file found · pointer only · 2bb0642fa17353c2 · report fixture: signature logits:Tensor/2/float, epsilon:float/0/float · returned Tensor · level recorded 2026-09-22
diversification_loss target.py ran · our draft was wrong no licence file found · pointer only · b7348e1772bfba11 · report fixture: signature logits_w:Tensor/2/float, logits_s:Tensor/2/float, args:Args/0/? · returned Tensor · level recorded 2026-09-22
get_augmentation in 19 papers target.py ran · our draft was wrong no licence file found · pointer only · 3277bef847b54b5d · report fixture: signature aug_type:str/0/str, normalize:NoneType/0/? · returned Compose · level recorded 2026-09-22
get_augmentation_versions target.py ran · our draft was wrong no licence file found · pointer only · aa067e5e8cb4bee4 · report fixture: signature args:MockArgs/0/? · returned NCropsTransform · level recorded 2026-09-22
get_distances in 12 papers target.py ran; the contract check could not run (RAISES) no licence file found · pointer only · 9a1f0bd5002fe561 · report fixture: signature X:Tensor/2/float, Y:Tensor/2/float, dist_type:str/0/str · returned Tensor · level recorded 2026-09-22
get_target_optimizer target.py ran · our draft was wrong no licence file found · pointer only · b01220197705c453 · report fixture: signature model:callable/0/?, args:ArgsConfig/0/? · returned SGD · level recorded 2026-09-22
instance_loss target.py ran; the contract check could not run (RAISES) fingerprinted no licence file found · pointer only · 1f34a1638da5703f · report fixture: signature logits_ins:Tensor/2/float, pseudo_labels:Tensor/1/int, mem_labels:Tensor/1/int, contrast_type:str/0/str · returned tuple · level recorded 2026-09-22
is_master in 43 papers target.py ran · violated contract no licence file found · pointer only · 5db12a48f3a9c2a9 · report fixture: signature args:Args/0/? · returned bool · level recorded 2026-09-22
load_image in 273 papers target.py ran · honoured contract no licence file found · pointer only · d41e65573feeba36 · report fixture: signature img_path:str/0/str · returned Image · level recorded 2026-09-22
per_class_accuracy target.py ran; the contract check could not run (RAISES) no licence file found · pointer only · dd980e064cdbfe0e · report fixture: signature y_true:ndarray/1/int, y_pred:ndarray/1/int · returned ndarray · level recorded 2026-09-22
refine_predictions in 7 papers target.py ran · our draft was wrong no licence file found · pointer only · d974e249f37878d2 · report fixture: signature features:Tensor/2/float, probs:Tensor/2/float, banks:dict/0/?, args:ArgsConfig/0/?, gt_labels:Tensor/1/int · returned tuple · level recorded 2026-09-22
soft_k_nearest_neighbors in 6 papers target.py ran · our draft was wrong no licence file found · pointer only · 6651e12b55f05e5d · report fixture: signature features:Tensor/2/float, features_bank:Tensor/2/float, probs_bank:Tensor/2/float, args:Args/0/? · returned tuple · level recorded 2026-09-22
use_wandb target.py ran · violated contract no licence file found · pointer only · 412b38636159f8fa · report fixture: signature args:Args/0/? · returned bool · level recorded 2026-09-22
Classifier in 72 papers target.py unverified no licence file found · pointer only · 291ff0547fe08f00 · report
CustomDistributedDataParallel target.py unverified no licence file found · pointer only · f6f503974907329f · report
eval_and_label_dataset target.py unverified no licence file found · pointer only · 1fb8be6b7baba941 · report
remove_wrap_arounds target.py unverified no licence file found · pointer only · ee1a4a51e75b6f4e · report
save_checkpoint in 36 papers target.py unverified no licence file found · pointer only · df95bf057b7a70cf · report
train_epoch in 71 papers target.py unverified no licence file found · pointer only · ee293b943ff80976 · report
train_target_domain target.py unverified no licence file found · pointer only · 56ce9a1463e90b9f · report
update_labels target.py unverified no licence file found · pointer only · 8eb94c91b5bcfa39 · report
Repository not located 1 sample, 0 ran · 1 unverified
1 sample is identical to code Syntology harvested from another paper's repository; this paper's own copy was not located, so no repository is named and no licence is recorded.
concat_all_gather in 141 papers
census: 7 implementations from 7 papers, 2 distinct outputs on one shared input
repository not located unverified licence of this copy not recorded · a2ae53d34bc13317 · report

Method as code Syntology

What Syntology's graph records as this paper's claimed method, lifted into code: each assembly names its bricks (functions and classes), each with its own role and its own verification level. An assembly is not a check that the code implements the method correctly or reproduces the paper's results. Levels are each brick's own verification level in Syntology's graph (level 0: no recorded run), listed brick by brick and never combined into one level; “ran” means the brick executed on a synthesized input, not that its output is correct, and the instrument figure counts failures of Syntology's instrument, not of the code. Where a model read the code against the paper's claim, each assembly's label verdict is one model's judgement, kept in this page's JSON twin; it is not calibrated, so no card prints it.

1 assembly on this paper: 1 harvested, 0 generated.

harvested Assembly for AdaContrast (graph method: AdaContrast). 32 bricks; individually on a fixture: 23 ran (of which 6 constructed an object rather than computing a result; 12 with no instrument failure: 4 honoured, 2 violated, 6 with no contract checked; 11 where Syntology's instrument failed) · 9 unverified. The assembly has not been run end-to-end.

  1. train_target_domain entry · level 0 · unverified · 56ce9a1463e90b9f
  2. AdaMoCo helper · level 1 · ran · 9b777416ee4b9661
  3. Classifier helper · level 0 · unverified · 291ff0547fe08f00
  4. CustomDistributedDataParallel helper · level 0 · unverified · f6f503974907329f
  5. ImageList helper · level 1 · ran · ac8ac005970ac1fd
  6. eval_and_label_dataset helper · level 0 · unverified · 1fb8be6b7baba941
  7. get_augmentation helper · level 1 · ran · our draft was wrong · 3277bef847b54b5d
  8. get_augmentation_versions data_transform · level 1 · ran · our draft was wrong · aa067e5e8cb4bee4
  9. get_target_optimizer helper · level 1 · ran · our draft was wrong · b01220197705c453
  10. is_master helper · level 1 · ran · violated contract · 5db12a48f3a9c2a9
  11. save_checkpoint helper · level 0 · unverified · df95bf057b7a70cf
  12. train_epoch update_rule · level 0 · unverified · ee293b943ff80976
  13. concat_all_gather helper · level 0 · unverified · a2ae53d34bc13317
  14. load_image helper · level 1 · ran · honoured contract · d41e65573feeba36
  15. per_class_accuracy helper · level 1 · ran; the contract check could not run (RAISES) · dd980e064cdbfe0e
  16. refine_predictions helper · level 1 · ran · our draft was wrong · d974e249f37878d2
  17. remove_wrap_arounds helper · level 0 · unverified · ee1a4a51e75b6f4e
  18. use_wandb helper · level 1 · ran · violated contract · 412b38636159f8fa
  19. GaussianBlur helper · level 1 · ran · aea0d8d156ae8f0e
  20. NCropsTransform helper · level 1 · ran · dfe72857fdcd0631
  21. AverageMeter helper · level 1 · ran · 52b386c85c15f1f1
  22. ProgressMeter helper · level 1 · ran · b4cae627da9d4b40
  23. adjust_learning_rate helper · level 1 · ran · honoured contract · 2944a9ae1c818935
  24. classification_loss loss · level 1 · ran · our draft was wrong · 4769519334699711
  25. diversification_loss loss · level 1 · ran · our draft was wrong · b7348e1772bfba11
  26. instance_loss loss · level 1 · ran; the contract check could not run (RAISES) · 1f34a1638da5703f
  27. update_labels helper · level 0 · unverified · 8eb94c91b5bcfa39
  28. soft_k_nearest_neighbors helper · level 1 · ran · our draft was wrong · 6651e12b55f05e5d
  29. calculate_acc helper · level 1 · ran · honoured contract · e4f0afadad927f4c
  30. cross_entropy_loss helper · level 1 · ran · our draft was wrong · 7f2f33aeb9dd8ed3
  31. div helper · level 1 · ran · honoured contract · 2bb0642fa17353c2
  32. get_distances helper · level 1 · ran; the contract check could not run (RAISES) · 9a1f0bd5002fe561

Each brick ends with its code_sha256, Syntology's identity for that exact code; click one to copy the get_code call that returns it. For agents, on Syntology's MCP service: assembly(arxiv_id="2204.10377") returns these assemblies with each brick's role and wiring (how to connect).

Tasks

Contrastive LearningDomain AdaptationTest-time AdaptationUnsupervised Domain Adaptation

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

Batch NormalizationContrastive LearningInfoNCEMoCo

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections