This was a single question that ate the entire session.
Start by outlining a systematic debugging strategy: first verify the overall architecture and data flow, then inspect each component against the original Transformer paper, and finally run targeted tests to confirm bugs and fixes. For each bug, explain its impact on training dynamics and model performance, and provide corrected code snippets.
Pro tip: Demonstrate deep understanding by not only fixing bugs but also explaining how each bug would manifest during training (e.g., loss not decreasing, gradients exploding) and how you would detect them using tools like gradient checking or logging attention weights.
Review the code structure to ensure you grasp how data flows through the model, from input embeddings to output logits, and identify all components mentioned.
Compare the implementation of multi-head attention, positional encoding, layer norm, residuals, and FFN with the original 'Attention Is All You Need' paper to spot deviations.
For each bug found, articulate what it breaks (e.g., incorrect scaling in attention, missing residual connections) and how it affects training and model performance.
Show the corrected code snippets for each bug, ensuring they align with best practices and the original architecture.
Describe how you would test the fixes, such as running a small training loop to see if loss decreases or using gradient checks to ensure proper backpropagation.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.