Chip Foundry Services Request Assessment

Latent Space Arithmetic

Latent Space Arithmetic is the practice of performing algebraic operations (addition, subtraction, averaging) on latent vectors of a generative model to achieve compositional semantic editing, based on the discovery that well-structured latent spaces encode semantic concepts as consistent vector directions that can be combined through simple arithmetic. The classic example is the analogy: $\operatorname{vector}("king") - \operatorname{vector}("man") + \operatorname{vector}("woman") \approx \operatorname{vector}("queen")$, which extends to visual attributes in generative models.

Why Latent Space Arithmetic Matters in AI/ML:
Latent space arithmetic reveals that generative models learn compositional semantic structure where complex concepts decompose into additive vector components, enabling intuitive attribute transfer and compositional editing through simple vector operations.

• Concept vectors — Semantic attributes are encoded as directions in latent space: the "glasses" vector $v_{\text{glasses}}$ can be computed by averaging latent codes of faces with glasses minus the average of faces without glasses, creating a transferable attribute direction
• Attribute transfer — Adding a concept vector to any latent code transfers that attribute: z_with_glasses = z_face + v_glasses; subtracting removes it: z_without_glasses = z_face - v_glasses; this works because well-disentangled spaces encode attributes as approximately linear, independent directions
• Analogy completion — Visual analogies follow the same pattern as word embeddings: $z(man$ with glasses) $- z(man$ without glasses) $+ z(woman$ without glasses) $\approx z(woman$ with glasses), demonstrating that the model has learned to separate identity from attribute
• Multi-attribute editing — Multiple concept vectors can be combined additively: $z_{\text{edited}} = z + \alpha_1\cdot v_{\text{smile}} + \alpha_2\cdot v_{\text{young}} + \alpha_3\cdot v_{\text{glasses}}$, enabling simultaneous control over multiple independent attributes with separate scaling factors
• Limitations — Arithmetic assumes attributes are linearly encoded and independent; in practice, attributes are often entangled (changing "age" may change "hair color"), and the linear assumption breaks down at large magnitudes

OperationFormulaEffect
Addition$z + v_{\text{attr}}$Add attribute
Subtraction$z - v_{\text{attr}}$Remove attribute
Analogy$z_A - z_B + z_C$Transfer difference $A-B$ to $C$
Averaging$(z_1 + z_2)/2$Blend two images
Scaled Edit$z + \alpha \cdot v_{\text{attr}}$Control edit strength
Multi-Edit$z + \Sigma \alpha_i\cdot v_i$Simultaneous multi-attribute

Latent space arithmetic is the most intuitive demonstration that generative models learn compositional semantic structure, enabling attribute transfer, analogy completion, and multi-attribute editing through simple vector addition and subtraction that reveals the linear, disentangled organization of knowledge within learned latent representations.