Skip to content

Instantly share code, notes, and snippets.

@RohanAwhad
RohanAwhad / SciKnowEval Run Guide.md
Created August 19, 2026 14:12
Prime RL - SciKnowEval Run Guide

SciKnowEval RL — Beginner Run Guide (default prime-rl, GRPO only)

A step-by-step guide to reproduce cold-start GRPO training on SciKnowEval with prime-rl. By the end you will have RL-trained Qwen3-8B from scratch (no SFT warmstart) on multi-domain scientific MCQ and evaluated the result.

This guide is written from an actual run (Aug 2026) on an 8×H100 node. Everything here was verified to work. Companion to the

@RohanAwhad
RohanAwhad / Prime RL - Reverse Text Run Guide.md
Created August 19, 2026 13:51
Prime RL - Reverse Text Run Guide

Reverse-Text RL — Beginner Run Guide

A step-by-step guide to reproduce the reverse-text RL experiment with prime-rl. By the end you will have fine-tuned Qwen3-0.6B with RL to reverse text, starting from a warm-started (SFT) checkpoint, and evaluated the result.

This guide is written from an actual run (Aug 2026) on an 8×H100 node. Everything here was verified to work.


0. What are we actually doing?

Tensor Parallelism Knowledge Compilation

Core Understanding

Tensor Parallelism (TP) shards individual tensors across devices, following the Megatron-LM pattern:

  • Column-wise: Input projections (q/k/v, gate/up)
  • Row-wise: Output projections (o_proj, down_proj)
  • Sequence Parallel: Shards activations on sequence dimension for memory savings
  • Loss Parallel: Keep logits sharded on vocab dimension for efficient cross-entropy
@RohanAwhad
RohanAwhad / mla.py
Last active February 5, 2025 22:51
Multi-Head Latent Attention
# /// script
# dependencies = [
# "numpy",
# ]
# ///
# multi head latent attention
import numpy as np
@RohanAwhad
RohanAwhad / research.py
Last active February 9, 2025 19:41
One-shot Perplexity Pro
#!/Users/rohan/miniconda3/bin/python
import asyncio
import dataclasses
import json
import openai
import os
import requests
import sys
import time
import json
import openai
from typing import Any
from jupyter_client.manager import KernelManager
kernel_manager: KernelManager = None
def execute_code_in_notebook(code: str) -> list[Any]:
if not code: return []
global kernel_manager
if kernel_manager is None:
import base64
import cv2
import os
import openai
import whisper
import pyaudio
import wave
import uuid
import threading
from queue import Queue
from transformers import AutoTokenizer, AutoModel
import torch
# MODEL CKPT is downloaded from: "jinaai/jina-embeddings-v2-base-en" # has context len of 8192
MODEL_CKPT = "/Users/rohan/3_Resources/ai_models/jina-embeddings-v2-base-en"
def recursive_splitter(text: str, separators: list[str], chunk_size: int) -> list[str]:
if len(separators) == 0:
words = text.strip().split(' ')
import dataclasses
import openai
import os
import re
import yaml
from pydantic import BaseModel, ValidationError
from typing import Optional
@RohanAwhad
RohanAwhad / init.lua
Last active June 2, 2025 19:56
My neovim config
--[[
=====================================================================
==================== READ THIS BEFORE CONTINUING ====================
=====================================================================
======== .-----. ========
======== .----------------------. | === | ========
======== |.-""""""""""""""""""-.| |-----| ========
======== || || | === | ========
======== || KICKSTART.NVIM || |-----| ========