Skip to content

Instantly share code, notes, and snippets.

Choosing Between Agents and Graphs for Dynamic Decision-Making

When designing a system that requires dynamic, adaptive decision-making, the choice between using an agent (e.g., LangChain or OpenAI-style tool-using agent) versus a graph (e.g., LangGraph) depends on several factors.


✅ Use a Graph When:

1. You Have a Known Workflow or Flowchart

  • Tasks follow a sequence with branching logic.

LangGraph State Management Heuristics

This document outlines heuristics and warning signs that indicate when your LangGraph state may be too large or messy to manage effectively.


🔁 1. Cyclic or Deeply Nested State Patterns

  • Sign: Heavy reliance on nested dictionaries/lists (state["a"]["b"]["c"]).
  • Why it matters: Difficult to track updates, read, and debug.
  • Heuristic: More than 2–3 levels of nesting or needing custom update logic indicates excessive complexity.

LoRA vs Full Fine-Tuning vs QLoRA

Real-World Scenario

Task: Fine-tune a base language model to act as a customer support chatbot for a telecom company.


Full Fine-Tuning

LLaMA-2 QLoRA Fine-Tuning Walkthrough

This document explains in detail how we fine-tune the NousResearch/Llama-2-7b-chat-hf model on a financial tweet sentiment dataset using the QLoRA method. The training is done using Hugging Face Transformers, PEFT (LoRA), and bitsandbytes for 4-bit quantization.


📂 Model & Dataset

model_name = "NousResearch/Llama-2-7b-chat-hf"

Fix the Bug – React + Three.js Canvas Game

Problem / Spec

Avatar: Elena is building a small 3D mini-game in React + Three.js. It renders a basic scene with a player cube that can move left and right. But there’s a bug: the cube sometimes jumps or lags when key events fire rapidly, and the frame render isn't synced well with React state.

Application: A React + Three.js app where you need to fix a real rendering + input issue.


Reproduce the Issue

A List of problems for the technical interview phase along with a capstone project problem

PROBLEM 1: Longest Substring Without Repeating Characters

Problem Statement

Given a string s, find the length of the longest substring without repeating characters.

Concepts Covered

  • Sliding Window
  • Hashing

PROBLEM 9: Regular Expression Matching

Problem Statement

Given an input string s and a pattern p, implement regular expression matching with support for '.' and '*':

  • '.' Matches any single character.
  • '*' Matches zero or more of the preceding element.

The matching should cover the entire input string (not partial).

PROBLEM 8: Word Ladder

Problem Statement

Given two words, beginWord and endWord, and a dictionary wordList, return the length of the shortest transformation sequence from beginWord to endWord, such that:

  1. Only one letter can be changed at a time.
  2. Each transformed word must exist in the wordList.

Return 0 if no such sequence.

PROBLEM 7: Longest Consecutive Sequence

Problem Statement

Given an unsorted array of integers nums, return the length of the longest consecutive elements sequence.

You must write an algorithm that runs in O(n) time.

Concepts Covered

  • HashSet for fast lookup
  • Greedy Expansion

PROBLEM 10: Longest Substring with At Most K Distinct Characters

Problem Statement

Given a string s and an integer k, return the length of the longest substring that contains at most k distinct characters.

Concepts Covered

  • Sliding Window
  • HashMap for Character Frequency
  • Edge Case Handling