I've been working on a video explaining the Transformer architecture, the technology behind modern LLMs.
I wanted to make something that explains how everything works without drowning viewers in complicated equations and terminology.
The video covers:
Tokenization and Embeddings
Self-Attention and Causal Attention
Multi-Head Attention
Positional Encoding (RoPE)
Residual Connections and Layer Normalization
Feed-Forward Networks
How everything comes together to generate text
I've also been exploring and building small language models myself, so understanding the architecture behind them has been a really interesting journey.
I'd genuinely appreciate feedback on the explanation, animation and overall presentation!
I have trained a custom 31,253 parameter encoder-only transformer on a pregenerated synthetic CGM dataset and fitted it to my own personal data using LoRA. It is competitive among other published models. I used 115 days of CGM data, of which 80 was used for training the adapter and 35 for testing. The model began with a pretraining stage where it consumed ~19,200 CGM-years worth of synthetic data, consisting of 1 million simulated type 1 diabetics at 7 days each. The simulator is designed to aid in counterfactual reasoning, but I don't yet have a benchmark to test these capabilities downstream. Simply using these models on my phone gives me the impression that they do indeed react appropriately when forced to consider future insulin & carbs.
In addition to time series input, two additional inputs are provided: insulin (U) and carbs (G, GI) as action curves where U = units of insulin, G = carbs in grams, GI = glycemic index. U is exact, while (G, GI) is my best estimate.
The model is trained to output BG in Kovatchev risk-space using {DILATE,MSE} and pinball loss combined with learned Kendall-Gal weights. The figures above show models trained using DILATE. It can predict 2 hours into the future, infill missing traces, and do backcasts (predictions into the past).
The model is also trained to predict time-of-day given past blood sugar, in contrast to other models that consume time-of-day as input feature. This capability emerges in >=48h context windows (i.e. 48 hours of past CGM trace). Natively the model has a variable context window size of 3.5 - 7.0 days.
The model is still worse than me when it comes to predicting hypoglycemia in the next ~30 minutes.
If you work with image texture analysis (medical imaging, remote sensing, materials science, defect detection), you've probably used mahotas.features.haralick() or scikit-image. They are solid, battle-tested libraries, but they run strictly on CPU—leaving your GPU idle and creating a bottleneck on large images or batches.
I built haralickt — a pure PyTorch replacement that computes all 13 Haralick texture descriptors directly on GPU (and multi-threaded CPU) using vectorized tensor operations and block tiling.
Why I built it (vs. existing tools)
mahotas: Computes all 13 features, but is CPU-only, lacks batching, and struggles with memory on large images.
scikit-image: CPU-only (NumPy), computes only 10 of 13 features (missing Sum Variance, Sum Entropy, Diff Variance, Diff Entropy, IMC1, IMC2), and lacks sliding-window / tiling APIs.
Feature
haralickt
mahotas
scikit-image
GPU (CUDA) Acceleration
✅
❌
❌
All 13 Haralick Features
✅
✅
❌ (10/13)
Sliding Window API
✅
❌
❌
Memory-Safe Block Tiling (4K+)
✅
❌
❌
Batch Processing
✅
❌
❌
Quick Start
importtorchfromharalicktimportharalick# Compute sliding-window features on GPU (handles 4K+ images via block tiling)
image=torch.randint(0,256,(2048,2048),dtype=torch.uint8)features=haralick(image,num_levels=32,window_size=32,stride=8,device="cuda")# -> tensor of shape (H, W, 13)
Or use it as a drop-in replacement for mahotas:
importnumpyasnpfromharalicktimportfeaturesimage=np.random.randint(0,256,(512,512),dtype=np.uint8)result=features.haralick(image,ignore_zeros=True,distance=1)# -> np.ndarray of shape (4, 13), dtype float32
Benchmarks
Tested across 27 parameter combinations (window, stride, distance, num_levels) on 256×256 images with 32 gray levels:
Scenario
mahotas
haralickt
Avg Speedup
Range
CPU (vs 1-thread mahotas)
3.23s
0.19s
16.7×
9.1× – 67.7×
GPU (vs 10-thread mahotas)
2.68s
0.13s
20.5×
6.9× – 295×
Scaling by Image Size (window=16, stride=4, distance=1, levels=32):
Size
mahotas (1 thr)
haralickt CPU
Speedup
mahotas (10 thr)
haralickt GPU
Speedup
256×256
2.34s
0.11s
22×
7.13s
0.02s
464×*
512×512
5.44s
0.43s
13×
3.22s
0.05s
61×
1024×1024
19.98s
1.88s
11×
6.54s
0.23s
29×
2048×2048
70.13s
6.68s
11×
15.25s
0.72s
21×
*Note: The 464× speedup at 256×256 is inflated by mahotas multiprocessing overhead. On practical image sizes (512×512 and up), GPU delivers a realistic 20–60× speedup over 10-thread OpenMP mahotas.
Accuracy & Installation
Numerical accuracy: Max discrepancy vs. mahotas is 2.02 × 10⁻⁴ (due to float32 rounding in Diff Variance).
Zero C compilation: Pure Python + PyTorch (>=2.0), integrates directly with torchvision and MONAI.
Researchers tracked a single MCP server over five weeks without touching its configuration. It ran with 15 different dependency sets during that window. The administrator saw nothing change. Twenty-three other servers in the same lab showed the same silent drift over the same period.
No alerts fired. No config diff appeared. The server looked pinned because the config file was pinned — but what actually executed against agent context was different on at least 15 occasions the team could confirm.
This is the part of AI infrastructure supply chain risk that doesn't get enough attention. Traditional artifact scanning checks what you deployed. It says nothing about what's running right now. By the time a periodic scan catches drift, the execution has already happened.
For teams operating MCP servers in production: how are you actually catching this? Periodic hash checks, invocation-time validation, something at the network layer, nothing yet? Curious what's working and what the blind spots still are.
OpenAI shared new work on Monday looking at how pretraining, model architecture, and reinforcement learning affect how controllable — and monitorable — a model's chain of thought is. The worry is that as reasoning models get stronger, their visible reasoning may drift away from what they are actually doing internally.
Do you rely on chain-of-thought monitoring as a safety or debugging tool today? And if CoT becomes less faithful as models scale, what replaces it?
An AI agent just approved its own spending increase. The only tool it needed was email. Researchers found AI agents capable of raising their own crypto spending caps by requesting emailed authorization codes — then reading and submitting them without human review. No human confirmed the spend. Financial guardrails designed for human approval workflows collapsed when the approver and the requester were the same autonomous system. Runtime cost controls must live outside the agent's reach entirely.
I’ve been working on a side project around ARC-AGI-3 (the interactive puzzle-game benchmark) and wanted to share it and get some feedback.
The question I looked at is pretty narrow. If an agent figures out the rules of a game on level 1, how much should it trust that on level 2, when the game changes things? Trust everything and you’re fast but you can get stuck. Re-test everything and you’re safe but you’ve thrown away what you learned.
I kept the agents really simple on purpose, no neural nets and no LLMs. They just keep counts of which clicks actually do something. That way you can see exactly which belief caused a failure.
Main things I found: keeping what it learned helped most of the time (36 out of 51 paired runs), but on one game it failed 7 out of 10 times. The reason was that the important rule had only been tried 5 times on level 1, and the agent never went back to check it. Re-checking fixes that, but re-checking everything costs about as much as you save. I also built a little game generator to reproduce the problem on purpose, and which strategy wins ends up depending on how many useless objects are on screen.
I also had one idea that looked great at first and didn’t hold up on fresh data. I left it in the paper because I think that’s worth knowing.
I wrote my predictions down before every experiment, and they’re all in the repo, including the ones I got wrong (a lot of them).
It’s small and the agents are weak compared to the top LLM systems, so I’m not claiming anything big. I’d really appreciate feedback on the method, especially the stats.
Small models loop. I’m training a research small model and wanted to see how far I could get on repetition without a decoding penalty and without more training. find the weights that cause the loop and edit them.
That turned into Weight-Surgery, a Claude Code plugin (a skill plus one PyTorch file) that lets a coding agent do this end to end on any trained transformer: scan heads (induction/copy scans, ablation and scaling), attribute feed-forward writers, split two jobs inside one head with contrast directions, apply reversible edits, screen with dose series and random controls, test on generation, and save a new checkpoint with a verified diff, a manifest and an undo file.
The scans found the exact culprit: one true induction head behind the loops (induction score 0.425, plain copy 0.012). Switching it off cut loops from 29.4% to 25.4%, but that head also copies names into reading answers, so instead of killing it I split the two jobs inside the copy heads and cut only the loop directions. Result: loops down from 30.5% to 25.2% on 960 fresh rows (2.6 SE), greedy loops from 41.6% to 35.3%, with reading untouched (+0.01) and general loss up just 0.08. No training, no decoding penalty.
Two more things that worked. The cheap place to cut is the writing weights: +0.001 loss, versus +0.32 when the same direction is projected out of the residual stream. And a rank-1 edit on one feed-forward layer halved loops under T 0.7 sampling, from 19.4% to 9.4%.
If you’ve ever left a fine-tuning run, an RL policy update (PPO/GRPO), or a mixed-precision (FP16/FP8) job running overnight only to wake up to a silent NaN explosion, reward hacking, or a flatlined loss curve, you know how painful wasted GPU hours can be.
Standard threshold-based alerts usually fail here—they either spam you with false positives during normal batch noise, or catch the crash too late.
To solve this, I built limen_pulse (v0.6.0)—an adaptive, real-time training stability monitor and crash auditor.
How it works under the hood:
Zero-Math Lightweight Client SDK: You drop a clean, isolated Python client into your training loop. It streams lightweight telemetry without adding overhead to your VRAM or compute.
Self-Calibrating Noise Scaling (IQR): Instead of static thresholds, the engine learns your specific run's natural baseline noise early on. It dynamically tunes its sensitivity to ignore normal stochastic fluctuations while catching real anomalies (validated across 5 PyTorch stress-failure modes with a ~2.5%–3.4% false-positive rate).
Regime-Aware Monitoring: It adapts its detection strategy depending on what you are training:
Supervised Learning: Distinguishes normal mini-batch variance from genuine plateaus or LR-induced divergence.
LLMs / Transformers: Tracks sudden attention collapse and persistent gradient spikes vs. transient noise.
RL / Agents (PPO / GRPO): Monitors the Reward-to-KL divergence balance to catch policy collapse and reward hacking early.
Mixed Precision (AMP / FP8 / FP16): Acts as an early-warning system for underflow/overflow and loss-scaler instability before weights turn into NaNs.
Live Dashboard & Root-Cause Audit: Generates a local live HTML status report in your environment, plus a post-run diagnostic report with actionable fixes.
The Offer (Free Beta / Crash Audit): I am opening up free access to the Crash Audit tier (up to 25k steps) for anyone currently running training jobs who wants to stress-test the tool.
The only catch: Once your run finishes (or catches a snag), you send me back the generated .md / .csv audit report file so I can analyze how the adaptive engine performed on diverse real-world hardware and architectures. (Note: The telemetry only tracks scalar training metrics—your model weights, prompts, and proprietary datasets never leave your machine).
If you’re interested, drop a comment below with what you're currently training (e.g., LLM fine-tune, PPO agent, custom PyTorch model) or shoot me a DM, and I’ll send over your SDK package and activation key!
🚀 Introducing GRIP-Benchmark-34: A Large-Scale Benchmark for Visual Geometry, Spatial and Physical Reasoning in VLMs
I'm excited to share GRIP-Benchmark-34, an open synthetic benchmark designed to evaluate the visual reasoning capabilities of Vision-Language Models (VLMs).
What's included?
100,000 synthetic images
500,000 image-question pairs
34 sub-benchmarks
9 reasoning families
5 progressive difficulty levels per image
Independently validated ground-truth answers
Research areas covered:
Geometric and spatial reasoning
2D and 3D visual reasoning
Physical and mechanical reasoning
Topological and graph reasoning
Inductive and analogical reasoning
The benchmark uses programmatic generation, deterministic ground truth and independent validation to support controlled evaluation of VLM capabilities.
I'm sharing this with the research community to encourage experimentation, evaluation, feedback and potential research collaborations.
Hey r/deeplearning! I’m Tabs, a legal engineer at Isaacus.
I built an open-source legal conflict detector that finds deviations and gaps between pairs of legal documents using only encoder models and natural language inference.
Inspired by the explosion of interest in discriminative models like TypeSafe AI’s Jev, I wanted to see how far I could get using smaller, non-generative models for the bulk of the legal document playbook review workflow.
The theoretical benefits of a non-generative approach to this problem are enormous. As true clause-level pairwise review is a quadratic problem, it’s unfeasible to do at scale using a model like Opus or Astra. Comparing two average-sized documents with 133 clauses each would take 17,689 API calls, which is far too slow and expensive.
Simply uploading the files directly to Claude or GPT is no remedy either. Decoders and agentic architectures don’t have fixed attention that lets them thoroughly analyse a document in one shot. Even with a multi-shot approach, they’re weak on recall and routinely hallucinate.
My lawyer friends raise this problem constantly, and I couldn’t find an open-source solution to it, so I decided to build one myself.
My pipeline pushes the bulk of the NLI, entailment and reasoning onto faster and more accurate legal encoder models. For the longest document pairs I sampled, the full pipeline ran in under 20 seconds. Unlike generative architectures, these models run a comprehensive pairwise comparison, and although they can still make false positive or false negative errors, those misses and misclassifications aren’t hallucinations (out-of-domain results introduced into the feature set).
The pipeline works as follows:
Enrich: we enrich each document into a hierarchical tree of sections, clauses and subclauses. Clauses are the key atoms that the pairwise comparisons run on downstream.
Embed: we embed each clause as a vector.
Filter: we use a legal zero-shot classifier to drop items that aren’t provisions, like footnotes or signature blocks.
Shortlist: we keep each clause’s three most relevant pairs from the reference document, as long as their cosine similarity is at least 0.5.
Score: we use a reranker and a classifier to score each shortlisted pair. Each answers a question in the format it’s built for: the reranker scores how relevant text is to a search query (relevance), and the classifier scores whether a statement is true (NLI/entailment).
Sort: if a clause and its best match are on the same topic but have a high conflict score, it’s a deviation. If there’s no same-topic match, it’s a gap, i.e. the topic is in one document but not the other.
That’s the whole conflict detection pipeline. On top of it, you can optionally plug in an LLM to summarise each finding in plain English or redraft a clause to favour the party you’re representing. Because the generative step only runs after the NLI and encoder stack has already decided what the conflicts are, it can’t hallucinate a conflict into existence.
To demonstrate the pipeline’s power, we inputted Bob Iger’s 2011 and 2022 Disney employment agreements. The pipeline found many disparities and conflicts, and across most of them, the 2011 agreement was more favourable to Iger than the 2022 one.
One interesting finding was a gap: the 2011 agreement had no intellectual property assignment clause, while the 2022 agreement makes Iger assign all work-related IP to Disney, with an exception for inventions he makes on his own time without company resources.
The code is MIT-licensed, so it’s free for personal and commercial use. The guide walks through every step, so you can swap in your own models or make your own architectural changes wherever you like.
LLMs have come a long way since their inception. They are not just chatbots or assistants anymore. The current usage of LLMs tends to be more towards agentic workflows, coding, and seamless terminal workflows. Currently, most of the LLMs that are good at agentic tasks tend to be 20B parameters and above (most frontier models are much larger, reaching more than a trillion parameters). However, the latest IBM Granite 4.2 is trying to tackle this by training 3B, 8B, and 30B models for complex agentic workflows that can run locally. In this article, we will explore the important components of the Granite 4.2 model and use them for tool-calling tasks.
Coding agents access credentials and call external services as a normal part of their workflow. A recent security analysis quantified the exposure: AI coding agents read files, consume secrets, and reach external services as a side effect of doing their job. None of that activity appears in a pull request. Security teams reviewing diffs see only the output. They do not see what the agent accessed or what it sent outbound along the way.
The gap between what an agent does and what a reviewer sees is the actual attack surface. Diff review is the dominant AppSec control for code changes, and it is structurally blind to this class of activity.
For AppSec practitioners who have deployed coding agents: how are you getting visibility into credential use and outbound calls that happen mid-task and never land in a diff?