# Concept Sliders: steering a diffusion model with a trained LoRA

> Concept Sliders is the code for a paper on using LoRA adaptors to control a diffusion model along one concept axis at a time, such as age or eye size, rather than only through the prompt. The repository ships training scripts for text and image sliders on SD 1.x, 2.x, and SDXL, inference notebooks, and a separate SliderSpace project that extracts sliders without training.

**rohitgandikota/sliders** — Concept Sliders for Precise Control of Diffusion Models

- Repository: https://github.com/rohitgandikota/sliders
- Website: https://sliders.baulab.info
- Stars: 1,142 · Forks: 86
- Language: Jupyter Notebook
- License: MIT
- Published: 2026-10-19 · Updated: 2026-10-19 · Language: en
- Canonical page: https://hysenlabs.com/projects/rohitgandikota-sliders

## What the project is actually about

Concept Sliders is the official code implementation of the paper Concept Sliders: LoRA Adaptors for Precise Control in Diffusion Models, published at the European Conference on Computer Vision in 2024. The project website is sliders.baulab.info, there is an arxiv preprint, a page of trained sliders for XL, a Colab demo, and a Hugging Face Space demo.

The idea in one sentence is that a diffusion model can be steered along a single concept axis, and that the steering can be represented as a small LoRA adaptor rather than as a prompt. That is a different control surface from the one the models are normally used through.

The practical difference is worth spelling out, because prompt engineering and a slider are not the same kind of control. A prompt gives the model a description, and the model decides how much of that description to express. A slider gives you a continuous parameter, and moving it moves the output along a direction the model has learned. So you can produce a whole family of images, from old to young, from small eyes to large, with one trained adaptor and one number to vary, and the same result is reproducible at a different value rather than being a fresh sample from a stochastic process.

The repository is a collection of notebooks and training scripts rather than a packaged library. The top level has `SD1-sliders-inference.ipynb`, `XL-sliders-inference.ipynb`, `demo_concept_sliders.ipynb`, `demo_SDXL_Turbo.ipynb`, `demo_image_editing.ipynb`, `concept_sliders_diffusers.ipynb`, and `GPT_prompt_helper.ipynb`, plus `trainscripts/`, `eval-scripts/`, `flux-sliders/`, `prompts/`, `images/`, and `requirements.txt`.

The primary language is recorded as Jupyter Notebook, which is accurate and also is the shape of the project. You are expected to run notebooks, not to import a package.

## The training is a LoRA fine-tune with a specific config contract

Training a text slider for SD 1.x and 2.x starts with editing a YAML file, `train-scripts/textsliders/data/prompts.yaml`, and the values in it are not arbitrary.

You edit `target=person`, `positive=old person`, `unconditional=young person` which is the opposite of positive, `neutral=person`, and `action=enhance` with `guidance=4`. If you do not want the edit targeted to a person you replace it with any target you want, for example dog, and if you need it global you replace `person` with an empty string.

Then the training run:

```
python trainscripts/textsliders/train_lora.py --attributes 'male, female' --name 'ageslider' --rank 4 --alpha 1 --config_file 'trainscripts/textsliders/data/config.yaml'
```

The `--attributes` argument is what disentangles concepts from the slider. The example given is that an age slider makes all old people male, so instead you add the `female, male` attributes to allow disentanglement. That is the subtlety of the method in one sentence. A single concept axis in a diffusion model is entangled with gender, age, and other attributes by default, and the attributes argument is how you tell the training which of those you are willing to have move.

The `--rank 4` and `--alpha 1` are the LoRA configuration, and a rank of 4 is small, which is what makes the adaptor cheap to train and cheap to store.

For SD-XL the script is `train_lora_xl.py` and the config is `config-xl.yaml`, with the same setup as SDv1.4:

```
python trainscripts/textsliders/train_lora_xl.py --attributes 'male, female' --name 'agesliderXL' --rank 4 --alpha 1 --config_file 'trainscripts/textsliders/data/config-xl.yaml'
```

Evaluation is done in notebooks rather than a script, `SD1-sliders-inference.ipynb` for the SD 1.x model and `XL-sliders-inference.ipynb` for XL.

## Image sliders need paired data on disk

Visual concept sliders work differently, and the difference is that you supply the data rather than the model finding it.

To train an image based slider you need to create roughly four to six pairs of image dataset, before and after edit for the desired concept. You save the before images and after images separately, and you can also create a dataset with varied intensity effect and save it differently.

The config is edited in `train-scripts/imagesliders/data/config.yaml`, where you set `target=eye` and `itive='eye'` and `unconditional=''` and `neutral=eye` and `action=enhance` with `guidance=4`. And there is a specific instruction for the case where you want the diffusion model to work out the edit concept for itself: leave `target, positive, unconditional, neutral` as empty strings.

The training command is:

```
python trainscripts/imagesliders/train_lora-scale.py --name 'eyeslider' --rank 4 --alpha 1 --config_file 'trainscripts/imagesliders/data/config.yaml' --folder_main 'datasets/eyesize/' --folders 'bigsize, smallsize' --scales '1, -1'
```

And the directory conventions are strict. For this to work you need to store your before images in `smallsize` and after images in `bigsize`, and the corresponding paired files in both folders should have the same names, with both subfolders under `datasets/eyesize`. The project is explicit that you can make your own datasets in your own named conventions.

The `--scales` argument with the values `1, -1` is how the two ends of the axis are expressed, one folder at positive scale and one at negative.

For SD-XL the script is `train-lora-scale-xl.py` with `config-xl.yaml`, and the setup is the same as SDv1.4:

```
python trainscripts/imagesliders/train_lora-scale-xl.py --name 'eyesliderXL' --rank 4 --alpha 1 --config_file 'trainscripts/imagesliders/data/config-xl.yaml' --folder_main '/share/u/rohit/imageXLdataset/eyesize_data/'
```

Note that the SDXL image command in the project summary passes only a `folder_main` pointing at the data directory, with no `--folders` or `--scales`, and the path in the example is an absolute path on the author's own machine. That is a documentation inconsistency rather than a documented difference, and anyone following it will need to supply the folder and scale arguments for the XL script too.

## The environment is pinned to a 2023 stack

The setup instructions are a conda environment with a specific Python version:

```
conda create -n sliders python=3.9
conda activate sliders

git  clone https://github.com/rohitgandikota/sliders.git
cd sliders
pip install -r requirements.txt
```

The requirements file is fully pinned, and the pins are old. `torch` is 2.0.1, `torchvision` is 0.15.2, `diffusers` is 0.20.2, `transformers` is 4.27.4, `numpy` is 1.23.5, `pandas` is 1.5.2, and `xformers` is 0.0.21. The training-specific pieces are there too, `bitsandbytes` for the quantised training, `lion_pytorch` as the optimiser, `lpips` for the perceptual loss, `dadaptation` for the adaptation schedule, `prodigyopt` as a second optimiser, `safetensors`, `wandb` for experiment tracking, and `xformers` for the memory-efficient attention.

This is the practical friction point for anyone picking the project up now. The pins are exact, which means pip will try to install torch 2.0.1 specifically, and a matching CUDA build has to be available for the machine. A 2023 stack on a 2026 GPU driver is where the time goes.

There is a separate requirements file for the FLUX support, and the update notes are explicit that FLUX support is experimental. To play with flux sliders you need to update your packages:

```
pip install -r flux-sliders/flux-requirements.txt
```

and then open the notebook present in the folder `flux-sliders`. The reason given for the caution is that FLUX is not designed the same way as SDXL, so a slider that behaves predictably on SDXL may not transfer.

The Windows note is handled by a link rather than a document, pointing to a comment on issue 27 with Windows setup guidelines, which is a reasonable arrangement for a platform-specific problem that mostly affects the CUDA and bitsandbytes install.

The inference side has a lighter path. There is a Colab demo, so you can try the method without any of this environment at all, and a separate section for running the Hugging Face hosted gradio slider tool locally, which clones the Space, installs its requirements, and runs `app.py`.

## Editing real images, and a text-only helper for prompts

Two capabilities sit outside the training scripts and are worth separating out.

The first is editing real images. Concept sliders can be used to edit real images, and the method is null inversion. Instead of using a prompt, you use sliders, and the `demo_image_editing.ipynb` notebook has the details.

Null inversion is the mechanism that makes this work at all. Inverting a diffusion model recovers the latent that would have produced a given image, which normally costs a per-image optimisation. Once you have that latent you can re-run the denoising with your slider pushed in a direction, and the result is the same image with the concept changed. Without the inversion, the slider would produce a new image in the neighbourhood of the concept rather than an edit of the one you gave it.

The second is a text-only helper with an unexpected capability. The project notes that you can now use GPT-4, or any other openAI model, to create prompts for your text sliders. All you need to do is describe what slider you want to create, for example, saying you want to make people look happy, and the helper notebook, `GPT_prompt_helper.ipynb`, handles it.

That is a neat idea and worth understanding precisely what it does and does not do. The slider's effect is determined by the triple of positive, unconditional, and neutral prompts, the three points that define the direction the adaptor learns. Writing those three by hand for a subtle concept is fiddly, because you need the neutral to be the concept itself and the positive and unconditional to be the concept plus and minus the attribute. Asking a language model to propose that triple from a plain English description is a reasonable way to remove the fiddliness, and it is what the notebook is for.

It is still the slider training that produces the control, not the language model. The helper produces the configuration, and the training run does the rest.

## Where the method does not reach, and the licence split

The boundaries are worth stating clearly, because the project's own presentation is enthusiastic.

First, and this is the point the project itself makes in a note on licence: the code and methods behind the work have been released under MIT, but the models that you use our methods with might be on a different licence, and you should read the model's licence carefully. The sliders repository is MIT licensed, and the trained slider weights are published separately on the project website. A method that is MIT and a model that is not is the common case in this field, and the split is easy to miss until you are shipping.

Second, the axis has to be learnable. The method learns a direction in the model's latent space that corresponds to a concept change, and some concepts are not a clean direction at all. That is why the disentanglement attributes exist, and it is why the guidance to leave the target, positive, unconditional, and neutral empty is there, letting the model find the edit rather than declaring it. A slider for a concept the model does not represent as a direction will produce artefacts rather than a clean sweep.

Third, the tooling is notebooks, so the reproducibility story is weaker than it looks. The training commands are given, which helps, but the evaluation, the image editing, and the interactive demos are all notebooks with state. A team that wants to train a slider as part of a pipeline will be reimplementing some of the notebook logic.

Fourth, the project has moved on to a successor. The latest update points at SliderSpace, which automatically extracts hundreds of sliders from diffusion models' creative knowledge with no training required, in a separate repository. The claim is that it gives the same kind of control with no training at all. The sliders repository also has a single release tag, autosliders-v2.0-pre-release, from February 2025, which is a pre-release of a second generation that has been overtaken by the SliderSpace direction. The last push to the repository was on 2026-04-13, so it is still being touched, but the strategic centre has moved.

Fifth, the FLUX support is explicitly experimental, for the stated reason that FLUX is not designed the same way as SDXL, and the project asks for patience.

## Conclusion

Concept Sliders fits a researcher or artist who needs a continuous, tunable control over one visual or textual attribute of a generated image, and who has a GPU and the patience to train a small adaptor for it. It is the wrong tool for a one-off prompt change, and the wrong choice if the base model you want to control has a licence that forbids it. Check three things before you start: that the base model's licence permits the use you have in mind, since the project's own note is explicit that the methods are MIT but the models may be on different licences, that your GPU can handle the training, since the requirements pin torch 2.0.1 and a lot of pinned versions that will not install cleanly against a current stack, and that you read the requirement that the untargeted and neutral values in the config are what make the axis work, rather than setting them casually.

## FAQ

### What is Concept Sliders and what does it control?

It is the official code implementation of Concept Sliders: LoRA Adaptors for Precise Control in Diffusion Models, from ECCV 2024. A slider is a trained LoRA adaptor that steers a diffusion model along one concept axis, such as age or eye size, so you can vary that attribute continuously rather than only describing it in a prompt.

### How do I train a Concept Slider?

For a text slider, edit `train-scripts/textsliders/data/prompts.yaml` to set the target, positive, unconditional, and neutral values and the action and guidance, then run `python trainscripts/textsliders/train_lora.py --attributes 'male, female' --name 'ageslider' --rank 4 --alpha 1 --config_file 'trainscripts/textsliders/data/config.yaml'`. For an image slider you supply four to six before and after image pairs and use the scripts under `trainscripts/imagesliders/`.

### What is the --attributes argument for in Concept Sliders?

It is used to disentangle concepts from the slider. The example given is that an age slider makes all old people male, so you add the `female, male` attributes to allow disentanglement. The LoRA configuration is given separately by --rank and --alpha, with a rank of 4 in the examples.

### What licence applies to Concept Sliders and the models it works with?

The project states that the code and methods behind the work have been released under MIT, but the models you use the methods with might be on different licences, and you should read the model licence carefully. The repository itself is MIT licensed, and trained slider weights are published on the project website.

## Sources

- [License: MIT](https://github.com/rohitgandikota/sliders/blob/main/LICENSE)
- [Project website](https://sliders.baulab.info)
- [README](https://github.com/rohitgandikota/sliders/blob/main/README.md)
- [Releases](https://github.com/rohitgandikota/sliders/releases)
- [rohitgandikota/sliders on GitHub](https://github.com/rohitgandikota/sliders)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/rohitgandikota-sliders
