Try Skill Builder

Try Skill Builder

Have a friendly voice chat about how you're using AI, get feedback on your skills, and find out what to learn or build next.
Take Me There

Quick Guide & Tips

💻   Accessing Utils File and Helper Functions

In each notebook on the top menu:

1:   Click on "File"

2:   Then, click on "Open"

You will be able to see all the notebook files for the lesson, including any helper functions used in the notebook on the left sidebar. See the following image for the steps above.


🔄   Reset User Workspace

If you need to reset your workspace to its original state, follow these quick steps:

1:   Access the Menu: Look for the three-dot menu (⋮) in the top-right corner of the notebook toolbar.

2:   Restore Original Version: Click on "Restore Original Version" from the dropdown menu.

For more detailed instructions, please visit our Reset Workspace Guide.


💻   Downloading Notebooks

In each notebook on the top menu:

1:   Click on "File"

2:   Then, click on "Download as"

3:   Then, click on "Notebook (.ipynb)"


💻   Uploading Your Files

After following the steps shown in the previous section ("File" => "Open"), then click on "Upload" button to upload your files.


📗   See Your Progress

Once you enroll in this course—or any other short course on the DeepLearning.AI platform—and open it, you can click on 'My Learning' at the top right corner of the desktop view. There, you will be able to see all the short courses you have enrolled in and your progress in each one.

Additionally, your progress in each short course is displayed at the bottom-left corner of the learning page for each course (desktop view).


📱   Features to Use

🎞   Adjust Video Speed: Click on the gear icon (⚙) on the video and then from the Speed option, choose your desired video speed.

🗣   Captions (English and Spanish): Click on the gear icon (⚙) on the video and then from the Captions option, choose to see the captions either in English or Spanish.

🔅   Video Quality: If you do not have access to high-speed internet, click on the gear icon (⚙) on the video and then from Quality, choose the quality that works the best for your Internet speed.

🖥   Picture in Picture (PiP): This feature allows you to continue watching the video when you switch to another browser tab or window. Click on the small rectangle shape on the video to go to PiP mode.

√   Hide and Unhide Lesson Navigation Menu: If you do not have a large screen, you may click on the small hamburger icon beside the title of the course to hide the left-side navigation menu. You can then unhide it by clicking on the same icon again.


🧑   Efficient Learning Tips

The following tips can help you have an efficient learning experience with this short course and other courses.

🧑   Create a Dedicated Study Space: Establish a quiet, organized workspace free from distractions. A dedicated learning environment can significantly improve concentration and overall learning efficiency.

📅   Develop a Consistent Learning Schedule: Consistency is key to learning. Set out specific times in your day for study and make it a routine. Consistent study times help build a habit and improve information retention.

Tip: Set a recurring event and reminder in your calendar, with clear action items, to get regular notifications about your study plans and goals.

☕   Take Regular Breaks: Include short breaks in your study sessions. The Pomodoro Technique, which involves studying for 25 minutes followed by a 5-minute break, can be particularly effective.

💬   Engage with the Community: Participate in forums, discussions, and group activities. Engaging with peers can provide additional insights, create a sense of community, and make learning more enjoyable.

✍   Practice Active Learning: Don't just read or run notebooks or watch the material. Engage actively by taking notes, summarizing what you learn, teaching the concept to someone else, or applying the knowledge in your practical projects.


📚   Enroll in Other Short Courses

Keep learning by enrolling in other short courses. We add new short courses regularly. Visit DeepLearning.AI Short Courses page to see our latest courses and begin learning new topics. 👇

👉👉 🔗 DeepLearning.AI – All Short Courses [+]


🙂   Let Us Know What You Think

Your feedback helps us know what you liked and didn't like about the course. We read all your feedback and use them to improve this course and future courses. Please submit your feedback by clicking on "Course Feedback" option at the bottom of the lessons list menu (desktop view).

Also, you are more than welcome to join our community 👉👉 🔗 DeepLearning.AI Forum


Sign in

Or, sign in with your email
Email
Password
Forgot password?
Don't have an account? Create account
By signing up, you agree to our Terms Of Use and Privacy Policy

Create Your Account

Or, sign up with your email
Email Address

Already have an account? Sign in here!

By signing up, you agree to our Terms Of Use and Privacy Policy

Choose Your Plan

Planning for more users?
MonthlyYearly

Change Your Plan

Your subscription plan will change at the end of your current billing period. You'll continue to have access to your current plan until then.

Learn More

Welcome back!

Hi ,

We'd like to know you better so we can create more relevant courses. What do you do for work?

Join Team Success

You have successfully joined undefined

You now have access to all Pro features. Click below to start learning!

Session Expired

Session expired — please return to Cornerstone to restart the session and complete the course.

DeepLearning.AI
/
Transformers in Practice
/
  • Module 1
    • Observed behaviorModule 1
    • LLM internals and attentionModule 2
    • Scaling and deployingModule 3
  • All Courses
DeepLearning.AI
/
Transformers in Practice
/
  • Module 1
    • Observed behaviorModule 1
    • LLM internals and attentionModule 2
    • Scaling and deployingModule 3
  • All Courses
DeepLearning.AIAll Courses
Transformers in Practice
/
  • Module 1
    • Observed behaviorModule 1
    • LLM internals and attentionModule 2
    • Scaling and deployingModule 3
DeepLearning.AI
Transformers in Practice
/
  • Module 1
    • Observed behaviorModule 1
    • LLM internals and attentionModule 2
    • Scaling and deployingModule 3

Course Syllabus

Elevate Your Career with Full Learning Experience

Unlock Plus AI learning and gain exclusive insights from industry leaders

Access exclusive features like graded notebooks and quizzes
Earn unlimited certificates to enhance your resume
Starting at $1 USD/mo after a free trial – cancel anytime
If you work with large language models, whether you're building applications, fine-tuning, or using them through an API, you're working with transformer models. And a lot of great resources have been created to explain how they work. Courses that build them from scratch, complex explanations of the attention mechanism, and theoretical deep dives. But you might find that those explanations don't always connect to the problems you actually face using transformers. This course connects all the critical pieces to building and using transformer networks in practice. It builds a coherent picture from how a trained transformer generates text, to what's happening during a forward pass of the model, to how the process gets optimized to run on GPUs. I'm delighted to introduce Sharon Zhou, who's your instructor for this course on transformers in practice. I've known the work of Sharon for many years, starting from her days at Stanford, and we've really stayed friends and kept in touch through her now being VP of Engine AI at AMD. So Sharon, say a bit more about why you built this course. Yeah, absolutely. The goal of this course is really to help you, the learner, gain deeper intuition in a way that impacts how you can practically use LLMs, not just the fun math part. I've noticed, you know, people often hit on some issue when they're working with language models, and if only they had that deeper intuition, and they could actually debug it instead of say, well, LLMs don't work. I think that once you understand the core of what these models do, generating text one token at a time from a probability distribution, everything else follows. Now, one interesting evolution of the transformer network is the original Google brain paper on the transformer network talked about the encoder-decoder architectures, and one of the most important evolutions has been that all the frontier labs now pretty much use the decoder-only architecture. Yeah, in this course, the focus is really on decoder-only transformers, because that's the architecture behind nearly all the frontier models that you're using today. So you'll go deep on practical concepts that matter most for your work. And throughout this course, there are some also really fun, informative, interactive visualizations where you can actually see these processes in action. Like you can watch tokens get sampled, watch attention scores form, see what's happening inside the GPU. I found that playing with the concepts helps with gaining deeper intuition on them. Yeah, I think the concrete examples are important, because when it comes to transformers, there's often more than meets the eye. Let's walk through as well what the course actually covers. Okay, let's do it. So in module one, you learn about everything an LLM does, whether it's writing code or why it's hallucinating. And that all comes from the same process, picking one token at a time from a probability distribution of all the possible tokens in its vocabulary. This basically helps explain many LLM behaviors that fall out of this process and shows how techniques like structured output or RAG, retrieval augmented generation, and reasoning all work by building on that same loop. And that raises an obvious question, where does that probability distribution even come from, right? That's in module two. So you'll look inside the model there, the attention mechanism, how positional information is encoded and included, how layers build on each other to see the math that produces it. It's a lot of matrix operations and seeing them helps you understand what the model is actually doing with your input. Finally, once you see the math involved in a single forward pass, you can begin to understand what goes on in a full LLM system beyond just the language model itself. So in module three, you'll look at how that math runs on GPUs, the optimizations like KB caching, flash attention, quantization. Again, don't worry if you don't know what those terms are. These are techniques that make these larger frontier models fast enough to actually serve users. One of the things I really like about this course is that if you're already working with LLMs, you probably have a sense of how they behave from your practical experience, but not necessarily always why they behave that way. By the end of this course, you have that coherent picture that Sharon described that will help you to make better decisions about deployments or help you to follow new research and really understand what's happening when things go right or when they don't go right. I hope you enjoy learning about how transformers work and let's go on to the next video and get started.
course detail
Module 1: Observed behavior
  • Conversation between Sharon Zhou and Andrew Ng
    Video
    ・
    4m
  • Transformers in practice
    Video
    ・
    2m
  • The autoregressive loop
    Video
    ・
    4m
  • Visualization tutorial
    Video
    ・
    3m
  • Visualization: The autoregressive Loop
    Code Example
    ・
    10m
  • Token sampling
    Video
    ・
    5m
  • Visualization: Selecting the Next Token
    Code Example
    ・
    10m
  • Autoregressive dynamics
    Video
    ・
    3m
  • Visualization: How Sampling Shapes Output
    Code Example
    ・
    10m
  • Structured outputs
    Video
    ・
    4m
  • Visualization: Constrained Generation with Finite State Machines (FSM)
    Code Example
    ・
    10m
  • Grounding in context
    Video
    ・
    7m
  • Thinking and reasoning
    Video
    ・
    5m
  • Additional Readings for Module 1
    Reading
    ・
    10m
  • Module 1: Graded Lab

    Graded・Code Assignment

    ・
    10m
  • Module 1: Quiz

    Graded・Quiz

    ・
    30m
  • Join the DeepLearning.AI Forum to ask questions, get support, or share amazing ideas!
    Reading
    ・
    1m
  • Next
    Module 2: LLM internals and attention
  • Certificate
    Course Details