Skip to content

Instantly share code, notes, and snippets.

View rishabh135's full-sized avatar

Rishabh rishabh135

  • Japan
View GitHub Profile
@josherich
josherich / a.md
Created May 14, 2025 03:59
Understanding DSPy

OP

Understanding DSPy: Key Insights and Principles

DSPy represents a significant advancement in the field of AI software development. However, its complexity can make it challenging to fully comprehend. This document aims to clarify the foundational principles of DSPy and outline its core tenets.

Introduction

The central thesis of DSPy is that while large language models (LLMs) and their methodologies will continue to evolve, this progress will not be uniform across all dimensions. Therefore, it is essential to identify:

  • The minimal set of fundamental abstractions that enable the development of downstream AI software that is "future-proof" and capable of adapting to advancements.
@willccbb
willccbb / grpo_demo.py
Last active October 25, 2025 16:39
GRPO Llama-1B
# train_grpo.py
#
# See https://github.com/willccbb/verifiers for ongoing developments
#
"""
citation:
@misc{brown2025grpodemo,
title={Granular Format Rewards for Eliciting Mathematical Reasoning Capabilities in Small Language Models},
author={Brown, William},
@vgel
vgel / r1.py
Last active August 14, 2025 13:13
script to run deepseek-r1 with a min-thinking-tokens parameter, replacing </think> with a random continuation string to extend the model's chain of thought
import argparse
import random
import sys
from transformers import AutoModelForCausalLM, AutoTokenizer, DynamicCache
import torch
parser = argparse.ArgumentParser()
parser.add_argument("question", type=str)
parser.add_argument(
@veekaybee
veekaybee / normcore-llm.md
Last active October 22, 2025 08:37
Normcore LLM Reads

Anti-hype LLM reading list

Goals: Add links that are reasonable and good explanations of how stuff works. No hype and no vendor content if possible. Practical first-hand accounts of models in prod eagerly sought.

Foundational Concepts

Screenshot 2023-12-18 at 10 40 27 PM

Pre-Transformer Models

Thoughts and some criticism on "Re-imagining Algorithmic Fairness in India and Beyond".

Yoav Goldberg, Jan 30, 2021

This new paper from Google Research Ethics Team (by Sambasivan, Arnesen, Hutchinson, Doshi, and Prabhakaran) touches on a very imortant topic: research (and supposedly also applied) work on algorithmic fairness---and more broadly AI-ethics---is US-centric[*], reflecting US subgroups, values, and methods. But AI is also applied elsewhere (for example, India). Do the methods and result developed for/in the US transfer? The answer is, of course, no, and the paper is doing a good job of showing it. If you are the kind of person who is impressed by the number of citations, this one has 220, a much higher number than another paper (not) from Google Research that became popular recently and which boasts many citations. I think this current paper (let's call it "the India Paper") is substantially more important, given that it raises a very serious issue that

@kastnerkyle
kastnerkyle / mcts_tictactoe.py
Last active August 16, 2019 06:39
MCTS tictactoe, play 2 against each other, or play against it yourself
# Based on tutorial from https://jeffbradberry.com/posts/2015/09/intro-to-monte-carlo-tree-search/
# Author: Kyle Kastner
# License: BSD 3-Clause
from __future__ import print_function
import random
import copy
import numpy as np
import time
import argparse
import sys
@rtqichen
rtqichen / pytorch_weight_norm.py
Last active May 11, 2023 06:58
Pytorch weight normalization - works for all nn.Module (probably)
## Weight norm is now added to pytorch as a pre-hook, so use that instead :)
import torch
import torch.nn as nn
from torch.nn import Parameter
from functools import wraps
class WeightNorm(nn.Module):
append_g = '_g'
append_v = '_v'
@gyglim
gyglim / tensorboard_logging.py
Last active August 23, 2023 21:29
Logging to tensorboard without tensorflow operations. Uses manually generated summaries instead of summary ops
"""Simple example on how to log scalars and images to tensorboard without tensor ops.
License: BSD License 2.0
"""
__author__ = "Michael Gygli"
import tensorflow as tf
from StringIO import StringIO
import matplotlib.pyplot as plt
import numpy as np
def sample_gumbel(shape, eps=1e-20):
"""Sample from Gumbel(0, 1)"""
U = tf.random_uniform(shape,minval=0,maxval=1)
return -tf.log(-tf.log(U + eps) + eps)
def gumbel_softmax_sample(logits, temperature):
""" Draw a sample from the Gumbel-Softmax distribution"""
y = logits + sample_gumbel(tf.shape(logits))
return tf.nn.softmax( y / temperature)