GUIDA AI visiva

Suggerimenti negativi nella generazione di immagini

A negative prompt is text describing what you do not want in an AI-generated image.

Ascolta questa guidaNarrato dall'IA · ~3 min

In questa pagina4 minuti di lettura
  1. Panoramica
  2. Immersione profonda
  3. Implementazione nel mondo reale
  4. The Future of Negative Prompts in Image Generation
  5. Metterlo in pratica
  6. Continua a esplorare
  7. Domande frequenti

Panoramica

In diffusion models such as Stable Diffusion, it replaces the empty prompt used in classifier-free guidance, so every denoising step is pushed away from that description. Negative prompts give users a direct lever over unwanted elements, but they only work on models that run true classifier-free guidance, and they can backfire when overused.

Immersione profonda

Diffusion models create an image by starting from random noise and removing it over many steps. At each step, the model predicts the noise twice: once conditioned on your prompt and once on an 'unconditional' input, normally an empty prompt. Classifier-free guidance, introduced by Jonathan Ho and Tim Salimans, combines the two. It starts from the unconditional prediction and moves further toward the conditional one, scaled by the guidance scale (often labeled CFG). The result follows the prompt more closely than the raw model would. A negative prompt simply replaces the empty prompt with your negative text. The formula now pushes away from the negative description as it moves toward the positive one. That is why a negative prompt is not a filter or a post-processing step: it shapes every denoising step. The technique spread through community tools such as the AUTOMATIC1111 web interface in 2022. It became especially popular with Stable Diffusion 2.x, whose results many users found improved noticeably with negatives. Negative prompts work best on concrete visual concepts the model knows well: 'blurry', 'text', 'watermark', 'monochrome', or a specific color or object. They work less well as abstract fixes. On many general-purpose models, terms like 'bad anatomy' or 'extra fingers' often do little, because those models rarely saw captions describing such failures. They can also make results worse. A long list pushes the image away from many directions at once. That can reduce variety, wash out or oversaturate colors, and produce stiff compositions, and high guidance scales amplify the effect. Some models, including guidance-distilled and few-step models, skip the unconditional pass entirely. On those, negative prompts are ignored unless the tool turns true CFG back on, which slows generation. A common misconception is that writing 'no cats' in the main prompt excludes cats. Text encoders handle negation poorly, so the phrase can add cats instead.

Implementazione nel mondo reale

A product photographer generating a studio shot of a watch adds 'text, watermark, logo' as a negative prompt to discourage fake branding in the background.

An illustrator who wants a clean line drawing puts 'shading, color, photorealistic' in the negative prompt. Writing 'no shading' in the main prompt instead can accidentally add shading.

A user pastes a 60-term negative prompt copied from a forum and finds the images turn flat and repetitive. Trimming it to a few targeted terms brings the variety back.

Someone switches to a guidance-distilled model and notices the negative prompt field does nothing, because by default the model never computes the second prediction a negative prompt would feed.

The Future of Negative Prompts in Image Generation

Negative prompts are becoming less central as models improve. Newer systems with stronger text encoders follow detailed positive prompts more faithfully, and guidance-distilled models give up negative prompt support in exchange for speed. Meanwhile, research continues on guidance methods that give finer control without the side effects of plain CFG, and some interfaces offer separate controls for suppressing things like text or a style. The lasting lesson for practitioners is mechanical: check whether your model actually runs a negative branch, keep negatives short and concrete, and test each term against a fixed seed so you can see what it really changes.

Metterlo in pratica

Perché è importante

  • Velocità e scala. L’intelligenza artificiale visiva può automatizzare le attività di ispezione, rilevamento ed etichettatura su larga scala.
  • Scelte di build. I team creativi possono prototipare i concetti più velocemente con meno revisioni manuali.
  • Team e flusso di lavoro. Le operazioni possono utilizzare segnali immagine e video che in precedenza erano difficili da elaborare.

Attenzione

  • I diritti di immagine e il consenso possono diventare rischi legali se la provenienza non è chiara.
  • Le prestazioni del modello possono variare in base all'illuminazione, ai dati demografici e agli ambienti.
  • I falsi positivi possono passare inosservati a meno che non vengano monitorate le soglie di confidenza.

Prossimi passi

  1. Definire i criteri di accettazione per i costi di precisione, richiamo ed errore.
  2. Testare con dati che corrispondono alle reali condizioni di produzione.
  3. Aggiungi la revisione umana per previsioni poco attendibili o ad alto impatto.
  4. Tieni traccia della deriva del modello e riconvalida dopo le modifiche alla fotocamera o al set di dati.

Continua a esplorare

Newsletter gratuita

Ricevi il briefing quotidiano sull'IA

Tre storie verificate sull'IA ogni mattina nei giorni feriali, scritte in un inglese semplice. Gratuito per sempre, senza pubblicità.

Un'email ogni giorno feriale. Disiscriviti con un clic. Non vendiamo né condividiamo mai il tuo indirizzo.

Mettiti alla prova

Take the Negative Prompts in Image Generation quiz

Feedback immediato su ogni risposta e un certificato condivisibile con un ID verificabile una volta superato un corso.

Inizia il quiz

Sostieni l'istruzione gratuita sull'IA. AI Understanding è un'organizzazione non profit 501(c)(3) — nessun annuncio, nessun paywall, mai. Fai una donazione

Domande frequenti

What is Negative Prompts in Image Generation?

A negative prompt is text describing what you do not want in an AI-generated image. In diffusion models such as Stable Diffusion, it replaces the empty prompt used in classifier-free guidance, so every denoising step is pushed away from that description. Negative prompts give users a direct lever over unwanted elements, but they only work on models that run true classifier-free guidance, and they can backfire when overused.

Nella guida senza classificatore, cosa sostituisce un suggerimento negativo?

CFG normalmente confronta la previsione richiesta con una previsione proveniente da un prompt vuoto. Un prompt negativo prende il posto del prompt vuoto, quindi la guida si allontana da quel testo.

Perché scrivere "no gatti" nel prompt principale potrebbe effettivamente produrre gatti?

Il codificatore registra i "gatti" come un concetto forte e in gran parte non coglie il "no". Spostare la parola sul suggerimento negativo inverte la direzione della guida.

Perché le indicazioni senza classificatore raddoppiano all'incirca il calcolo per passaggio?

Ogni passaggio richiede due previsioni del rumore, una per ciascun prompt, e vengono combinate utilizzando la scala di guida.

Secondo la guida, quale termine negativo ha maggiori probabilità di avere un effetto forte e affidabile?

I negativi funzionano meglio su concetti visivi concreti che il modello conosce bene. Le filigrane compaiono in molte immagini di allenamento, mentre le descrizioni dei guasti come "cattiva anatomia" compaiono raramente nelle didascalie generali.

Cosa succede quando si utilizza un suggerimento negativo con un modello distillato dalla guida che salta il passaggio incondizionato?

Senza un ramo incondizionato o negativo da calcolare, il testo negativo non ha nessun posto dove andare. Riattivare il vero CFG lo ripristina a scapito della velocità.