Generative Models and Transformers in Rust
摘要
This chapter introduces two foundational architectures in modern deep learning: Generative Adversarial Networks (GANs) and Transformers. We provide minimal, runnable Rust implementations of each, highlighting their core components and training processes. The GAN section focuses on the interplay between generator and discriminator in producing realistic outputs, while the Transformer section demonstrates self-attention, positional encoding, and multi-head attention through a synthetic sequence classification task. Although the Transformer experiment is small-scale and achieves limited accuracy, it effectively illustrates the mechanisms that enable attention-based models to capture global dependencies.