Skip to content

Latest commit

 

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LLM

===Repository to explore various optimizations in LLMs===

A. Speculative Decoding is a technique usued to accelerate inference in LLMs using smaller LLMs without changing the output probability distribution of the tokens. The low latency of the smaller model combined with accuracy of the larger LLM makes this method very effective. Refer to [1] for more details.

My youtube playlist explaining the paper in extensive detail

In speculative_decoding.py, we have the implementation for the Speculative Decoding Algorithm . Experiments:

  1. Alpha (α) calculation image

  2. Plotting histogram of beta values for various time steps and observing acceptance/rejection

image
  1. Exploring the relation between context and beta values
image

B. I have implemented autoregressive decoding with manual handling of KV Cache in autoregressive_decoding.py. There are two simple experiments with autoregressive decoding:

  1. Experiment 1: Generating the same set of tokens is much faster with KV Cache.
  2. Experiment 2: Smaller LLMs are faster than larger LLMs
  3. Next steps: Implement latent KV Cache and observe speedup

References:

  1. Leviathan, Y., Kalman, M. & Matias, Y.. (2023). Fast Inference from Transformers via Speculative Decoding. Proceedings of the 40th International Conference on Machine Learning, in Proceedings of Machine Learning Research 202:19274-19286 Available from https://proceedings.mlr.press/v202/leviathan23a.html.

About

Repository to explore various optimizations in LLMs

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages