Diffusion for Molecular Design
Module: Generative AI | Difficulty: Advanced
Equivariant Diffusion
where includes both atomic positions and types.
EDM (Equivariant Diffusion Model)
SE(3) Equivariance
class EquivariantDiffusion(nn.Module):
def __init__(self, net):
super().__init__()
self.net = net
def forward(self, x_t, t, edge_index):
h = self.net(x_t, t, edge_index)
return h # predicted noise
def loss(self, x0, edge_index):
t = torch.randint(0, 1000, (x0.size(0),))
noise = torch.randn_like(x0)
xt = self.q_sample(x0, t, noise)
return ((noise - self(xt, t, edge_index))**2).mean()
Research Insight: Equivariant diffusion models achieve state-of-the-art on molecule generation benchmarks because they respect the physical symmetries of 3D molecular structures.