-
Notifications
You must be signed in to change notification settings - Fork 6
adds starter guide mostly #35
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
Open
DylanASHillier
wants to merge
2
commits into
main
Choose a base branch
from
starter-guide
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # Resources for Getting Started with Language Models | ||
|
|
||
| ## Important Papers | ||
| While academic papers can be difficult to read, don't worry about trying to understand everything. Oftentimes the fine details are not relevant, so try to focus on understanding the main ideas. Here are some papers that are important to understand the development of language models: | ||
| - [the original transformer paper](https://arxiv.org/abs/1706.03762): This paper is an *encoder-decoder* architecture, which is not popular these days. Main things to try to understand from the paper are the introduction of the attention mechanism. | ||
| - [BERT](https://arxiv.org/abs/1810.04805): This paper introduces a 'masked language modelling objective' - reconstructing a partially obscured version of the original text. It is an *encoder* only model | ||
| - [GPT-2](https://cdn.openai.com/better-language-models/language_models_are_unsupervised_multitask_learners.pdf): An example of a *decoder* only model. It uses a causal language modelling objective - predicting the next word in a sentence. More importantly, it shows that just scaling up the model size/data can lead to impressive zero-shot performance on a variety of tasks | ||
| - [GPT-3](https://arxiv.org/abs/2005.14165): This paper introduces a few-shot learning objective - predicting the next word in a sentence given a few examples of the task. | ||
|
|
||
| ## Blogs | ||
| - [The Illustrated Transformer](http://jalammar.github.io/illustrated-transformer/): A great blog post that explains the transformer architecture in a very visual way. | ||
| - [Illustrated GPT-2](http://jalammar.github.io/illustrated-gpt2/): Another great blog post that explains the GPT-2 architecture in a very visual way. | ||
| - [LLM University](https://cohere.com/llmu): A collection of blog posts that explain various concepts in language models, by Cohere, a prominent AI startup. | ||
|
|
||
| ## Huggingface | ||
| Huggingface is the de-facto standard for working with and sharing language models. It's great for downstream tasks using pre-trained models, and they provide helpful tools for understanding the concepts behind language models as well as tools for finetuning, a massive collection of datasets, and a large collection of pre-trained models. Here are some resources to get started with Huggingface: | ||
| - [Huggingface Transformers Documentation](https://huggingface.co/transformers/): The official documentation for the Huggingface Transformers library. | ||
| - [Huggingface Datasets Documentation](https://huggingface.co/docs/datasets/): The official documentation for the Huggingface Datasets library. | ||
| - [Huggingface Model Hub](https://huggingface.co/models): The official model hub for Huggingface. You can find a large collection of pre-trained models here. | ||
|
|
||
| ## Videos | ||
| While we can't vouch for them [Stanford](https://www.youtube.com/playlist?list=PLoROMvodv4rMFqRtEuo6SGjY4XbRIVRd4) and [MIT](https://ocw.mit.edu/courses/6-864-advanced-natural-language-processing-fall-2005/) have some free lectures on deep learning and NLP, and their online resources in general are pretty good. | ||
|
|
||
| ## Repositories | ||
| We highly recommend trying to train a language model from scratch to better understand the concepts. [For example Bobby used this](https://github.com/bobbycxy/gpt-from-scratch) one. Here are some repositories that can help you get started: | ||
| - [MinGPT](https://github.com/karpathy/minGPT) - Very simple PyTorch implementation of GPT-2, also the basis of this repository | ||
| - [LLMs-from-scratch](https://github.com/rasbt/LLMs-from-scratch) - The code from a book of the same name. Should give some understandable implementations of various components across the language modelling pipeline. | ||
| ## Key Concepts | ||
| - **Tokenization**: The process of breaking up text into smaller pieces, usually words or subwords. These have integer representations that can be used as input to a model. | ||
| - **Embeddings**: A way to represent words as vectors. These vectors are learned during training and are used as input to the model. Additionally the final outputs of the model also act as embeddings. | ||
| - **Logits**: The raw output of a model before it is converted to probabilities. | ||
| - **Feed Forward Neural Network**: A neural network with (typically) multiple, fully connected layers that each perform a linear transformation followed by a non-linear activation function. These are applied to each token independently. | ||
| - **Attention**: The attention mechanism learns to update the representation of each token based on other tokens. A score is computed that determines how much influence a given token has on another token. Then the "value vectors" of the tokens are combined based on these scores to determine the update | ||
| - **Heads**: Attention heads basically divide the embedding space into multiple subspaces and then apply the attention mechanism to each subspace. This allows the model to learn different types of relationships between tokens. | ||
| - **Transformers**: A model that has interwoven attention and feed forward neural networks. The transformer architecture is composed of multiple layers of these blocks. The transformer architecture is the basis for many modern language models. | ||
| - **Weight Tying**: This is a technique where two layers of a neural network share the same weights -- this forces them to always compute the same function. | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, here's my version that you can reference, as discussed - https://github.com/bobbycxy/gpt-from-scratch