Skip to content

6sLOGAN78/RedrobRanker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

47 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿง  Redrob Intelligent Candidate Discovery Engine

An Explainable Multi-Stage AI Candidate Ranking System

Python CPU Only License

Ranks 100,000 candidate profiles against any Job Description in under 5 minutes โ€” on CPU โ€” with full explainability.


๐Ÿ“– Architectural Deep-Dive Manuals

  • ๐Ÿงญ Lexical & Semantic Retrieval Blueprint (Stages 01โ€“06)
  • ๐Ÿ“ˆ Redrob Behavioral Scoring Framework (Stage 08)
  • ๐Ÿค– Neural Re-ranking & Explainable AI Architecture (Stages 10โ€“11)

๐Ÿ“Œ Problem Statement

Modern recruitment platforms receive hundreds of thousands of applications per job posting. Traditional keyword search fails because it cannot understand semantic relevance, behavioural signals, or contextual fit.

The challenge: design an AI-powered Candidate Discovery Engine that โ€”

  • Understands complex, multi-section Job Descriptions
  • Ranks candidates at 100K scale without a GPU
  • Combines lexical + semantic retrieval strategies
  • Applies behavioural intelligence from platform signals
  • Produces human-readable explanations for every ranking decision

๐Ÿ’ก Our Solution โ€” A 11-Stage Progressive Ranking Pipeline

Rather than one monolithic model, we chain eleven independent stages โ€” each adding a unique ranking signal โ€” to progressively refine the candidate pool from 100,000 down to the top-100 submission.

100 000 candidates
        โ”‚
        โ–ผ Stage-00: Dataset Download Guard  โ† auto-downloads if missing
        โ”‚
        โ–ผ Stage-01: Tier-A Honeypot Detection (hard-rule filtering)
        โ”‚
        โ–ผ Stage-02: Weighted BM25 Retrieval  โ†’ Top 10 000
        โ”‚
        โ”œโ”€โ–ถ Stage-03: Download Embedding Model (once, cached)
        โ”‚
        โ–ผ Stage-04: Positive + Negative Query Embedding
        โ”‚
        โ”œโ”€โ–ถ Stage-05: Candidate Embeddings + FAISS Index (one-time)
        โ”‚
        โ–ผ Stage-06: Semantic FAISS Retrieval
        โ”‚
        โ–ผ Stage-07b: Reciprocal Rank Fusion  โ†’ Top 500
        โ”‚
        โ–ผ Stage-08: Redrob Behavioural Signal Layer
        โ”‚
        โ”œโ”€โ–ถ Stage-09: Download Cross Encoder (once, cached)
        โ”‚
        โ–ผ Stage-10: Neural Cross Encoder Re-ranking
        โ”‚
        โ–ผ Stage-11: LLM Reasoning + Submission CSV
        โ”‚
        โ–ผ team_mm.csv  (Top 100, ranked)

๐Ÿ— Architecture Diagram

flowchart TD
    JD["๐Ÿ“„ Job Description"]
    S00["๐Ÿ›ก๏ธ Stage-00\nDataset Guard"]
    S01["๐Ÿ” Stage-01\nHoneypot Detection"]
    S02["๐Ÿ“Š Stage-02\nWeighted BM25"]
    S03["๐Ÿ“ฅ Stage-03\nEmbedding Model"]
    S04["๐Ÿ” Stage-04\nQuery Embeddings"]
    S05["๐Ÿงฎ Stage-05\nCandidate Embeddings"]
    S06["โšก Stage-06\nFAISS Retrieval"]
    S07["โš–๏ธ Stage-07b\nRRF Fusion"]
    S08["๐Ÿ“ˆ Stage-08\nBehavioural Signals"]
    S09["๐Ÿ“ฅ Stage-09\nCross Encoder DL"]
    S10["๐Ÿค– Stage-10\nCross Encoder Re-rank"]
    S11["๐Ÿ’ฌ Stage-11\nLLM Reasoning"]
    OUT["๐Ÿ† Top-100 CSV"]

    JD --> S00 --> S01 --> S02
    S02 --> S03 --> S04 --> S05 --> S06
    S06 --> S07 --> S08 --> S09 --> S10 --> S11 --> OUT
Loading

โœจ Key Features

Feature Detail
๐Ÿ›ก๏ธ Honeypot Detection Hard-rule checks eliminate fabricated / low-quality profiles
๐Ÿ“Š Weighted BM25 Alpha/Beta/Gamma keyword weights tuned per JD
โž•โž– Pos/Neg Boost Semantic reward & penalty via dense query embeddings
๐Ÿง  Dense Retrieval bge-base-en-v1.5 + FAISS ANN (768-d, CPU)
โš–๏ธ RRF Fusion Reciprocal Rank Fusion over BM25 + embedding signals
๐Ÿ“ˆ Behavioural Layer Availability ยท Market Interest ยท Trust โ€” computed from Redrob signals
๐Ÿค– Cross Encoder ms-marco-MiniLM-L12-v2 โ€” profile / experience / skills facets
๐Ÿ’ฌ LLM Reasoning Qwen2.5-1.5B-Instruct โ€” grounded, hallucination-free explanations
โšก CPU First No GPU needed; runs on any modern laptop/server
๐Ÿ“ฆ Modular Each stage is independently replaceable

๐Ÿ“‚ Repository Structure

TEAM_MM/
โ”‚
โ”œโ”€โ”€ config/
โ”‚   โ””โ”€โ”€ config.yaml               # All pipeline parameters (BM25, RRF, โ€ฆ)
โ”‚
โ”œโ”€โ”€ data/                         # Challenge bundle (JD, spec, validator โ€ฆ)
โ”‚   โ”œโ”€โ”€ job_description.docx
โ”‚   โ”œโ”€โ”€ sample_candidates.json
โ”‚   โ”œโ”€โ”€ sample_submission.csv
โ”‚   โ”œโ”€โ”€ validate_submission.py    # Official submission validator
โ”‚   โ””โ”€โ”€ submission_metadata_template.yaml
โ”‚
โ”œโ”€โ”€ artifacts/                    # Pre-computed / downloaded artefacts  (gitignored)
โ”‚   โ”œโ”€โ”€ candidates.jsonl          โ† auto-downloaded by Stage-00 if missing
โ”‚   โ”œโ”€โ”€ embeddings/               # candidate_embeddings.npy ยท faiss.index
โ”‚   โ”œโ”€โ”€ emb_models/               # bge-base-en-v1.5 (HF download)
โ”‚   โ”œโ”€โ”€ cross_encoder/            # ms-marco-MiniLM-L12-v2 (HF download)
โ”‚   โ”œโ”€โ”€ reasoning/                # Qwen2.5-1.5B-Instruct (HF download)
โ”‚   โ”œโ”€โ”€ emb_query/
โ”‚   โ””โ”€โ”€ keywords/
โ”‚
โ”œโ”€โ”€ outputs/                      # Per-stage outputs (gitignored)
โ”‚   โ”œโ”€โ”€ conditions/               # honeypot report
โ”‚   โ”œโ”€โ”€ bm25/
โ”‚   โ”œโ”€โ”€ embedding/
โ”‚   โ”œโ”€โ”€ rrf/
โ”‚   โ”œโ”€โ”€ redrob_signals/
โ”‚   โ”œโ”€โ”€ cross_encoder/
โ”‚   โ””โ”€โ”€ reasoning/
โ”‚       โ”œโ”€โ”€ team_mm.csv           โ† final submission
โ”‚       โ””โ”€โ”€ reasoning_detail.json
โ”‚
โ”œโ”€โ”€ src/redrob_ranker/
โ”‚   โ”œโ”€โ”€ pipeline/                 # Stage-XX_*.py orchestrators
โ”‚   โ”œโ”€โ”€ components/               # honeypot ยท BM25 ยท RRF ยท signals
โ”‚   โ”œโ”€โ”€ ranking/                  # embedding ยท cross_encoder
โ”‚   โ”œโ”€โ”€ features/                 # positive ยท negative ยท temporal
โ”‚   โ”œโ”€โ”€ reasoning/                # LLM generation
โ”‚   โ”œโ”€โ”€ models/                   # model checkers & downloaders
โ”‚   โ”œโ”€โ”€ config/                   # ConfigurationManager
โ”‚   โ”œโ”€โ”€ entity/                   # typed config dataclasses
โ”‚   โ”œโ”€โ”€ constants/
โ”‚   โ””โ”€โ”€ utils/
โ”‚       โ”œโ”€โ”€ download_data.py      โ† candidate dataset download utility
โ”‚       โ”œโ”€โ”€ candidate_loader.py
โ”‚       โ””โ”€โ”€ โ€ฆ
โ”‚
โ”œโ”€โ”€ docs/
โ”‚   โ””โ”€โ”€ images/
โ”‚
โ”œโ”€โ”€ main.py                       # Single entry-point โ€” runs all stages
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ pyproject.toml
โ”œโ”€โ”€ submission_metadata.yaml
โ””โ”€โ”€ README.md

๐Ÿš€ Quick Start

1 ยท Prerequisites

  • Python 3.10+
  • pip / virtual-env
  • Git
  • No GPU required โ€” CPU-only pipeline

2 ยท Clone & Install

git clone https://github.com/artignite3/TEAM_MM.git
cd TEAM_MM

python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
pip install -e .            # install redrob_ranker package

3 ยท Data โ€” candidates.jsonl

The candidate pool (candidates.jsonl, โ‰ˆ 465 MB) is not stored in Git (it is too large).
Stage-00 of the pipeline tries to download it automatically when it is missing.

โœ… Automatic download (recommended)

python main.py
# Stage-00 will detect the missing file and download it automatically.

If the automated download fails (e.g., due to network or Drive permission restrictions), download manually:

๐Ÿ”— Manual download

  1. Open the shared folder:
    https://drive.google.com/drive/folders/19y2BbhXt5scRlmlgYZFdMDo6_jlpLswk
  2. Download candidates.jsonl
  3. Place it at:
artifacts/candidates.jsonl

You can also invoke the download utility standalone:

python -m redrob_ranker.utils.download_data

4 ยท Run the Full Pipeline

python main.py

The pipeline runs all stages sequentially.
Pre-computation notes:

Step What happens When
Stage-00 Download candidates.jsonl Only if missing
Stage-03 Download bge-base-en-v1.5 Only if missing
Stage-05 Build FAISS index from 100K candidates Only if missing โ€” uncomment in main.py
Stage-09 Download ms-marco-MiniLM-L12-v2 Only if missing
Stage-11 Download Qwen2.5-1.5B-Instruct Only if missing
All stages Ranking + reasoning Every run

5 ยท Validate Submission

python data/validate_submission.py outputs/reasoning/team_mm.csv

๐Ÿงฉ Stage-by-Stage Deep Dive

Stage-00 โ€” Dataset Download Guard

Ensures artifacts/candidates.jsonl exists before any stage runs.
Tries gdown โ†’ wget โ†’ manual guide in order.

Stage-01 โ€” Honeypot Detection

Applies deterministic hard rules to remove fabricated or low-quality profiles:

  • Implausible tenure spans
  • Career-start date contradictions
  • Skill-count extremes
  • Timeline inconsistencies

Output: Clean candidate pool + honeypots.csv

Stage-02 โ€” Weighted BM25 Retrieval

Every job description keyword is assigned to one of three weight classes:

Class Purpose Weight
Alpha Must-have skills + 2.0
Beta Nice-to-have skills + 1.0
Gamma Penalty terms (undesired) โˆ’ 0.5

BM25 (k1 = 1.5, b = 0.75) returns the top 10,000 candidates.

Stage-03/04 โ€” Query Embeddings

A positive recruiter query and a negative recruiter query are each embedded with BAAI/bge-base-en-v1.5 (768-d, normalised).

Stage-05 โ€” Candidate Embeddings + FAISS Index

Every candidate's merged profile text is embedded and indexed in a flat FAISS index for ANN retrieval. This step is run once and cached.

Stage-06 โ€” Semantic FAISS Retrieval

Positive query โ†’ retrieve high-relevance candidates.
Negative query โ†’ identify low-relevance candidates.
Final embedding_score = positive_sim โˆ’ ฮป ร— negative_sim (ฮป = 0.15).

Stage-07b โ€” Reciprocal Rank Fusion

Three ranked lists (BM25 ยท positive embedding ยท negative embedding) are fused via RRF (k = 60) with per-signal weights.
Output: Top 500 candidates.

Stage-08 โ€” Redrob Behavioural Signal Layer

Computes a behaviour multiplier [0.5 โ†’ 1.3] from three dimensions:

Dimension Weight Signals
๐ŸŸข Availability 50% response rate ยท recency ยท notice period ยท open-to-work
๐Ÿ”ต Market Interest 30% saves ยท search appearances ยท interview completion ยท offer rate
๐ŸŸฃ Trust 20% profile completeness ยท verification ยท connections

Also emits per-candidate warnings and availability confidence scores.

Stage-10 โ€” Cross Encoder Re-ranking

cross-encoder/ms-marco-MiniLM-L12-v2 jointly encodes the JD and each candidate profile across three facets:

Facet Weight
Profile summary 30%
Experience 50%
Skills 20%

Stage-11 โ€” LLM Reasoning + Submission

Qwen2.5-1.5B-Instruct generates a grounded, one-paragraph rationale for each top-100 candidate referencing actual resume facts โ€” zero hallucinations.

Final output: outputs/reasoning/team_mm.csv


โš™๏ธ Configuration

All tuneable parameters live in config/config.yaml:

bm25_rankings:
  alpha_weight: 2.0      # Must-have keywords
  beta_weight:  1.0      # Nice-to-have keywords
  gamma_weight: -0.5     # Penalty keywords
  top_k:        10000    # BM25 shortlist size

embedding:
  lambda_weight: 0.15    # Negative embedding penalty
  top_k:         10000

rrf_fusion:
  k:             60      # RRF constant
  top_n:         500     # Post-fusion cutoff

redrob_signals:
  weights:
    availability: 0.50
    market:       0.30
    trust:        0.20

๐Ÿ“Š System Performance

Metric Value
Candidate Pool 100,000 profiles
Hardware CPU Only โ€” no GPU
Memory < 16 GB RAM
Total Pipeline Time โ‰ค 5 minutes (post pre-computation)
Retrieval Engine BM25 + FAISS
Fusion Strategy Reciprocal Rank Fusion
Re-ranker Neural Cross Encoder
Explainability โœ… Per-candidate LLM rationale
Hallucinations 0 โ€” grounded generation only

๐Ÿ›  Tech Stack

Layer Technology
Language Python 3.10
Lexical Retrieval rank-bm25
Embeddings sentence-transformers โ€” BAAI/bge-base-en-v1.5
Vector Search faiss-cpu
Re-ranking cross-encoder/ms-marco-MiniLM-L12-v2
Reasoning Qwen2.5-1.5B-Instruct via ๐Ÿค— Transformers
Data pandas, numpy
Config PyYAML, python-box
Download gdown, wget (auto-fallback)
Output CSV + JSON

๐Ÿ”ฎ Future Improvements

  • Sparse + Dense (SPLADE / ColBERT) hybrid retrieval
  • Learning-to-Rank fine-tuning with recruiter feedback
  • Real-time candidate update webhooks
  • Multi-language JD & profile support
  • Resume parsing pipeline (PDF โ†’ structured JSON)
  • Skill knowledge-graph integration
  • Distributed FAISS for sub-second retrieval at 10M+ scale

๐ŸŒŸ Highlights

โœ” 11-Stage AI Ranking Pipeline โ€” fully modular
โœ” Automated Data Download โ€” Stage-00 fetches the dataset if missing
โœ” Hybrid Lexical + Semantic Retrieval โ€” BM25 + FAISS
โœ” Behavioural Intelligence โ€” Redrob platform signals
โœ” Neural Cross Encoder โ€” deep contextual re-ranking
โœ” Explainable AI โ€” LLM-generated, grounded rationales
โœ” CPU-Only โ€” no GPU, no cloud dependency
โœ” Scalable to 100K+ โ€” FAISS ANN at millisecond speed
โœ” Zero Hallucinations โ€” fact-grounded reasoning only

About

A CPU-optimized, 11-stage progressive AI candidate discovery and ranking engine. Integrates hybrid lexical (Weighted BM25) & semantic vector retrieval (FAISS), real-time behavioural signal modeling, neural cross-encoder re-ranking, and locally grounded LLM (Qwen2.5) explainable rationales.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages