Vector search finds the right chunk but ranks it badly and waves through near-garbage that's vaguely on-topic. Reranking fixes that with a second model - a cross-encoder that reads the query and each chunk together instead of comparing two frozen vectors. The whole trick is affording an expensive judge by only running it on the cheap stage's survivors.
Duncan Leung
📚 Learning, 👨🏻💻 Building, 📝 Documenting...
Hi! I'm Duncan Leung and I currently lead Frontend Engineering at Airvet.
In a previous career I worked overseas in Beijing as a Product Manager at a skunkworks studio building digital experience projects for Ford Motor (China) and consulted on UX projects for Starwood Hotels. During this time I also mentored startups at Chinaccelerator and ran startup events and hackathons in Shanghai.
👨🏻💻 I'm a self taught software developer, and this is a place for me to jot down some notes. I mostly cover Javascript, Typescript, React, and software development.
Latest Writing
- Read article
- Read article
A guide to set up a modern Python development environment using uv, the fast all-in-one tool from Astral that replaces pyenv, virtualenv, and Poetry.
- Read article
Most env-var validation checks that values exist. That catches missing config but misses the worse case - a value that is present, valid in shape, and silently wrong. Here is the asymmetric pattern for separating loud failures from silent ones in a Next.js server.
- Read article
When one Go struct legitimately serves multiple consumer roles - producer, service, admin - declare three interfaces and let DI cache the singleton at the wide type while each consumer holds only the methods it can call. Same shape as io.ReadWriteCloser in the stdlib.
- Read article
Most SQS idempotency guides reach for Redis dedupe keys or dedupe tables. If your worker's job ends in a terminal state-machine transition, the row's own status column is already the lock - and one UPDATE statement is the entire safety story.
Newsletter
Stay updated, receive the latest post straight to your mailbox