Coder Social home page Coder Social logo

0xdti / mixture-of-depths-jax Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 73 KB

Jax module for the paper: "Mixture-of-Depths: Dynamically allocating compute in transformer-based language models"

License: Apache License 2.0

Makefile 2.63% Shell 9.37% Python 88.00%

mixture-of-depths-jax's Introduction

Mixture of Depths (Jax/Flax)

Jax + Flax implementation routing mechanism of the paper Mixture-of-Depths: Dynamically allocating compute in transformer-based language models. Architecture enforces a total compute budget by capping the number of tokens (๐‘˜) that can participate in the self-attention and MLP computations at a given layer. The tokens to be processed are determined by the network using a top-๐‘˜ routing mechanism.

Key Information About Architecture

  • Dynamic Compute Allocation: Demonstrates that transformer-based language models can dynamically allocate computational resources (FLOPs) to specific positions in a sequence, optimizing the allocation across different layers and model depths.

  • Top-K Routing Mechanism: Method enforces a total compute budget by capping the number of tokens that can participate in computations at a given layer. It uses a top-k routing mechanism to select tokens to be processed, resulting in a static computation graph with known tensor sizes while maintaining the flexibility to adjust which tokens are processed.

  • Efficiency and Performance: Models trained using this dynamic compute allocation approach achieve baseline performance while using significantly fewer FLOPs per forward pass, resulting in up to 50% faster post-training sampling times.

TODOs

  • [] Usage and training code will be added to the repository.
  • [] Attention block, RMSNorm block, FFN block will be implemented inside the MoD routing layer.

mixture-of-depths-jax's People

Contributors

dtunai avatar

Stargazers

 avatar  avatar  avatar

Watchers

Kostas Georgiou avatar  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.