Limin’s Machine Learning Lab
  • Archive
Categories
All (31)
Agent (2)
Agentic Patterns (4)
Attention Mechanism (2)
Fine-tuning (2)
Function calling (3)
Information Theory (1)
LangChain (4)
Linear Algebra (2)
Llama 2 (3)
LlamaIndex (1)
MLC LLM (1)
Mistral (4)
Paper Reading (7)
Prompt Engineering (9)
PyTorch (5)
Reflection (2)
Tabular data (2)
TensorFlow (4)
Tool Use (3)
Transformer (1)
Visualization (3)
openai (3)

 

Reflexion + ReAct with Gemini 1.5

Agentic Patterns
Reflection
Tool Use
Prompt Engineering
Paper Reading
Reflexion [1] is a method that allows an AI agent to learn and improve by reflecting on past failures, like humans do. The agent reflects on internal and external feedback…
Jul 16, 2024

Self-refine with Gemini 1.5

Agentic Patterns
Reflection
Prompt Engineering
Paper Reading
Self-refine [1] is an approach that iteratively improves a model’s output based on its own feedback. It is suitable for stronger models. Given an initial output, it consists…
Jul 6, 2024

A function calling agent for document QA

Agentic Patterns
Function calling
Tool Use
LlamaIndex
Mistral
Jun 6, 2024

Function calling with Mixtral-8x22B-Instruct-v0.1

Agentic Patterns
Function calling
Tool Use
Tabular data
Mistral
May 29, 2024

 

Function calling with Mistral-7B-Instruct-v0.3

Mistral
Function calling
Tabular data
import json
import os
import sqlite3
import torch

from pathlib import Path

from mistral_inference.model import Transformer
from mistral_inference.generate import generate
…
May 26, 2024

 

Fine-tuning Mistral-7B-Instruct-v0.2 for synthetic datasets generation

Fine-tuning
Mistral
Fine-tune Mistral-7B-Instruct-v0.2 for generating prompts based on given texts. The fine-tuned model could be used to generate synthetic datasets for a certain domain, which…
Jan 10, 2024

How to fine-tune, compile and serve Llama2 7B-chat for summarization on a single GPU (12GB)

Fine-tuning
Llama 2
MLC LLM
This notebook is a step-by-step guide to fine-tuning, compiling and serving a Llama 2 7B model for dialogue summarization on a 12GB consumer graphics card. We’ll use SFTTrain…
Oct 25, 2023

Implementing the original Transformer model in PyTorch

Paper Reading
Attention Mechanism
Transformer
PyTorch
My implementation of the Transformer model proposed in the original Transformer paper [1] in PyTorch.
Oct 7, 2023

Understanding Tree-of-Thoughts (ToT)

Prompt Engineering
Paper Reading
Tree-of-Thoughts (ToT) [1] is a framework for LLM inference. It allows models to explore multiple reasoning paths and make deliberate decisions for problem solving. ToT…
Aug 5, 2023

Experiment ReAct prompting with Llama 2 70B-chat

Llama 2
Agent
Prompt Engineering
LangChain
ReAct [1] is a method that uses Large Language Models (LLMs) to create reasoning and actions for tasks in an interleaved way. Reasoning helps the model to create, monitor…
Aug 1, 2023

Understanding ReAct Prompting

Paper Reading
Prompt Engineering
Agent
In their paper, Yao et al. [1] introduce ReAct, a method that leverages the reasoning and decision-making capabilities of large language models (LLMs) to solve complex…
Jul 29, 2023

Understanding Chain-of-Thought (CoT)

Paper Reading
Prompt Engineering
Chain-of-Thought (CoT) [1] is a technique that enhances the reasoning capabilities of large language models (LLMs). It breaks down complex tasks into multiple intermediate…
Jul 26, 2023

How to construct prompts for Llama 2 and chat with it?

Llama 2
Prompt Engineering
In order to get the best results from Large Language Models (LLMs), prompts should be optimized to tell LLMs what to do and how to do it. One important consideration is that…
Jul 24, 2023

 

Experiment with Prompt Engineering

openai
Prompt Engineering
This notebook contains study notes of the short course ChatGPT Prompt Engineering for Developers of DeepLearning.AI.
Jul 15, 2023

 

Programming with ChatGPT API

openai
Prompt Engineering
This notebook contains study notes of the short course Building Systems with the ChatGPT API of DeepLearning.AI.
Jul 9, 2023

 

Embedding and Searching PDF

LangChain
LangChain has a PyPDFLoader data loader that can load a PDF file. It requires the pypdf package to be installed.
Jul 9, 2023

 

Training with accelerate

PyTorch
Accelerate is a library from HuggingFace.
Jun 29, 2023

 

Training and Evaluation Loop

PyTorch
Preparation steps before starting training.
Jun 29, 2023

 

Preprocessing Datasets Using PyTorch

PyTorch
GLUE SST-2 is a dataset containing movie reviews and their sentiments as labels.
Jun 26, 2023

 

Using Trainer API

PyTorch
The function load_dataset allows to load a subset of data.
Jun 26, 2023

 

openai API with LocalAI

openai
Using openai API with locally running LLMs.
Jun 17, 2023

 

LangChain with LocalAI

LangChain
LocalAI is able to run LLMs locally, and offers REST API compatible with OpenAI API.
Jun 17, 2023

 

Using LangChain Memory

LangChain
Play with LangChain memories.
Jun 17, 2023

Bahdanau Attention

Paper Reading
Attention Mechanism
Basic encoder-decoder architecture encodes the input sequence into a fixed-length context vector, which is a performance bottleneck according to Bahdanau et al. [1]. They…
Jun 6, 2023

 

Information measures

Information Theory
A list of information measure formulas [1].
Aug 17, 2022

Tune learning rate

TensorFlow
The model converges much faster than before.
Aug 16, 2022

Plot decision boundary

Visualization
TensorFlow
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from sklearn.datasets import make_moons
Aug 12, 2022

Visualization of Conv2D layers

Visualization
TensorFlow
from tensorflow.keras import (datasets, models, layers)
import matplotlib.pyplot as plt
May 23, 2022

 

Keras callbacks

TensorFlow
from tensorflow.keras import (datasets, callbacks, models, layers, optimizers, losses)
Mar 25, 2022

Vector projection on a line

Linear Algebra
Visualization
\[ L = \{x \in \mathbb{R}^2: \left<x, w\right> + b = 0 \}, where\ w\in\mathbb{R}^2, b\in\mathbb{R} \]
Nov 17, 2021

 

Matrix rank factorization

Linear Algebra
A matrix can be factorized as \(A = C*R\), where \(C\) is a basis of the column space, and \(R\) is row-reduced echelon form of \(A\) without zero rows [1]. All three…
Oct 10, 2021
No matching items