Skip to content

Instantly share code, notes, and snippets.

View createthis's full-sized avatar

Jesse createthis

View GitHub Profile
@createthis
createthis / topk_selector_analysis.md
Last active October 12, 2025 16:28
Analysis of topk_selector.py by DeepSeek V3.1-Terminus when given DSA context

This code implements a high-performance Top-K selection algorithm using TileLang for GPU acceleration. I'll explain it line by line, focusing on the radix-based selection approach.

1. Imports and Configuration

import torch
import tilelang
import tilelang.language as T
pass_configs = {
 tilelang.PassConfigKey.TL_DISABLE_THREAD_STORAGE_SYNC: True,
@createthis
createthis / fp8_lighting_indexer_analysis.md
Last active October 12, 2025 14:13
Analysis of fp8_lighting_indexer.py by DeepSeek V3.1-Terminus when given DSA context

This code implements the DeepSeek Sparse Attention (DSA) lightning indexer, which computes index scores for efficient attention using FP8 precision. I'll explain it line by line, breaking it into logical sections. The code uses TileLang (a DSL for GPU kernels) and PyTorch for high-performance computation.

1. Imports and Utility Functions

# ruff: noqa
import itertools
import tilelang
from tilelang import language as T
import torch
@createthis
createthis / deepseek_sparse_attention.md
Last active October 12, 2025 16:16
ds v3.2-exp first page - markdown

1. Architecture

Compared with DeepSeek-V3.1-Terminus, the last version of DeepSeek-V3.1, the only architectural modification of DeepSeek-V3.2-Exp is the introduction of DeepSeek Sparse Attention (DSA) through continued training.

Prototype of DSA. The prototype of DSA primarily consists of two components: a lightning indexer and a fine-grained token selection mechanism.

The lightning indexer computes an index score $I_{t,s}$ between the query token $\mathbf{h}_t\in\mathbb{R}^d$ and a preceding token $\mathbf{h}_s\in\mathbb{R}^d$, determining which tokens to be selected by the query token:

$$

@createthis
createthis / deepseek_v3_2_exp_chat_template.jinja
Created October 7, 2025 23:38
DeepSeek V3.2-Exp chat_template.jinja
{% if not add_generation_prompt is defined %}
{% set add_generation_prompt = false %}
{% endif %}
{% if not thinking is defined %}
{% set thinking = false %}
{% endif %}
{% set ns = namespace(is_first=false, is_tool=false, system_prompt='', is_first_sp=true, is_last_user=false, is_only_sys=false, is_prefix=false) %}
{%- for message in messages %}
{%- if message['role'] == 'system' %}
{%- if ns.is_first_sp %}
@createthis
createthis / parse_json_tool_calls.md
Last active September 8, 2025 01:13
parse_json_tool_calls update_cursor true vs false

Input number line (per character)

<|tool▁calls▁begin|><|tool▁call▁begin|>get_time<|tool▁sep|>{"city": "Tokyo"}<|tool▁call▁end|><|tool▁calls▁end|>
|                  |                  |        |          |                 |               |                 |
0                  19                 38       47         58                76              92              110

Input number line (per byte)

@createthis
createthis / unsloth_dynamic_2_vs_aider_deepseek_v3_1.py
Last active September 17, 2025 22:02
unsloth_dynamic_2_vs_aider_deepseek_v3_1.py
import React from "react";
import { ResponsiveContainer, LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, Legend } from "recharts";
const showPassRate1 = false;
const data = [
{ name: "TQ1_0", unsloth: undefined, aider: 51.6, pass_rate_1: 19.1 },
{ name: "IQ1_M", unsloth: 79.8, aider: 56.9, pass_rate_1: 24.0 },
{ name: "TQ1_0-thinking", unsloth: undefined, aider: 60.4, pass_rate_1: 26.2 },
{ name: "IQ2_XXS", unsloth: 80.3, aider: undefined, pass_rate_1: undefined },
{ name: "IQ2_M", unsloth: 80.78, aider: 61.3, pass_rate_1: 36.4 },
@createthis
createthis / unsloth_chat_template.jinja
Created August 24, 2025 16:46
Unsloth DeepSeek-V3.1 Human Readable chat_template.jinja
{#- Unsloth template fixes #}
{% if not add_generation_prompt is defined %}
{% set add_generation_prompt = false %}
{% endif %}
{% if enable_thinking is defined and enable_thinking is false %}
{% set thinking = false %}
{% elif enable_thinking is defined and enable_thinking is true %}
{% set thinking = true %}
{% elif not thinking is defined %}
{% set thinking = false %}
@createthis
createthis / chat_template.jinja
Created August 24, 2025 16:46
DeepSeek-V3.1 Human Readable chat_template.jinja
{% if not add_generation_prompt is defined %}
{% set add_generation_prompt = false %}
{% endif %}
{% if not thinking is defined %}
{% set thinking = false %}
{% endif %}
{% set ns = namespace(is_first=false, is_tool=false, system_prompt='', is_first_sp=true, is_last_user=false) %}
{%- for message in messages %}
{%- if message['role'] == 'system' %}
{%- if ns.is_first_sp %}
@createthis
createthis / md
Created March 31, 2025 13:16
larry vibe coding demo - prompt 1
We have some code:
**bjj_calculate_match_difficulty.js**
```js
function calculateMatchDifficulty(practitioner1, practitioner2) {
const beltRanks = ['white', 'blue', 'purple', 'brown', 'black'];
// Calculate the difference in belt ranks
const beltDiff = beltRanks.indexOf(practitioner2.belt) - beltRanks.indexOf(practitioner1.belt);
// Calculate the cumulative effect of age, weight, and height
@createthis
createthis / changes.patch
Created July 25, 2017 01:12
Final IK changes for positioning feet using hip tracker
diff --git a/Assets/Plugins/RootMotion/FinalIK/IK Solvers/IKSolverVRLocomotion.cs b/Assets/Plugins/RootMotion/FinalIK/IK So
lvers/IKSolverVRLocomotion.cs
index 122de1b..0b16128 100644
--- a/Assets/Plugins/RootMotion/FinalIK/IK Solvers/IKSolverVRLocomotion.cs
+++ b/Assets/Plugins/RootMotion/FinalIK/IK Solvers/IKSolverVRLocomotion.cs
@@ -12,12 +12,6 @@ namespace RootMotion.FinalIK {
[System.Serializable]
public class Locomotion {
- [Tooltip("The toe/foot target.")]