How harish-k000/jobfit-nlp works
Purpose and Entry Points
JobFit-NLP scores a resume bullet against a job requirement as strong_match, partial_match, or no_match, then ranks evidence for every requirement in pasted documents. The runtime service starts in api/main.py; its main user-facing flow is POST /api/v1/match-documents. Offline workflows are exposed through Makefile and model/script modules.
Dataset and Labeling Boundary
Labeled sentence-pair data is JSONL, with job descriptions decomposed into atomic requirements and paired with resume bullets. Splits are by job_id, preventing job-description leakage across train/validation/test.
• data/train.jsonl
• data/validation.jsonl
• data/test.jsonl
• docs/labeling_rubric.md
• docs/dataset_spec.md
Raw material may contain PII and is isolated under data/raw/; processed data is the training contract.
Data Collection and Split Pipeline
Dataset authoring imports and selects job requirements, builds candidate-pair labeling queues, and materializes leakage-safe splits. This is an offline pipeline, distinct from serving.
• scripts/import_jobs_csv.py
• scripts/select_requirements.py
• scripts/build_labeling_queue.py
• scripts/split_dataset.py
Requirement segmentation is shared production logic rather than API dependence on authoring scripts:
• model/segmentation.py
Modeling and Evaluation
The core predictor is a DistilBERT three-class sequence-pair classifier, trained with PyTorch and Hugging Face Trainer. Model code also establishes baseline comparators—majority class, keyword overlap, and TF-IDF + Logistic Regression—so transformer quality is measured rather than assumed.
• model/train.py
• model/dataset.py
• model/baselines.py
• model/predict.py
• model/evaluate.py
Evaluation prioritizes macro F1, class-level metrics, confusion analysis, and structured artifacts. Current recorded results indicate the transformer trails keyword overlap, so inference should be treated as evidence-ranking rather than definitive matching.
• model/metrics.py
• artifacts/evaluation_results.json
• artifacts/baseline_results.json
• artifacts/error_analysis.csv
API Inference and Document Matching
FastAPI request schemas and dependencies define the serving boundary. Single and batch pair endpoints delegate to model inference; document matching orchestrates full-text preprocessing, bounded cross-product scoring, ranking, and coverage aggregation.
• api/main.py
• api/schemas.py
• api/dependencies.py
• api/inference.py
• api/document_matching.py
For a document request: extract requirements → extract resume bullets → cap at 25 requirements and 20 bullets → score up to 500 pairs → rank bullets per requirement → return top evidence, best match, probabilities/confidence, and strong/partial/none coverage. Resume parsing is local in-process logic:
• api/resume_splitter.py
Runtime, Deployment, and External Dependencies
The service runs as a Python FastAPI process, loading a trained tokenizer/model from the local model-output convention. Training/inference depend on PyTorch, Hugging Face Transformers/Datasets, Pandas, and scikit-learn; no hosted model or database service is identified. Docker packages the service, with compose available for local orchestration.
• Dockerfile
• docker-compose.yml
• requirements.txt
Experiment Governance
Hyperparameter and multi-seed workflows select by validation performance and gate promotion of a model output against the keyword baseline; artifacts provide the experiment record.
• scripts/hparam_search.py
• scripts/multi_seed_train.py
• artifacts/hparam_search_results.json
• artifacts/multi_seed_results_tuned.json
Main entry points: document_matching.py Document matcher · train.py DistilBERT trainer · train.jsonl Labeled JSONL splits · inference.py Pair inference
Components 20
Data & labeling
Leakage-safe sentence-pair dataset creation.
- Raw source data · May contain PII; not the training contract.
- Job requirement authoring · Imports jobs, selects atomic requirements, and builds labeling queues.
scripts/import_jobs_csv.py - Leakage-safe split · Splits examples by job_id.
scripts/split_dataset.py - Labeled JSONL splits · Train, validation, and test sentence-pair data.
data/train.jsonl - Labeling contract · Rubric and dataset specification for labels and examples.
docs/labeling_rubric.md
Modeling & experiments
Training, comparison, evaluation, and promotion.
- Requirement segmentation · Extracts atomic requirements for production matching.
model/segmentation.py - Pair dataset loader
model/dataset.py - DistilBERT trainer · Trains a sequence-pair classifier with PyTorch and Hugging Face Trainer.
model/train.py - Baseline comparators · Majority, keyword overlap, and TF-IDF logistic regression.
model/baselines.py - Evaluation & analysis · Produces macro F1, class metrics, confusion analysis, and artifacts.
model/evaluate.py - Promotion workflows · Validation-selected hyperparameters and multi-seed baseline gate.
scripts/hparam_search.py - Experiment records · Records baseline, evaluation, tuning, and seed outcomes.
artifacts/evaluation_results.json
API serving
FastAPI document and pair matching flow.
- FastAPI application · Hosts versioned matching endpoints.
api/main.py - Request schemas & dependencies
api/schemas.py - Pair inference · Runs single and batch classifier scoring.
api/inference.py - Document matcher · Bounds, scores, ranks, and aggregates requirement evidence.
api/document_matching.py - Resume bullet extraction · In-process resume preprocessing.
api/resume_splitter.py - POST match-documents · Returns ranked evidence and coverage by requirement.
api/main.py
Runtime packaging
- Local model output · Local convention loaded by inference.
- Containerized service · Docker packaging with local compose orchestration.
Dockerfile
Connections 22
- Raw source data → Job requirement authoring: source jobs
- Job requirement authoring → Leakage-safe split: labeled candidate pairs
- Labeling contract → Leakage-safe split: labeling rules
- Leakage-safe split → Labeled JSONL splits: job_id-separated splits
- Labeled JSONL splits → Pair dataset loader: examples
- Pair dataset loader → DistilBERT trainer: train/validation data
- Labeled JSONL splits → Baseline comparators: benchmark data
- DistilBERT trainer → Local model output: trained weights/tokenizer
- DistilBERT trainer → Evaluation & analysis: transformer predictions
- Baseline comparators → Evaluation & analysis: baseline predictions
- Evaluation & analysis → Experiment records: metrics and errors
- Promotion workflows → DistilBERT trainer: tuned training runs
- Experiment records → Promotion workflows: validation results
- FastAPI application → Request schemas & dependencies: validates requests
- FastAPI application → POST match-documents: routes request
- POST match-documents → Document matcher: document payload
- Document matcher → Requirement segmentation: extract requirements
- Document matcher → Resume bullet extraction: extract bullets
- Document matcher → Pair inference: up to 500 pairs
- Pair inference → Local model output: loads classifier
- Pair inference → Document matcher: class probabilities
- Containerized service → FastAPI application: runs service