Skip to main content
. 2025 Sep 9;11:e3170. doi: 10.7717/peerj-cs.3170

Algorithm 1. Mitigating inappropriate concepts in image generation.

1: Input: text prompt embedding Ptext, inappropriate words embedding Pinappr, unconditional embedding
2: Output: Image without inappropriateness I
3: Initial randomized latent zTN(0,1)
4: for tT,,1 do
5:  if t<Tτ then
6:    zt1 DM( zt,Ptext,Pinappr,,t) {
7:    Mtext, Minapprattε(Ptext,Pinappr,)
8:     MrMinapprMtext
9:     MrReLU(Mr)
10:      MtMtextλMr
11:    }
12:  else
13:    zt1 DM( zt,Ptext,,t)
14:  end if
15: end for
16: return IGenerate(z0)