readme: ---
  language:
  - en
  tags:
  - pytorch
  - causal-lm
  license: apache-2.0
  datasets:
  - the_pile
  
  ---
  
  # GPT-J 6B
  
  ## Model Description
  
  GPT-J 6B is a transformer model trained using Ben Wang's [Mesh Transformer JAX](https://github.com/kingoflolz/mesh-transformer-jax/). "GPT-J" refers to the class of model, while "6B" represents the number of trainable parameters.
  
  <figure>
  
  | Hyperparameter       | Value      |
  |----------------------|------------|
  | \\(n_{parameters}\\) | 6053381344 |
  | \\(n_{layers}\\)     | 28&ast;    |
  | \\(d_{model}\\)      | 4096       |
  | \\(d_{ff}\\)         | 16384      |
  | \\(n_{heads}\\)      | 16         |
  | \\(d_{head}\\)       | 256        |
  | \\(n_{ctx}\\)        | 2048       |
  | \\(n_{vocab}\\)      | 50257/50400&dagger; (same tokenizer as GPT-2/3)  |
  | Positional Encoding  | [Rotary Position Embedding (RoPE)](https://arxiv.org/abs/2104.09864) |
  | RoPE Dimensions      | [64](https://github.com/kingoflolz/mesh-transformer-jax/blob/f2aa66e0925de6593dcbb70e72399b97b4130482/mesh_transformer/layers.py#L223) |
  <figcaption><p><strong>&ast;</strong> Each layer consists of one feedforward block and one self attention block.</p>
  <p><strong>&dagger;</strong> Although the embedding matrix has a size of 50400, only 50257 entries are used by the GPT-2 tokenizer.</p></figcaption></figure>
  
  The model consists of 28 layers with a model dimension of 4096, and a feedforward dimension of 16384. The model
  dimension is split into 16 heads, each with a dimension of 256. Rotary Position Embedding (RoPE) is applied to 64
  dimensions of each head. The model is trained with a tokenization vocabulary of 50257, using the same set of BPEs as
  GPT-2/GPT-3.
  
  ## Training data
  
  GPT-J 6B was trained on [the Pile](https://pile.eleuther.ai), a large-scale curated dataset created by [EleutherAI](https://www.eleuther.ai).
  
  ## Training procedure
  
  This model was trained for 402 billion tokens over 383,500 steps on TPU v3-256 pod. It was trained as an autoregressive language model, using cross-entropy loss to maximize the likelihood of predicting the next token correctly.
  
  ## Intended Use and Limitations
  
  GPT-J learns an inner representation of the English language that can be used to extract features useful for downstream tasks. The model is best at what it was pretrained for however, which is generating text from a prompt.
  
  ### How to use
  
  This model can be easily loaded using the `AutoModelForCausalLM` functionality:
  
  ```python
  from transformers import AutoTokenizer, AutoModelForCausalLM
  
  tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-j-6B")
  model = AutoModelForCausalLM.from_pretrained("EleutherAI/gpt-j-6B")
  ```
  
  ### Limitations and Biases
  
  The core functionality of GPT-J is taking a string of text and predicting the next token. While language models are widely used for tasks other than this, there are a lot of unknowns with this work. When prompting GPT-J it is important to remember that the statistically most likely next token is often not the token that produces the most "accurate" text. Never depend upon GPT-J to produce factually accurate output.
  
  GPT-J was trained on the Pile, a dataset known to contain profanity, lewd, and otherwise abrasive language. Depending upon use case GPT-J may produce socially unacceptable text. See [Sections 5 and 6 of the Pile paper](https://arxiv.org/abs/2101.00027) for a more detailed analysis of the biases in the Pile.
  
  As with all language models, it is hard to predict in advance how GPT-J will respond to particular prompts and offensive content may occur without warning. We recommend having a human curate or filter the outputs before releasing them, both to censor undesirable content and to improve the quality of the results.
  
  ## Evaluation results
  
  <figure>
  
  |  Model                   | Public      | Training FLOPs | LAMBADA PPL ↓ | LAMBADA Acc ↑ | Winogrande ↑ | Hellaswag ↑ | PIQA ↑    | Dataset Size (GB) |
  |--------------------------|-------------|----------------|---            |---            |---           |---          |---        |-------------------|
  | Random Chance            | &check;     | 0              | ~a lot        | ~0%           | 50%          | 25%         | 25%       | 0                 |
  | GPT-3 Ada&ddagger;       | &cross;     | -----          | 9.95          | 51.6%         | 52.9%        | 43.4%       | 70.5%     | -----             |
  | GPT-2 1.5B               | &check;     | -----          | 10.63         | 51.21%        | 59.4%        | 50.9%       | 70.8%     | 40                |
  | GPT-Neo 1.3B&ddagger;    | &check;     | 3.0e21         | 7.50          | 57.2%         | 55.0%        | 48.9%       | 71.1%     | 825               |
  | Megatron-2.5B&ast;       | &cross;     | 2.4e21         | -----         | 61.7%         | -----        | -----       | -----     | 174               |
  | GPT-Neo 2.7B&ddagger;    | &check;     | 6.8e21         | 5.63          | 62.2%         | 56.5%        | 55.8%       | 73.0%     | 825               |
  | GPT-3 1.3B&a