AnaLogical-GCD (AL-GCD)
March 24, 2026 · View on GitHub
Learning Like Humans: Analogical Concept Learning for Generalized Category Discovery
Official implementation of Learning Like Humans: Analogical Concept Learning for Generalized Category Discovery.
By Jizhou Han, et. al.

🧠 Method Overview
AL-GCD integrates visual and textual information for discovery via analogical learning. Concretely, it leverages a learned generator to synthesize textual concepts for unlabeled samples and fuses them with visual features for contrastive discovery. Our pipeline consists of two stages:
Stage 1: ATCG Training (Pseudo-GCD)
We first construct a labeled visual–text knowledge base. Based on this knowledge base, we simulate a pseudo-GCD setting to train the Analogical Textual Concept Generator (ATCG), enabling it to generate analogical text embeddings for unlabeled-like samples.
Stage 2: AL-GCD Training (GCD Training)
In the actual GCD training stage, ATCG produces textual embeddings for unlabeled samples. These embeddings are fused with visual features to form fusion representations, which are then optimized via contrastive learning to support category discovery.
One-command runner: In this codebase, Stage 1 + Stage 2 are integrated and can be executed by a single bash script.
Prototype-as-Knowledge-Base: We additionally provide an efficient variant that replaces the sample-level knowledge base with one prototype per class, significantly reducing memory footprint and retrieval cost, thus accelerating training and inference—particularly on large-scale or fine-grained benchmarks.
📦 Dependencies
pip install -r requirements.txt
kmeans_pytorch Installation
Our pipeline (SelEx-style clustering) relies on kmeans_pytorch for cluster assignment. To reproduce paper-level results, please install it as follows:
cd AnaLogical-GCD
git clone https://github.com/subhadarship/kmeans_pytorch
cd kmeans_pytorch
pip install --editable .
🗂️ Datasets
We conduct experiments on six benchmarks, including fine-grained and generic datasets:
Fine-grained:
Generic:
🔧 Config
Set paths to datasets, pre-trained models and desired log directories in config.py
Set SAVE_DIR (logfile destination) and PYTHON (path to python interpreter) in bash_scripts scripts.
🚀 Scripts
🧩 One-command: Train ATCG + Train GCD
We provide a one-command runner that sequentially executes:
- ATCG training (Pseudo-GCD)
- AL-GCD training (GCD Training)
- evaluation on best and final checkpoints.
Run:
bash Train_AL.sh
In this codebase, ATCG training and AL-GCD training are integrated into a single training entry. Train_AL.sh is the recommended launcher for reproducing our main results.
⚡ Prototype-as-Knowledge-Base (Fast Variant)
We additionally provide a Prototype-as-Knowledge-Base mode, where the knowledge base stores one prototype per class (instead of all class samples). This can significantly reduce memory and compute, accelerating both training and inference.
Run (prototype KB version):
bash Train_AL_proto.sh
Note: We recommend using the proto-based version in practice. It achieves comparable performance while substantially reducing training time and improving overall efficiency—especially on ImageNet-100, Herbarium19, and CIFAR-100.
✅ Evaluation & Released Weights
You can evaluate the released checkpoints via:
bash Test.sh
We provide released weight for both KB settings:
- All-sample Knowledge-Base weights (Baidu Netdisk): link
- Proto-based Knowledge-Base weights (Baidu Netdisk): link
- All-sample Knowledge-Base and Proto-based Knowledge-Base (Google Drive): link
📊 Results
For each dataset, we report results under two Knowledge-Base settings:
- All-sample Knowledge-Base (run with
bash Train_AL.sh) - Proto-based Knowledge-Base (run with
bash Train_AL_proto.sh)
Each entry is reported as All / Old / New accuracy (%).
We report both the Best result and the Final result.
All-sample Knowledge-Base (All / Old / New)
| Dataset | Best | Final | ||||
| All | Old | New | All | Old | New | |
| CUB-200 | 85.7 | 79.1 | 89.0 | 85.4 | 79.5 | 88.4 |
| Stanford Cars | 81.5 | 92.0 | 76.4 | 81.5 | 92.0 | 76.4 |
| FGVC-Aircraft | 67.7 | 65.8 | 68.6 | 67.3 | 65.4 | 68.3 |
| Herbarium19 | 52.7 | 58.0 | 49.9 | 52.3 | 57.7 | 49.3 |
| CIFAR-100 | 80.6 | 86.3 | 69.1 | 80.4 | 86.2 | 68.6 |
| ImageNet-100 | 95.3 | 97.5 | 94.2 | 95.3 | 97.5 | 94.2 |
Proto-based Knowledge-Base (All / Old / New)
| Dataset | Best | Final | ||||
| All | Old | New | All | Old | New | |
| CUB-200 | 84.9 | 79.9 | 87.4 | 84.5 | 77.8 | 87.9 |
| Stanford Cars | 80.9 | 91.6 | 75.8 | 80.9 | 92.1 | 75.6 |
| FGVC-Aircraft | 66.4 | 64.6 | 67.3 | 66.0 | 62.8 | 67.6 |
| Herbarium19 | 49.7 | 58.2 | 45.1 | 48.0 | 56.3 | 43.6 |
| CIFAR-100 | 79.1 | 84.5 | 68.2 | 79.1 | 84.5 | 68.2 |
| ImageNet-100 | 93.7 | 96.9 | 92.1 | 93.5 | 97.2 | 91.6 |
- Detailed logs:
Logs_Save/ALGCD/(includingAll_Samples/andProto_Based/); All results are obtained with a fixed seed (seed = 1).
Knowledge-Base Size
All-sample Knowledge-Base. We populate the KB with all labeled samples and their augmented views.
Therefore, the number of KB entries equals 2 × (labeled samples).
Proto-based Knowledge-Base. We populate the KB with one prototype per known (labeled) class.
Therefore, the number of KB entries equals known classes.
| Knowledge-Base Setting | CUB-200 | Stanford Cars | FGVC Aircraft | Herbarium19 | CIFAR-100 | ImageNet-100 |
|---|---|---|---|---|---|---|
| All-sample | 2,740 | 3,744 | 3,076 | 17,482 | 39,744 | 63,464 |
| Proto-based | 100 | 98 | 50 | 341 | 80 | 50 |
🧾 Citation
If you use this code in your research, please consider citing our paper:
@article{zhou2026analogical,
title={Learning Like Humans: Analogical Concept Learning for Generalized Category Discovery},
author={Jizhou Han and Chenhao Ding and Yuhang He and Qiang Wang and Shaokun Wang and SongLin Dong and Yihong Gong},
journal={arXiv preprint arXiv:2603.19918},
year={2026}
}
🎁 Acknowledgements
This codebase is primarily built upon the excellent open-source repositories of GCD, SelEx, and SimGCD. We sincerely thank the authors for their valuable contributions to the community.
📧 Contact
If you have any questions or would like to discuss this work, please feel free to reach out:
Jizhou Han (Jizhou_han@stu.xjtu.edu.cn)