
FlashAttention
Background Frequent HBM Access Creates an I/O Bottleneck in Standard Attention The authors focus on the I/O bottleneck in attention, pointing to the frequent HBM accesses in standard implementations as a major cause. To understand what is going on, we first need to look at the memory hierarchy found in GPUs and most other accelerators. Improving Actual Wall-Clock Time, Not Just Reducing FLOPs The authors note that previous work has tried to reduce the compute and memory complexity of attention, but many of those studies do not report improvements in actual wall-clock time. Their explanation is that these approaches tend to focus on reducing theoretical operation counts while overlooking the overhead of memory access. ...

LightMem: Lightweight and Efficient Memory-Augmented Generation
This post summarizes LightMem: Lightweight and Efficient Memory-Augmented Generation. The easiest way to give an LLM agent memory of past conversation is to include the whole history in the prompt every time. That becomes harder to sustain as conversations grow. A long context triggers the “Lost in the Middle” problem, where the model ignores information buried in the middle, and memory systems that re-read the accumulated history on every turn pay for it with higher compute and slower responses. LightMem targets both problems at once. It’s a lightweight memory-generation system that cuts token usage to a fraction of what existing systems need, while outperforming them. ...
Sparse Matrix & CSR
CSR (Compressed Sparse Row) comes up constantly in graph computation and storage optimization. It first appeared in a 1977 Yale University report, the Yale Sparse Matrix Package, which is why it’s sometimes called the Yale format. Researchers designed it to store and process sparse matrices efficiently. What a Sparse Matrix Is A sparse matrix is one where most of the entries are zero. Such matrices appear in scientific computing, graph theory, and machine learning. Real-world data, once you cast it as a matrix, almost always ends up looking like this. Take a social network: even with a million users, any given person typically has around 500 friends. Representing that directly as a matrix would require something on the order of 10^12 entries, roughly 7.3 petabytes. Storing all those zero entries takes space without adding useful information. ...

Ego-Splitting Framework: from Non-Overlapping to Overlapping Clusters
This post summarizes Google’s 2017 KDD paper Ego-Splitting Framework: from Non-Overlapping to Overlapping Clusters. Why Non-Overlapping Clustering Falls Short Real-world networks tend to have plenty of medium-sized communities (roughly 100 members), and a single node frequently belongs to several of them at once. Non-overlapping clustering algorithms assign each node to exactly one community, so they can’t capture that structure. Algorithms that attempt overlapping clustering already existed, but most were either too complex, too inflexible, or lacking in theoretical guarantees. ...

Community Detection
Community detection is the problem of finding communities: sets of densely connected nodes within a graph. Think of it as a form of clustering. Methods like GraphRAG use exactly this technique to break a knowledge graph into manageable pieces. This post covers where modularity, the most widely used metric in community detection, comes from. It then compares Louvain and Leiden, the two algorithms most commonly used to optimize it. Modularity: Measuring How Well-Formed a Community Is Say you’ve formed a community. What does it mean for that community to be “good”? The most common answer in community detection is a metric called modularity. The intuition is simple: compute how many edges you’d expect inside this community if the graph’s edges were wired up completely at random, then measure how far the observed edge count exceeds that expectation. If the connections are too dense to explain away as coincidence, that’s evidence you’ve found a real community. ...

GraphRAG
This post summarizes the Microsoft Research paper From Local to Global: A GraphRAG Approach to Query-Focused Summarization, also drawing on the video [Paper Review] GraphRAG by Seoul National University’s DSBA Lab. RAG works by building a trusted document collection ahead of time, then, when a question comes in, retrieving the relevant documents and handing them to an LLM as grounding for its answer. The basic pieces are indexing (chunking documents into a searchable form), retrieval (finding documents relevant to the question), and generation (producing an answer from the retrieved documents and the question). ...

[Paper Review] SimpleMem: Efficient Lifelong Memory for LLM Agents
This post is a review of SimpleMem: Efficient Lifelong Memory for LLM Agents. Some parts of the paper have been updated after this post was written (2026-01-24), so there may be differences from the version discussed here. Background LLMs are stateless. As a result, previous inference outputs do not directly affect later outputs. Without conversation history in its input, a plain LLM cannot recall what was just discussed, making it difficult to maintain continuity across turns. ...

Concurrent Hash Table Designs: Synchronized, Sharding, ConcurrentHashMap, and NonBlockingHashMap
Discussions Hacker News Reddit The next milestone is to build a fully thread-safe hash map. Up to this point, the focus has been entirely on single-threaded performance: minimizing memory overhead, improving cache locality, and squeezing out every last bit of throughput from the underlying data layout. However, real-world applications rarely stay single-threaded. To be practically useful, a hash map must behave correctly—and efficiently—under concurrent access. Before jumping straight into implementation, it’s worth stepping back and studying how existing thread-safe hash map implementations approach this problem. Different designs make different trade-offs between simplicity, scalability, memory usage, and read/write performance. By examining these approaches side by side, we can better understand which ideas scale cleanly—and where the pitfalls are—when multiple threads hit the same structure at once. ...

Further Optimizing my Java SwissTable: Profile Pollution and SWAR Probing
Discussions Reddit Part 2: optimizing the hot path (and finding a weird villain) “Why Objects.equals() showed up in the profile, and why SWAR beat the Vector API on ARM (and x86).” In the last post, I finally got a SwissTable-ish map running on the JVM and fast enough to make me smile. Naturally, that meant I immediately started staring at the profiler again, thinking: okay… but how do I make it faster? ...

Building a Fast, Memory-Efficient Hash Table in Java (by borrowing the best ideas)
Discussions Hacker News Reddit One day, I ran into SwissTable, the kind of design that makes you squint, grin, and immediately regret every naive linear-probing table you’ve ever shipped. This post is the story of how I tried to bring that same “why is this so fast?” feeling into Java. It’s part deep dive, part engineering diary, and part cautionary tale about performance work. 1) The SwissTable project, explained the way it feels when you first understand it SwissTable is an open-addressing hash table design that came out of Google’s work and was famously presented as a new C++ hash table approach (and later shipped in Abseil). ...