Coder Social home page Coder Social logo

minigptplay's Introduction

While building out a miniGPT, I was curious about the forms of concatenation used. While query, key, value operations use a dot product, which involves a weighted stack and sum approach, the actual combinations of the attention heads were simply combining the shorter latent vectors in the first dimension, greatly reducing the size of the attention head dimension, and thus requiring the feed-forward network following MHA, to build head_size / num_heads segmentations. This felt a bit constricted. I tested out whether keeping the size the same and just stacking and summing in the original dimension would improve training loss. As seen above, it did result in minor improvements, which was pretty cool. Note: this is less an actual experiment and more just fun PyTorch experimentation as I familiarized myself with the architecture. The graph is from 1 training run (although this effect is constant across many training runs). As well, LLMs tested across such small training epochs, batch sizes, and dimensions are hardly representative of actual results. Lastly, to note, this keeps the learnable parameters a factor of (head_size / num_heads) as large on the attention heads dimensions. So its definitely possible improvements can be due to this. When I can, I want to scale the default miniGPT parameters in a non attention head part of the model to observe the difference. As well as see how stacking smaller dimensional (head_size / num_heads) heads affects performance. It is interesting though, that a simple sum over a very small dimension (32 in this project) doesnt trash performance. Vectors are cool.

note this is based off the existing implication of MiniGPT by Andrej Karpathy. The file miniGPTMyMethod.py has my modificaiton to the Attention Head added. The code mostly follows the pattern written by Andrej.

minigptplay's People

Contributors

jadenstryker avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.