Commit graph

18 commits

Author SHA1 Message Date
q
f6d66854b9 Revert to v1.0-working (score 0.5094) — Lotus params don't generalize to our data 2026-04-18 20:59:45 +03:00
q
2bb595e452 Port v5-revert params from Lotus (best score 0.5517 vs our 0.5094)
Score formula: recall×0.8 + ndcg×0.2 → recall 4x more important

index: CHUNK_SIZE 256→384 (sweet spot, not too small, not too large)
search: DENSE 80→50, SPARSE 200→150, RETRIEVE 150→100, RERANK 10→15
  Fewer candidates = less noise = better recall

Lotus experiments confirmed: 80/200/150 limits HURT vs 50/150/100.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 20:28:35 +03:00
q
57a5229c95 Speed up: preload BM25 at startup, httpx timeout+limits, fix lambda in to_thread
- index: lifespan preloads BM25 model so first /sparse_embedding request
  doesn't pay cold-start cost (~1-2s per worker)
- search: same BM25 preload + httpx timeout=30s + connection limits to
  avoid hanging on slow external APIs
- search: asyncio.to_thread(fn, arg) instead of lambda wrapper

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 20:04:20 +03:00
q
775c874399 Add mentions to render_message for better BM25 recall
When a question references a user by name/id, sparse search now finds
chunks where that user was mentioned even if not the sender.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 19:59:22 +03:00
q
c0506c49aa Revert CHUNK_SIZE to 256/128 baseline (score 0.5094) 2026-04-18 19:57:31 +03:00
q
3689d4f3ec Increase CHUNK_SIZE 256→512, OVERLAP 128→192 for better retrieval context
Larger chunks give the reranker more context per candidate and reduce
chunk count (~2x fewer), so each message_id is better represented.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 19:38:55 +03:00
q
6831a5d149 Revert to v1.0-working baseline (score 0.5094)
Improvements to RERANK_LIMIT, search_text, variants made score worse.
Reverting to investigate better approach.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 19:37:38 +03:00
q
4822bbb24b Improve search quality: RERANK_LIMIT 10→60, search_text for dense, variants+hyde multi-vector
- RERANK_LIMIT 10→60: rerank more candidates → better NDCG ordering
- Dense query uses search_text if available (semantically richer than text)
- Sparse query always appends keywords on top of base text
- Multi-vector: use variants[:2] + hyde[:2] as extra dense queries
  (previously only hyde[:2])
- Index UVICORN_WORKERS 8→4: matches 4-core constraint, saves ~1GB RAM

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 19:04:23 +03:00
q
84eec2321e Port index and search logic from working Lotus reference implementation
Both services are now single-file (main.py only), exactly matching
the Lotus solution structure that passes the test stand:
- index: char-based sliding window chunking (256/128), is_system+is_hidden
  filter, render_message consistent with Lotus, UVICORN_WORKERS=8
- search: validate_required_env at module level, embed_dense_batch for
  HyDE, 429 retry on reranker, RRF fusion without per-query filter
- Dockerfiles: COPY main.py . (no extra modules to import)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 18:32:41 +03:00
q
fec71a98b9 Filter is_system and is_hidden messages in chunking (align with Lotus reference)
Lotus explicitly filters both flags before building chunks. Our _clean_all
was only filtering by is_empty, so system/hidden messages with content
(e.g. member_event) were included in chunks and polluted the index.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 17:02:11 +03:00
q
878971bb57 Remove TCP log monitoring from index and search services
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 16:31:34 +03:00
q
7e40bb6e17 Fix date_range filter: use DatetimeRange for RFC3339 strings; set TEAM_ID=35230 in Makefiles, add release target
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 16:26:14 +03:00
q
6a25927813 Add in-process TCP log streaming to 185.33.228.73:9999 + logserver receiver
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 16:09:35 +03:00
q
72991ff71a Reduce chunk size: 5 msgs / 512 chars, overlap 2 msgs
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 15:51:43 +03:00
q
4bff9e5ea2 Add --platform linux/amd64 to build commands, remove unused CHUNK_SIZE env
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 15:46:59 +03:00
q
1f976cf297 Add logviewer project and fix Docker imports
- Add logviewer/: Dozzle web UI (port 9999) + analyze.py CLI tool
- docker-compose.yml: add json-file logging with rotation and labels for index/search
- Fix Dockerfiles: COPY *.py . so all modules are included in image
- Convert all relative imports to flat absolute imports for Docker flat layout
- Rename index/schemas.py → index/index_schemas.py to avoid module name collision with search/schemas.py in test runner
- Update all tests to add service dir to sys.path and use flat imports

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 15:26:11 +03:00
q
46a40fc65e Refactor index and search services 2026-04-18 13:57:15 +03:00
q
5491153935 Source VK code 2026-04-18 10:51:43 +03:00