Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Nystromformer blog post #414

Merged
merged 17 commits into from
Aug 2, 2022
Merged

Conversation

novice03
Copy link
Contributor

@novice03 novice03 commented Jul 11, 2022

Hello, this is a blog post on Nystromformer. Through this post, I wanted to:

  • provide a brief overview of the Nystrom method for approximating matrices
  • explain how the Nystrom method can be leveraged to approximate self-attention
  • raise awareness of the HuggingFace implementation

Reviewers: @NimaBoscarino

Copy link
Contributor

@NimaBoscarino NimaBoscarino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for writing this!! I left a few comments, but this is way out of my area of expertise so unfortunately I don't think I can provide any useful feedback on the actual content. I think @NielsRogge will be more helpful than me here 😄

nystromformer.md Outdated
@@ -0,0 +1,151 @@
---
title: "Nyströmformer: Approximating self-attention in linear time and memory via the Nyström method"
thumbnail: /blog/assets/86_nystromformer/paper_figure.png
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let us know if you can provide a thumbnail for the blog post (with a short version of the title), otherwise I think we can arrange to have one put together.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not entirely sure what tools I can use to create a good thumbnail. If it isn't too much to ask, can you please provide one?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally! Figma is a good choice, or you could use Canva instead.

Here's a ZIP file with a bunch of SVGs that you could choose from for a background, and a HF logo: https://drive.google.com/file/d/1d-uLYKWUV1K10MRmnxXfW6MAUrTd4qaT/view?usp=sharing

And the font we use is "Source Sans Pro", bold.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for sharing this. I've pushed the thumbnail I made to this branch. Please let me know what you think.


### Can we approximate self-attention with the Nyström method?

Our goal is to ultimately approximate the softmax matrix in standard self attention: $$S = softmax(\frac{QK^T}{\sqrt{d}})$$
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This latex statement doesn't seem to render properly in the blog.

image

You can fix it by putting the statement on a new line. There are some other latex statements that are also broken, but I don't think that there's a way for you to preview the blog to fix it since our front-end code is closed-source. When everything else is all done with this post, I can take on fixing it before we merge!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@novice03
Copy link
Contributor Author

Thanks a lot for your review @NimaBoscarino. I've applied the suggested changes. Looking forward to suggestions from other reviewers.

Copy link
Contributor

@osanseviero osanseviero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this blog post! I left some comments that are important for the post, but apart from it this looks great 🔥 feel free to re-request review once you think it's ready!

_blog.yml Outdated
author: novice03
thumbnail: /blog/assets/86_nystromformer/thumbnail.png
date: July 11, 2022
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To update before merge

@novice03 novice03 marked this pull request as ready for review July 27, 2022 17:22
@novice03
Copy link
Contributor Author

Thank you so much for your review @osanseviero. I added the author card and I shall update the date right before this PR is ready to be merged. I also marked this PR as ready for review.

Copy link
Contributor

@osanseviero osanseviero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great to me! Last week we had a bunch of blog posts, but this week we can merge this. WDYT Of releasing this tomorrow?

@novice03
Copy link
Contributor Author

novice03 commented Aug 1, 2022

Sounds good to me! Just to confirm - the date would be August 2nd, right?

@osanseviero
Copy link
Contributor

That's right! 🥳

Copy link
Contributor

@NielsRogge NielsRogge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Just wondering if the code block regarding the implementation adds a lot of value.

@osanseviero
Copy link
Contributor

Let's ship this 🔥 🚀

@osanseviero osanseviero merged commit 38f8013 into huggingface:main Aug 2, 2022
@osanseviero
Copy link
Contributor

This is up now! https://huggingface.co/blog

@novice03
Copy link
Contributor Author

novice03 commented Aug 2, 2022

Thank you so much!

There seem to be some latex issues, especially in the "How can we adapt the Nyström method to approximate self-attention?" section. How can we fix this?

@osanseviero
Copy link
Contributor

Looking into this :)

@osanseviero
Copy link
Contributor

Opened #449

@julien-c
Copy link
Member

julien-c commented Aug 2, 2022

great blogpost @novice03 thanks for contributing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants