Tag: math

Piecewise Linear Curves in PyTorch
Reading Time: 8 minutes
In this blog, I will train a simple piecewise linear curve on a dummy data using pytorch. But first, why piecewise linear curve? PWL curves are set of linear equation joined at common points. They allow you to mimic any non linear curve and their simplicity helps you explain the predictions. Moreover, they can be…

On Preference Optimization and DPO
Reading Time: 6 minutes
Introduction Training with preference data has allowed large language models (LLMs) to be optimized for specific qualities such as trust, safety, and harmfulness. Preference optimization is the process of using this data to enhance LLMs. This method is particularly useful for tuning the model to emphasize certain features or for training scenarios where relative feedback…

External Knowledge in LLMs
Reading Time: 10 minutes
[medium and substack discussion] LLMs are trained on finite set of data. While it can answer wide variety of questions across multiple domain, it often fails to answer questions which are highly domainspecific and out of its training context. Additionally, training LLMs from scratch for any new information is not possible like traditional models with…

Mathematical Expectation for Interviews
Reading Time: 5 minutes
In this post, I will just solve for expected value of a probabilistic model with as many methods as I can. You can encountered these types of problem in data science and quant interviews. Problem Assume there is a 2×2 grid, as shown in the figure below. You can randomly walk to a neighboring block…