Repository navigation
Fix: (resume) Cross-verify project experience and work experience, and remove duplicate text - #13323
Conversation
…en a resume embeds project details within work experience sections\n(no separate "Project Experience" block), the LLM extracts the same\ntext into both work_desc_tks and project_desc_tks, producing duplicate\nchunks in the knowledge base.\n\nAdd Phase 3.5 cross-dedup in _postprocess_resume:\n- Substring containment check between normalized texts\n- Token-level overlap ratio threshold (>70%) as fallback\n- Sync project_tks list when removing duplicated entrie
|
Thank you. We are committed to building an international development community. Please ensure that all messages in the PR do not contain any Chinese characters. |
pleae review |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #13323 +/- ##
==========================================
- Coverage 49.18% 47.18% -2.01%
==========================================
Files 44 44
Lines 9749 9749
Branches 110 110
==========================================
- Hits 4795 4600 -195
- Misses 4946 5136 +190
- Partials 8 13 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Improves resume post-processing to reduce duplicated chunks by cross-deduplicating overlapping “work experience” and “project experience” description entries.
Changes:
- Adds a new post-processing phase (Phase 3.5) to remove
project_desc_tksentries that heavily overlap withwork_desc_tks. - Attempts overlap detection via normalized substring containment and a token-overlap ratio heuristic.
- Optionally updates
project_tksalongside filtered project descriptions.
Comments suppressed due to low confidence (1)
rag/app/resume.py:1922
proj_tokensis recomputed inside the inner loop for everynorm_workeven though it only depends on the currentproj_desc. Similarly,work_tokensis recomputed for each project. Precomputing these token sets once per project/work description will reduce unnecessary work when there are many entries.
# Token-level overlap ratio
proj_tokens = set(norm_proj.split())
work_tokens = set(norm_work.split())
if proj_tokens and work_tokens:
| # Token-level overlap ratio | ||
| proj_tokens = set(norm_proj.split()) | ||
| work_tokens = set(norm_work.split()) | ||
| if proj_tokens and work_tokens: | ||
| overlap = len(proj_tokens & work_tokens) | ||
| ratio = overlap / min(len(proj_tokens), len(work_tokens)) | ||
| if ratio > 0.7: |
There was a problem hiding this comment.
The token-overlap check uses _normalize_for_comparison(), which removes all whitespace (including spaces/newlines). As a result norm_proj.split() / norm_work.split() will almost always produce a single-token set, so the overlap ratio degenerates to an exact-string match and won’t catch partial overlaps as intended. Consider tokenizing from a normalization that preserves word boundaries (e.g., NFKC + lowercase + collapse whitespace) or using a regex-based tokenizer on the original text for this overlap calculation.
| if deduped_project_names: | ||
| resume["project_tks"] = deduped_project_names |
There was a problem hiding this comment.
project_desc_tks is filtered by index here, but project_tks is only updated when deduped_project_names is non-empty. If all project descriptions are removed (or a description is skipped via continue when norm_proj is empty), project_desc_tks can become empty while project_tks remains with the old entries, causing name/description misalignment later when building chunks (prefixing project_desc_tks with project_tks[idx]). Update project_tks consistently whenever descriptions are removed/skipped (even if the resulting list is empty), and ensure skipping an empty description also removes its corresponding name when present.
| if deduped_project_names: | |
| resume["project_tks"] = deduped_project_names | |
| # Always update project_tks to stay aligned with project_desc_tks, | |
| # even when all descriptions have been filtered out. | |
| resume["project_tks"] = deduped_project_names |
|
@copilot code review[agent] |
|
@yingfeng 使用 tiktoken 做 token-shingle 的“重复率”(Jaccard)进行了优化 |
…d remove duplicate text (infiniflow#13323) Cross-verify project experience and work experience, and remove duplicate text --------- Co-authored-by: Aron.Yao <[email protected]> Co-authored-by: Aron.Yao <[email protected]>
…d remove duplicate text (infiniflow#13323) Cross-verify project experience and work experience, and remove duplicate text --------- Co-authored-by: Aron.Yao <[email protected]> Co-authored-by: Aron.Yao <[email protected]>
…d remove duplicate text (infiniflow#13323) Cross-verify project experience and work experience, and remove duplicate text --------- Co-authored-by: Aron.Yao <[email protected]> Co-authored-by: Aron.Yao <[email protected]>
Cross-verify project experience and work experience, and remove duplicate text