---
title: Circular Task Embeddings in CCM-AAE
url: https://www.emergentmind.com/topics/circular-task-embeddings
type: topic
---

# Circular Task Embeddings in CCM-AAE

Circular task embeddings are representations of tasks as points on a one-dimensional spherical manifold—specifically, the unit circle \( S^1 \)—with the goal of capturing cyclic, phase-based, or angular relationships among tasks. Within the adversarial autoencoder framework over constant-curvature manifolds (CCM-AAE), circular task embeddings are constructed by encoding task-level information into the circle, leveraging the geometry of constant-positive curvature to enforce a "circular" code and facilitate geometric regularities and visualizations that are not easily captured in Euclidean space [1812.04314].

## 1. Constant-Curvature Manifolds and the Spherical Geometry

A constant-curvature Riemannian manifold \( M \) parameterized by curvature \( \kappa \in \mathbb{R} \) can be realized extrinsically in \( \mathbb{R}^{d+1} \) as
\[ M = \left\{ x \in \mathbb{R}^{d+1} \mid \langle x, x \rangle = \kappa^{-1} \right\}, \]
where \( \langle \cdot, \cdot \rangle \) denotes the Euclidean dot product. In the case \( \kappa > 0 \), the manifold is a \( d \)-dimensional sphere \( S^d_\kappa \) of radius \( r = 1/\sqrt{\kappa} \).

Core geometric operations on the hypersphere include:
- Metric tensor: \( g_x(u, v) = \langle u, v \rangle \).
- Geodesic distance: \( d(u, v) = (1/\sqrt{\kappa}) \arccos(\kappa \langle u, v \rangle) \).
- Exponential and logarithmic maps support transition between embedded points and their tangent representations, enabling smooth optimization and interpolations.

The case \( d = 1 \) yields the unit circle \( S^1 \), a manifold particularly apt for cyclic or periodic structures such as phase data, directions, or task sequences with a natural circular symmetry.

## 2. CCM-AAE Framework for Circular Embedding

The CCM-AAE (Constant-Curvature Manifold Adversarial AutoEncoder) framework enables the construction of latent representations that explicitly reside on a specified constant-curvature manifold. For circular task embeddings, the latent space is instantiated by \( S^1 \) (i.e., a circle in \( \mathbb{R}^2 \)).

The architecture involves:
- **Encoder** \( q_\phi(z|x) \): Maps input task data \( x \) to \( \mathbb{R}^2 \), optionally projecting the resulting embedding onto \( S^1 \) by normalization.
- **Decoder** \( p_\theta(x|z) \): Reconstructs the input data from the embedding, enforcing that latent codes contain information sufficient for task reconstruction or prediction.
- **Discriminator** \( D_\psi(z) \): Distinguishes between real samples drawn uniformly from \( S^1 \) and encoder outputs, enforcing the aggregate posterior to match the manifold's prior.

Off-manifold encodings are penalized using a Gaussian membership function,
\[ m_{S^d_\kappa}(z) = \exp\left( - \frac{(\langle z, z\rangle - 1/\kappa)^2}{2\sigma^2} \right), \]
which quantifies how closely \( z \) adheres to the sphere constraint.

## 3. Learning Objective and Training Procedure

The joint objective function incorporates reconstruction, membership, and adversarial losses:
\[
L_{\text{AAE}}(\phi, \theta, \psi) =
\mathbb{E}_{x \sim p_{\text{data}}} \left[ 
  \mathbb{E}_{z \sim q_\phi(z|x)}[ -\log p_\theta(x|z)] 
\right]
+ \lambda_{\text{geo}} \left(
  - \mathbb{E}_{x} [\log m_{S^d_\kappa}(q_\phi(x))]
\right)
+ L_{\text{adv}}(\phi, \psi),
\]
where \( L_{\text{adv}} \) is a standard adversarial objective comparing real and synthetic manifold samples.

The training alternates between discriminator optimization (\( \psi \)) and minimization over encoder and decoder parameters (\( \phi, \theta \)):
- The discriminator is updated to maximize the adversarial term, distinguishing true manifold samples from encoder outputs.
- The encoder and decoder are jointly updated to minimize reconstruction error, encourage manifold membership, and fool the discriminator.

For the circular case (\( S^1 \)), the prior \( p(z) \) is sampled by drawing \( u \sim \mathcal{N}(0, I_2) \) and normalizing, yielding uniform distribution on the unit circle.

## 4. Construction of Circular Task Embeddings

Circular task embeddings are built as follows:
1. Each task \( x_i \) is encoded via \( q_\phi \) to \( \mathbb{R}^2 \), then normalized to \( S^1 \): \( z_i = q_\phi(x_i)/\lVert q_\phi(x_i)\rVert \).
2. The decoder reconstructs \( x_i \) from \( z_i \), imposing that the embedding is informative with respect to task features or metadata.
3. The discriminator trains against both \( z_i \) and independently sampled \( z_j' \sim \) Uniform(\( S^1 \)).
4. Objective terms and hyperparameters (\( \lambda_{\text{geo}} \), \( \sigma \)) control the balance of reconstruction, manifold regularity, and adversarial alignment.

A typical optimization step involves:
- Computing the batch of task embeddings.
- Evaluating reconstruction loss: \( L_{\text{rec}} = \sum_i -\log p_\theta(x_i | z_i) \).
- Computing the membership penalty: \( L_{\text{geo}} = -(1/B) \sum_i \log m_{S^1}(z_i) \).
- Updating the discriminator with real and fake samples.
- Updating encoder/decoder to minimize the joint loss, including adversarial, reconstruction, and geometric terms.

## 5. Hyperparameterization and Practical Considerations

Relevant settings for circular task embedding include:
- Embedding dimensionality \( d=1 \), thus ambient dimension is 2.
- Curvature \( \kappa = 1 \), setting manifold to the unit circle.
- Regularization strength \( \lambda_{\text{geo}} \in \{0.1, 1.0\} \).
- Membership width \( \sigma \in \{0.01, 0.1\} \).
- Learning rate (e.g., \( 10^{-3} \)), batch size (64-256).

Training proceeds as:
- For each epoch and batch, encode, normalize, and compute losses as outlined.
- The embedding $z_i \in S^1$ after convergence offers a phase (angle) representation per task, lending itself to clustering, visualization, or generative exploration of novel task codes along the circle.

## 6. Applications and Interpretational Advantages

Circular task embeddings provide a natural framework for representing periodic or cyclical task relationships, such as phases, rotations, or tasks with inherent circular orderings. After training, the mapping \( x_i \mapsto z_i \in S^1 \) can be employed for clustering tasks, visualizing angular task progressions, and sampling new hypothetical tasks via interpolations along the circle.

The explicit manifold constraint ensures that embeddings retain circular topology, reducing distortion relative to Euclidean latent codes when the underlying task structure is naturally cyclic. This framework enables robust probabilistic modeling, regularization, and generative modeling within a geometric regime that aligns with the data's symmetries [1812.04314].

Source: https://www.emergentmind.com/topics/circular-task-embeddings