Hybrid retrieval

하이브리드 검색

Combine lexical matches with semantic vector candidates.

···
html
<div class="v"><header><b>HYBRID RETRIEVAL</b><span id="state"></span></header><main><div class="sources"><div>KEYWORD<div id="lex"></div></div><div>VECTOR<div id="vec"></div></div></div><div class="merged" id="merged"></div></main><footer>two retrieval paths, one pool</footer></div>
css
.v{width:min(92vw,660px);height:min(86vh,310px);box-sizing:border-box;padding:clamp(9px,2.5vmin,18px);border:1px solid var(--line);border-radius:14px;background:var(--surface);display:flex;flex-direction:column;gap:7px;color:var(--fg);font:500 clamp(15px,4.5vmin,19px)/1.25 var(--font-sans, sans-serif)}.v header,.v footer{display:flex;justify-content:space-between;align-items:center;gap:8px;white-space:nowrap}.v header b{color:var(--accent);font-size:.9em}.v header span,.v footer{color:var(--muted);font-size:.82em}.v main{flex:1;min-height:0;position:relative;overflow:hidden}.v .mono{font-family:ui-monospace,SFMono-Regular,Consolas,monospace}.v .active{background:var(--accent)!important;color:var(--bg)!important;border-color:var(--accent)!important}.v .muted{opacity:.45} .sources{height:66%;display:flex;justify-content:space-around;gap:8px}.sources>div{width:45%;text-align:center;color:var(--muted);font-size:.8em}.sources b,.merged b{display:inline-block;margin:3px;padding:5px 8px;border:1px solid var(--line);border-radius:5px;color:var(--fg);font:600 1em ui-monospace,monospace}.merged{text-align:center;color:var(--accent);font-size:.85em}
js
let n=0;function draw(){document.getElementById("lex").innerHTML=["A","C"].map(x=>"<b class=\""+(n===0?"active":"")+"\">"+x+"</b>").join("");document.getElementById("vec").innerHTML=["B","A"].map(x=>"<b class=\""+(n===1?"active":"")+"\">"+x+"</b>").join("");document.getElementById("merged").innerHTML=n===2?"merged: <b>A</b><b>B</b><b>C</b>":"merge pending";document.getElementById("state").textContent=["lexical","semantic","combined"][n];n=(n+1)%3}draw();setInterval(draw,1000)

Lexical search finds exact terms; vector search finds semantically similar material even with different wording. Hybrid retrieval combines the candidate sets to reduce misses from either method alone.

Their raw scores may have different scales. Direct addition can over-weight one source, so use and evaluate a rank fusion or score normalization strategy.

When to use

Use it when retrieval must handle both exact identifiers and natural language.

Open as page ↗