Hila Manor1,2, Rinon Gal2, Haggai Maron1,2, Tomer Michaeli1, Gal Chechik2,3
1Technion - Israel Institute of Technology 2NVIDIA 3Bar-Ilan University
Given a prompt and an image triplet ${a,a',b}$ that visually describe a desired transformation, LoRWeB dynamically constructs a single LoRA from a learnable basis of LoRA modules, and produces an editing result $b'$ that applies the same analogy to the new image.
Visual analogy learning enables image manipulation through demonstration rather than textual description, allowing users to specify complex transformations difficult to articulate in words. Given a triplet
conda env create -f environment.yml
conda activate lorwebTrain a LoRWeB model on your visual analogy dataset:
python run.py config/your_config.yamlYou can override the main options with arguments to the run.py script, e.g. python run.py LoRWeB_default_PROMPTS.yaml --name "lorweb_model" --linear 4 --linear_alpha 4 --loras_num 32 --lora_softmax true --query_mode "cat-aa'b"
We trained on Relation252k.
The training script expects 2 folder: control - which will contain images of the target which contains images of the corresponding preprocess_data.py to preprocess a pre-downloaded dataset.
You can test our model's checkpoint from HuggingFace (coming soon) using inference.py.
python inference.py -w "output/your_model/your_model.safetensors" -c "output/your_model/config.yaml" -a "data/path_to_a_img.jpg" -t "data/path_to_atag_img.jpg" -b "data/patH-to_b_img.jpg" -o "outputs/generated_btag_img_path.jpg"Our complementary custom evaluation set is available on HuggingFace (coming soon).
If you use this code in your research, please cite:
@article{manor2026lorweb,
title={Spanning the Visual Analogy Space with a Weight Basis of LoRAs},
author={Manor, Hila and Gal, Rinon and Maron, Haggai and Michaeli, Tomer and Chechik, Gal},
journal={arXiv preprint arXiv:2602.15727},
year={2026}
}This project builds upon:
- FLUX.1-Kontext by Black Forest Labs
- Diffusers by Hugging Face
- PEFT by Hugging Face
- AI-Toolkit for training infrastructure
⭐ Star this repo if you find it useful! ⭐