Speculative Decoding: Faster LLM Inference (Python)
Build a speculative decoding simulator in Python. Learn the draft-verify algorithm, measure acceptance rates, and understand when it speeds up LLM inference.
Build a speculative decoding simulator in Python. Learn the draft-verify algorithm, measure acceptance rates, and understand when it speeds up LLM inference.
Build a Mamba SSM layer from scratch in NumPy. Learn selective state spaces, implement selective scan, and benchmark SSM vs attention scaling with runnable...
Build a Mixture of Experts (MoE) layer in Python with NumPy. Router, top-k gating, load balancing, and expert networks — with runnable code and...
Build MHA, GQA, and MQA attention from scratch in NumPy. Calculate KV cache VRAM for Llama 3 70B, Mistral 7B, and any model with...
Build sinusoidal, RoPE, and ALiBi positional embeddings from scratch in NumPy. Runnable code, heatmaps, and a clear comparison of all three schemes.
Build transformer attention from scratch in NumPy with runnable code. Scaled dot-product, multi-head attention, causal masking, and heatmaps step by step.
Master LLM temperature, top-k, and top-p with interactive Python simulations. Runnable code, exercises, and a sampling playground to build real intuition.
Learn how LLMs work step by step. Build an inference simulator in Python — tokenize, embed, compute attention, sample, and decode with runnable code...
3 min
numpy.random.randint function is used to get random integers from low to high values. The low value is included while the high value is excluded...
3 min
The np.random.uniform() function is used to create an array with random samples from a uniform probability distribution of given low and high values. random.uniform(low=0.0,...
2 min
The np.sort() function is used to sort the array along a specified axis. Numpy.sort (a, axis=- 1, kind=None, order=None) Purpose: This function is used...
4 min
numpy.median function is used to calculate the median of an array along a specific axis or multiple axes. Median is defined as the middle...
8 min
The numpy.where() function is used to filter data based on the conditions provided. These conditions can vary from being as simple as value comparisons...
4 min
How to use numpy.random.rand() function ? numpy.random.rand() function is used to generate random float values from an uniform distribution over [0,1). These values can...
10 min
How to reshape a numpy array? The numpy.reshape() function is used to reshape a numpy array without changing the data in the array. It...
13 min
Numpy is the core package for data analysis and scientific computing in Python. This is part 2 of a mega numpy tutorial. In this...
10 min
NumPy is the backbone of data science in Python. This tutorial covers arrays, indexing, reshaping, and random numbers — all the basics you need...
Get the exact 10-course programming foundation that Data Science professionals use.