Why Embedding Models Give High Cosine Similarity Scores for Unrelated Text
Unrelated text scores 0.7+ with BGE, E5 and GTE. The reason is the InfoNCE temperature, not overfitting. A first principles walkthrough with the math.
Building production LLM and NLP systems: retrieval, semantic search, embeddings, and agents that run at scale, not in a notebook.
Notes on LLM systems, semantic search, embeddings, retrieval, attention, PyTorch, and NLP engineering.
Concise explanations for specific technical problems, with examples and implementation details.
Unrelated text scores 0.7+ with BGE, E5 and GTE. The reason is the InfoNCE temperature, not overfitting. A first principles walkthrough with the math.
Lessons from HuggingFace's FineWeb 15T-token recipe: base filtering, why more deduplication can hurt, C4 filters, and how FineWeb-Edu picks quality.
Guarantee an LLM only emits labels from your taxonomy: mask invalid logits to negative infinity and drive the choice with a tokenization-aware trie.
How Gemma 3 got faster and leaner: SigLIP over CLIP, 128K context by interleaving, grouped-query attention, QK-Norm, and quantization-aware training.
Why transformer attention masks future tokens with negative infinity instead of zero, what softmax does to each, and how to implement it in PyTorch.
Why \xa0 breaks your text, and how Unicode NFC, NFD, NFKD, and NFKC normalization fix encoding issues in Python.
Part 2 of a FlashAttention series: what FlashAttention is, how kernel fusion cuts memory traffic, and its effect on LLM training speed and quality.
Part 3 of a FlashAttention series: the V1 algorithm in detail, covering tiling, safe softmax, and the online normalizer calculation that makes it work.
Part 1 of a FlashAttention series: how data moves through a system, the GPU memory hierarchy, and why attention is bottlenecked by memory bandwidth.
Practical lessons from building ML and deep learning models: visualizing embeddings with t-SNE and UMAP, weight initialization, and why data wins.