ahassoun's picture
Upload 3018 files
ee6e328
|
raw
history blame
4.66 kB

GPTBigCode

Overview

The GPTBigCode model was proposed in SantaCoder: don't reach for the stars! by BigCode. The listed authors are: Loubna Ben Allal, Raymond Li, Denis Kocetkov, Chenghao Mou, Christopher Akiki, Carlos Munoz Ferrandis, Niklas Muennighoff, Mayank Mishra, Alex Gu, Manan Dey, Logesh Kumar Umapathi, Carolyn Jane Anderson, Yangtian Zi, Joel Lamy Poirier, Hailey Schoelkopf, Sergey Troshin, Dmitry Abulkhanov, Manuel Romero, Michael Lappert, Francesco De Toni, Bernardo García del Río, Qian Liu, Shamik Bose, Urvashi Bhattacharyya, Terry Yue Zhuo, Ian Yu, Paulo Villegas, Marco Zocca, Sourab Mangrulkar, David Lansky, Huu Nguyen, Danish Contractor, Luis Villa, Jia Li, Dzmitry Bahdanau, Yacine Jernite, Sean Hughes, Daniel Fried, Arjun Guha, Harm de Vries, Leandro von Werra.

The abstract from the paper is the following:uery

The BigCode project is an open-scientific collaboration working on the responsible development of large language models for code. This tech report describes the progress of the collaboration until December 2022, outlining the current state of the Personally Identifiable Information (PII) redaction pipeline, the experiments conducted to de-risk the model architecture, and the experiments investigating better preprocessing methods for the training data. We train 1.1B parameter models on the Java, JavaScript, and Python subsets of The Stack and evaluate them on the MultiPL-E text-to-code benchmark. We find that more aggressive filtering of near-duplicates can further boost performance and, surprisingly, that selecting files from repositories with 5+ GitHub stars deteriorates performance significantly. Our best model outperforms previous open-source multilingual code generation models (InCoder-6.7B and CodeGen-Multi-2.7B) in both left-to-right generation and infilling on the Java, JavaScript, and Python portions of MultiPL-E, despite being a substantially smaller model. All models are released under an OpenRAIL license at this https URL.

The model is a an optimized GPT2 model with support for Multi-Query Attention.

Technical details

The main differences compared to GPT2.

  • Added support for Multi-Query Attention.
  • Use gelu_pytorch_tanh instead of classic gelu.
  • Avoid unnecessary synchronizations (this has since been added to GPT2 in #20061, but wasn't in the reference codebase).
  • Use Linear layers instead of Conv1D (good speedup but makes the checkpoints incompatible).
  • Merge _attn and _upcast_and_reordered_attn. Always merge the matmul with scaling. Rename reorder_and_upcast_attn->attention_softmax_in_fp32
  • Cache the attention mask value to avoid recreating it every time.
  • Use jit to fuse the attention fp32 casting, masking, softmax, and scaling.
  • Combine the attention and causal masks into a single one, pre-computed for the whole model instead of every layer.
  • Merge the key and value caches into one (this changes the format of layer_past/ present, does it risk creating problems?)
  • Use the memory layout (self.num_heads, 3, self.head_dim) instead of (3, self.num_heads, self.head_dim) for the QKV tensor with MHA. (prevents an overhead with the merged key and values, but makes the checkpoints incompatible with the original gpt2 model).

You can read more about the optimizations in the original pull request

GPTBigCodeConfig

[[autodoc]] GPTBigCodeConfig

GPTBigCodeModel

[[autodoc]] GPTBigCodeModel - forward

GPTBigCodeForCausalLM

[[autodoc]] GPTBigCodeForCausalLM - forward

GPTBigCodeForSequenceClassification

[[autodoc]] GPTBigCodeForSequenceClassification - forward

GPTBigCodeForTokenClassification

[[autodoc]] GPTBigCodeForTokenClassification - forward