TalentSync

AI resume builder and ATS optimizer for job seekers. Tailored resumes, outreach, and interview prep from one profile.

AI_ML integration

The AI/ML integration for the TalentSync-Normies platform.

Repository layout#

The AI/ML capabilities are primarily implemented in the backend Python service, with complementary frontend components for configuration and testing. The backend organizes AI/ML logic into:

  • Core LLM configuration and provider switching
  • Document processing and NLP preprocessing
  • LangChain prompt engineering and chains
  • Resume analysis services and routes
  • ATS evaluation and interview assistance
  • Experiment notebooks for ML model training

Building blocks#

  • LLM Provider Configuration and Dynamic Switching: Centralized provider selection and instantiation supporting multiple vendors with unified API.
  • NLP Pipeline: Document ingestion, text extraction, cleaning, and preprocessing using spaCy and NLTK.
  • LangChain Prompt Engineering: Structured prompts for detailed resume analysis, ATS scoring, interview question generation, and cold email editing.
  • ML Models: Scikit-learn-based resume classification trained on a synthetic dataset; persisted models and vectorizers for inference.
  • Service Orchestration: FastAPI routes delegating to specialized services for resume analysis, ATS evaluation, and interview assistance.

How it fits together#

The AI/ML microservice architecture integrates document processing, LLM orchestration, and ML inference. The system supports dynamic LLM provider switching and includes clear error handling and fallback mechanisms.

LLM provider configuration and dynamic switching#

The system supports multiple LLM providers (Google, OpenAI, Anthropic, Ollama, OpenRouter, DeepSeek) with a unified factory that selects the appropriate client based on configuration. It includes:

  • Environment-based settings for provider, model, API key, and base URL
  • Singleton instances for default and faster models
  • Runtime provider override via request headers
  • Connection testing endpoint for validating credentials

NLP processing pipeline#

The pipeline extracts and cleans text from documents, applies preprocessing, and prepares data for LLM analysis and ML classification:

  • Document ingestion: Supports TXT, MD, PDF, DOC/DOCX with fallback to multimodal conversion when needed.
  • Text extraction: Uses PyMuPDF for Markdown rendering.
  • Cleaning and preprocessing: Removes URLs, mentions, punctuation, lemmatization, and stopword filtering.
  • spaCy integration: Tokenization and lemmatization for structured NLP tasks.
  • ML preprocessing: TF-IDF vectorization for classification.

LangChain prompt engineering system#

Structured prompts guide the LLM to produce standardized JSON outputs for downstream processing:

  • Detailed Analysis: Extracts skills, experience, projects, education, and predicted field.
  • ATS Analysis: Scores resumes against job descriptions and provides keyword coverage and recommendations.
  • Interview Question Generation: Produces role-specific, difficulty-tuned questions with evaluation criteria.
  • Cold Mail Editing: Personalizes and refines cold outreach emails with context and edits.

Resume analysis services and routes#

The backend exposes endpoints for resume analysis, formatting, and detailed analysis. Services integrate LLM chains and validation schemas:

  • File-based analysis: Processes uploaded files and returns structured data.
  • Text-based analysis: Accepts formatted text and returns detailed analysis.
  • Validation and cleanup: Ensures data conforms to Pydantic models and filters invalid entries.

Machine learning models for resume classification#

A scikit-learn pipeline classifies resumes into predefined categories:

  • Training Data: Synthetic dataset with resume texts and categories.
  • Preprocessing: NLTK-based cleaning and TF-IDF vectorization.
  • Models: Grid-searched ensemble models (Random Forest, AdaBoost, Gradient Boosting, SVM, KNN, MultinomialNB, Logistic Regression).
  • Persistence: Saved model and vectorizer artifacts for inference.

ATS evaluation and interview assistance#

  • ATS Evaluation: LangChain graph orchestrates keyword matching, scoring, and recommendations against job descriptions.
  • Interview Assistance: Templates and question generation with difficulty and topic alignment; streaming code execution for technical interviews.

Communication tools and tailored resume generation#

  • Cold Email Editing: Personalized email generation and iterative editing guided by candidate data and company insights.
  • Tailored Resume Generation: Uses ATS evaluation summaries and company website content to refine and align resumes.

Dependencies#

AI pieces stay in their own modules:

  • Core LLM layer depends on environment settings and provider libraries.
  • Services depend on LangChain prompts and LLM instances.
  • NLP preprocessing depends on spaCy and NLTK resources.
  • ML models depend on persisted artifacts and vectorizers.

Performance#

  • LLM Provider Selection: Choose models aligned with latency and cost targets; use faster models for preliminary formatting and heavier models for complex reasoning.
  • Cost Optimization:
  • Use provider-specific pricing calculators and monitor token usage.
  • Prefer smaller, cheaper models for formatting and fallbacks.
  • Batch requests where feasible and avoid unnecessary retries.
  • Caching and Persistence:
  • Persist TF-IDF vectorizer and ML models to avoid retraining.
  • Cache LLM responses for identical inputs where appropriate.
  • Resource Management:
  • Monitor memory usage during PDF processing and vectorization.
  • Limit concurrent LLM invocations to prevent rate-limit errors.

Troubleshooting#

Common issues:

  • Authentication Failures: Verify API keys and provider configuration; use the LLM test endpoint to validate connectivity.
  • Rate Limits: Implement retry with exponential backoff and switch to lighter models temporarily.
  • Empty or Malformed JSON: Ensure prompts return JSON blocks; use fallback parsing logic to extract JSON substrings.
  • Provider Switching Errors: Confirm environment variables and model availability; fallback to default provider if unknown.

Appendix#

Model training data and validation metrics#

  • Dataset: Synthetic resume corpus with labeled categories.
  • Preprocessing: NLTK cleaning and TF-IDF vectorization.
  • Models Tested: Random Forest, AdaBoost, Gradient Boosting, SVM, KNN, MultinomialNB, Logistic Regression.
  • Validation: Cross-validation grid search with hyperparameter tuning; best scores recorded.

Testing strategies and model versioning#

  • Unit-level tests: Validate prompt parsing, JSON extraction, and service error handling.
  • Integration tests: full resume analysis and ATS evaluation flows.
  • Model versioning: Persist model and vectorizer artifacts; maintain backward-compatible schemas.

Deployment considerations#

  • Containerization: Package backend with required LLM provider libraries and environment variables.
  • Secrets Management: Store API keys securely; use encrypted configuration for user-defined providers.
  • Monitoring: Track LLM latency, error rates, and token usage; alert on sustained failures.