Skip to content

Instantly share code, notes, and snippets.

View pszemraj's full-sized avatar

Peter pszemraj

View GitHub Profile
@pszemraj
pszemraj / DECORATIVE_MONOSPACE.md
Last active May 4, 2026 02:04
Cursory investigation into new phenomena from GPT 5.5

Decorative Monospace

A formatting failure mode in modern LLM outputs where code blocks are used as a rhetorical device for signaling rigor rather than as semantic markup for content where whitespace, syntax, or literal reproduction matters.

The model isn't trying to communicate "this is code." It's trying to communicate "this is structured thinking" by borrowing the visual texture of a technical document. The texture is decorative; the underlying content is prose.

What it looks like

@pszemraj
pszemraj / parcae_reference.py
Created April 18, 2026 18:50
reference/annotated version of Parcae arch (looped LM) from param golf experiments
"""
parcae_reference.py
═══════════════════
A single-file, heavily annotated reference implementation of the Parcae
architecture (Prairie, Novack, Berg-Kirkpatrick, Fu — arXiv 2604.12946).
PURPOSE
───────
This is a **pedagogical reference**, not a training rig. Every architectural
@pszemraj
pszemraj / start_gemma4_longctx.sh
Created April 5, 2026 06:07
script for launching gemma4 on 5090 via llama-server
#!/usr/bin/env bash
set -e
# a script for running https://hf.co/unsloth/gemma-4-31B-it-GGUF
# on 5090 hardware, targeting long ctx
MODEL_PATH="$HOME/model-weights/llm/gguf/gemma4/gemma-4-31B-it-UD-Q4_K_XL.gguf"
MMPROJ_PATH="$HOME/model-weights/llm/gguf/gemma4/mmproj-BF16.gguf"
CONTEXT_LENGTH=65536
PORT=8674
@pszemraj
pszemraj / doc_check.py
Last active April 18, 2026 21:17
catch missing or incomplete docstrings and typing in python scripts. enforce standards on LLM-generated code.
#!/usr/bin/env python3
"""
CLI tool to check Python files for missing docstrings, type hints, and lazy docstrings.
A 'lazy' docstring is one that only contains a summary without documenting
arguments or return values when the function has 2+ parameters or returns something.
Usage:
python doc_check.py src/ --check-lazy-docstrings
@pszemraj
pszemraj / deepfryer.py
Last active February 27, 2026 08:21
create deep fried memes with python
#!/usr/bin/env python3
"""
Image distortion tool for creating "deep fried" meme-filters.
Dependencies:
pip install universal-pathlib Pillow numpy scipy matplotlib
Usage:
python deepfryer.py --help
@pszemraj
pszemraj / compress_PDF_recursive.sh
Created December 11, 2025 03:14
gs-based PDF compressor, default is heavy compression for VLM input
#!/usr/bin/env bash
set -euo pipefail
# Modern PDF compressor with LLM-optimized defaults
# Requires: ghostscript (gs)
VERSION="1.0.0"
SCRIPT_NAME=$(basename "$0")
# Defaults (LLM preset)
@pszemraj
pszemraj / rnj_inference.py
Created December 10, 2025 04:43
inference with rnj-1
import torch
import time
from transformers import AutoTokenizer, AutoModelForCausalLM
# 1. Basic Timer Context Manager
class Timer:
def __init__(self, name="Task"):
self.name = name
@pszemraj
pszemraj / image_tiling_vlm.py
Created December 4, 2025 21:51
slightly optimized image tiling for VLMs based on "Jina-VLM Small Multilingual Vision Language Model"
"""
slightly optimized image tiling for vlms based on "Jina-VLM: Small Multilingual Vision Language Model"
Based on the pseudocode in Appendix A.1: https://arxiv.org/abs/2512.04032
"""
import math
from typing import List, Tuple
import torch
import torch.nn.functional as F
@pszemraj
pszemraj / colab_output_format.py
Created December 2, 2025 23:07
put this in its own cell at the start of your notebook
#@markdown add auto-Colab formatting with `IPython.display`
from IPython.display import HTML, display
# colab formatting
def set_css():
display(
HTML(
"""
<style>
pre {
white-space: pre-wrap;
@pszemraj
pszemraj / eggroll_numpy.py
Last active November 25, 2025 01:09
working eggroll impl from various LLMs & yours truly
"""
EGGROLL: Evolution Guided General Optimization via Low-rank Learning
NumPy Implementation - Direct translation of working PyTorch code
Paper: arXiv:2511.16652v1
"""
import numpy as np
from dataclasses import dataclass
from typing import Tuple, Optional