Urgent.News

What's breaking now, across thousands of outlets.

Tech

What Hybrid Search Looks Like When It Has to Run on Your Laptop

Suppose you are working in a codebase you did not write, and you type the following question: Where is ERR_CONN_RESET handled? The answer exists. One file contains a catch block that checks for exactly that constant and retries the request. A purely semantic search may not put that file first. It may return a connection-pool module, a general error-handling utility and a retry helper. All three…

Hybrid search is a combination of lexical search and dense search, each with its own strengths and trade-offs. Lexical search preserves exact identifiers, while dense search preserves meaning. Neither approach alone can preserve both. The article explains the process of hybrid search when running on a laptop, specifically using the ctx tool.

The pipeline starts with deciding what a document is, which involves chunking. ctx routes each file by type, creating segments for different file types. Code files are split into segments based on definitions, such as functions, classes, and enums. Markdown files are split using headings and their content. The choice of units for retrieval is crucial, as the retriever can only return the units provided.

The article notes that earlier versions of ctx kept only functions and classes, but later versions also included constants and module-level code, improving retrieval for 69% of code questions.

The dense side of the pipeline involves embedding each chunk into a vector and comparing vectors to answer queries. The default embedding model used is BAAI/bge-large-en-v1.5, which produces 1,024-dimensional vectors. The vectors are L2-normalized and taken from the first token ([CLS]) for BGE models. The article highlights that this approach preserves meaning but may give up precision on very large units, such as a 2,000-line class, which would still be treated as a single definition.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Your Aim Trainer Score Went Up. Did Your Aim Actually Improve?

A faster time can mean better control. It can also mean bigger targets, a different mouse, or a run with fewer misses hidden in the average.

  • Aim Trainer measures pointing ability, but single score doesn't confirm improvement.
  • Faster completion time may result from larger targets, different mouse, or fewer misses.
  • Calculate click accuracy (successful hits/total attempts) to gauge overall performance.

More from Friday 6 November →