Tag: math

  • Piecewise Linear Curves in PyTorch

    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

    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…

  • Creating a Tiny Vector Database, Part 1

    [medium discussion] Introduction Vector databases allow you to search for approximate nearest neighbors from a large set of vectors. They provide an alternative to brute force nearest neighbor searches at the cost of accuracy and additional memory. Previously, many advancements in NLP and deep learning were limited to small scales due to the lack of…

  • External Knowledge in LLMs

    External Knowledge in LLMs

    [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 domain-specific 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

    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…