Skip to content

Generative AI Engineer (Part 1) — Interview 19

Q: What was the most challenging task in an intent classification project, and how did you overcome it?

  • One of the most challenging tasks in the UIDS (Universal Intent Determination System) project was ensuring high accuracy and robustness of intent classification across a very large set of 639 unique intents, especially given the diversity of user queries and the need to support 49 global languages.
  • The main challenges included:
  • Handling Imbalanced Data: Many intents had very few training samples, leading to class imbalance and potential bias in predictions.
  • Maintaining High Accuracy at Scale: With high production traffic (~250 TPS), even small drops in accuracy could significantly impact customer experience.
  • Reducing Ambiguity and Overlap: Some intents were semantically similar, making it difficult for the model to distinguish between them.
  • Continuous Data Quality Improvement: Real-world queries often contained noise, typos, or were phrased in unexpected ways, requiring robust preprocessing and ongoing data relabelling.

How I Overcame These Challenges:

  • Advanced Data Engineering:
  • Led comprehensive data cleaning, preprocessing, and feature engineering to handle missing values, normalize text, and balance the dataset.
  • Used techniques like oversampling, synthetic data generation (using LLMs), and few-shot learning to augment underrepresented intents.
  • Robust Model Development:
  • Benchmarked multiple models (SetFit, CatBoost, XGBoost, Falcon-7B) to select the best-performing architecture for intent classification.
  • Fine-tuned sentence transformer models to improve semantic understanding across languages.
  • Automated Data Labelling with RAG:
  • Designed and implemented an internal RAG-based agentic system for automated data relabelling, leveraging LLMs and semantic search to validate and correct intent labels, thus improving training data quality and reducing manual effort.
  • MLOps and Continuous Monitoring:
  • Established automated pipelines for model training, evaluation, and deployment using AWS SageMaker and MLFlow.
  • Implemented real-time monitoring and feedback loops to detect model drift, trigger retraining, and ensure consistent performance.
  • Cross-Functional Collaboration:
  • Worked closely with data engineering, product, and support teams to integrate the solution into enterprise workflows and gather feedback for continuous improvement.

These strategies enabled us to deliver a highly accurate, scalable, and production-ready intent classification system that significantly improved automation and customer support efficiency for [Company].


Q: What is the advantage of using LangGraph in your architecture?

  • LangGraph is a framework designed for building complex, multi-step, and agentic workflows on top of LLMs and RAG pipelines. Integrating LangGraph into our architecture provided several key advantages:

  • 1. Modular Workflow Orchestration:

  • LangGraph allows us to define each step of the RAG pipeline (retrieval, translation, context assembly, LLM generation, evaluation, etc.) as discrete, reusable nodes.
  • This modularity makes it easy to add, remove, or modify steps without disrupting the entire pipeline.

  • 2. Flexible Multi-Agent Coordination:

  • Supports orchestrating multiple agents (retrievers, translators, evaluators, etc.) in a single workflow, enabling advanced use cases like context-aware translation, multi-stage evaluation, and automated data relabeling.

  • 3. State Management:

  • LangGraph provides built-in memory and state management, allowing the system to track conversation history, intermediate results, and context across multiple steps or turns.
  • This is crucial for maintaining coherence in multi-turn interactions and for agentic workflows that require iterative refinement.

  • 4. Error Handling and Guardrails:

  • Enables robust error handling, fallback strategies, and integration of custom guardrails at each node, improving system reliability and safety.

  • 5. Observability and Debugging:

  • LangGraph’s node-based structure makes it easier to trace, debug, and monitor each stage of the workflow, which is essential for enterprise-grade deployments.

  • 6. Rapid Prototyping and Experimentation:

  • Facilitates quick prototyping of new workflow variants, allowing us to experiment with different retrieval, generation, and evaluation strategies efficiently.

  • 7. Seamless Integration:

  • Integrates well with other frameworks like LangChain, OpenAI API, and custom Python modules, supporting both cloud and on-premises deployments.

Summary: Using LangGraph enabled us to build scalable, maintainable, and highly customizable agentic RAG pipelines, accelerating development, improving reliability, and supporting advanced enterprise use cases in our Generative AI solutions.


Q: How do you debug a complex RAG and agentic AI system when one component fails?

  • Debugging a complex system that combines RAG pipelines and agentic AI workflows requires a structured, modular, and observable approach. Here’s how I handle debugging in such architectures:

  • 1. Modular Pipeline Design:

  • Each major component (retriever, vector store, LLM, agent, guardrail, etc.) is implemented as a separate, well-defined module or node (especially when using frameworks like LangGraph).
  • This modularity allows for isolated testing and debugging of individual components.

  • 2. Centralized Logging:

  • We use a centralized logging system (e.g., log_manager.py as per our pipeline) to capture detailed logs at each step, including input, output, errors, and intermediate states.
  • Each request is tagged with a unique Correlation ID, making it easy to trace the flow across distributed components.

  • 3. Stepwise Error Handling:

  • Each node in the workflow has built-in error handling and exception logging.
  • If a node fails (e.g., retrieval, LLM call, agent orchestration), the error is logged with context, and the pipeline can trigger fallback logic or halt gracefully.

  • 4. State Inspection:

  • Since we use a state graph (LangGraph), the state object is updated at every node.
  • By inspecting the state at each step, we can pinpoint where the data or logic deviated from expectations.

  • 5. Artifact and Metrics Logging:

  • All intermediate artifacts (retrieved chunks, embeddings, LLM responses, agent actions) are saved locally or to S3 for post-mortem analysis.
  • Metrics and results are aggregated and stored, allowing us to identify patterns in failures or performance drops.

  • 6. Health Checks and Monitoring:

  • Automated health checks are in place for external dependencies (vector DB, LLM API, etc.).
  • Alerts are triggered if any service is down or responding abnormally.

  • 7. Reproducibility:

  • All inputs, configurations, and random seeds are logged, ensuring that any issue can be reproduced and debugged in a controlled environment.

  • 8. Local and Unit Testing:

  • Each module can be unit tested independently.
  • For complex failures, we can run the pipeline locally with the same data to step through the process and identify the root cause.

  • 9. Visualization and Reporting:

  • For evaluation pipelines (like KGPT), we generate detailed Excel and chart-based reports, which help in identifying anomalies or failure points across releases.

Summary: - By combining modular design, centralized logging, state inspection, and robust error handling, I can efficiently debug and trace failures in complex RAG and agentic AI systems. This approach ensures quick root cause analysis and minimal downtime, even in large-scale, production-grade deployments.