Inspiration

Machine learning models are often treated as "black boxes" - they make predictions, but understanding why they make those predictions remains a mystery to most users. We wanted to democratize AI explainability by creating a tool that anyone could use, regardless of their technical background. NSight was born from the need to bridge the gap between complex ML models and the people who depend on their decisions: whether that's a doctor using diagnostic AI, a loan officer reviewing credit models, or a business-analyst optimizing operations.

What it does

NSight is an AI-powered model explainability platform that transforms any ONNX machine learning model into an understandable, transparent system. Users simply upload their trained ONNX model and dataset, and NSight provides:

  • SHAP Analysis: Computes feature importance and contribution values using state-of-the-art SHAP (SHapley Additive exPlanations) methodology
  • Visual Insights: Generates interactive summary plots showing overall feature importance and waterfall diagrams for individual predictions
  • AI-Generated Reports: Leverages Google's Gemini AI to create comprehensive, plain-English explanations of how the model makes decisions, including key drivers, prediction patterns, and actionable insights
  • Context-Aware Chatbot: An intelligent assistant that understands your specific model and can answer questions about feature impacts, prediction logic, and model behavior in natural language

NSight works seamlessly with both regression and classification models (binary and multi-class), handling everything from healthcare diagnostics to financial risk assessment.

How we built it

We built NSight as a full-stack web application with a Python Flask backend and a modern React frontend:

Backend Architecture:

  • ONNX Integration: Created a custom wrapper class to load and run inference on ONNX models, handling various output formats (numeric predictions, probability distributions, and string labels)
  • SHAP Computation: Implemented KernelExplainer for model-agnostic SHAP value calculation, with optimizations for speed and accuracy
  • LLM Integration: Connected to Google's Gemini 2.5 Flash API to generate natural language explanations from structured SHAP data
  • Smart Analysis Pipeline: Built a comprehensive data extraction system that processes SHAP values, computes feature importance, analyzes prediction patterns, and packages everything for the LLM

Frontend Implementation:

  • React with TypeScript for type safety and better developer experience
  • Interactive visualizations using recharts for feature importance displays
  • Real-time chat interface with streaming responses from the AI assistant
  • Clean, intuitive UI for uploading models and exploring results

Challenges we ran into

The biggest challenge was dealing with the variety of ONNX model output formats. Different ML frameworks (sklearn, PyTorch, TensorFlow) export to ONNX with different conventions - some output class labels as strings, others as probabilities in dictionary format, and others as simple numeric arrays. We had to build robust detection and conversion logic to handle all these cases automatically. Another significant hurdle was optimizing SHAP computation. KernelExplainer can be extremely slow on large datasets, so we implemented smart sampling strategies and background data selection to balance speed with accuracy. We also had to carefully handle the various shapes and formats of SHAP base values across different model types. Getting Gemini to produce consistently high-quality, actionable insights required extensive prompt engineering. We iterated through multiple prompt designs to ensure the AI generates explanations that are technically accurate yet accessible to non-technical users.

Accomplishments that we're proud of

  • Universal Compatibility: NSight works with ANY ONNX model - regression, binary classification, or multi-class - automatically detecting the model type and adapting its analysis
  • Production-Ready Error Handling: We built comprehensive error handling for edge cases, including string label conversion, various array shapes, and missing data scenarios
  • Intelligent AI Summaries: Our Gemini integration doesn't just describe the data - it provides actionable insights and explains model behavior in context
  • Context-Aware Chat: The chatbot truly understands your specific model, maintaining conversation history and referencing your actual SHAP analysis results
  • Clean User Experience: Despite the complexity under the hood, the interface is simple and intuitive upload, analyze, explore

What we learned

This project deepened our understanding of explainable AI and the practical challenges of deploying ML systems. We learned that model interpretability isn't just a technical problem - it's a communication challenge. The same SHAP values can be presented in ways that either enlighten or confuse users. We also discovered the power of combining traditional explainability methods (SHAP) with modern LLMs. The LLM can synthesize complex numerical data into narratives that resonate with different audiences, making AI transparency accessible to everyone from data scientists to business stakeholders. On the technical side, we gained expertise in ONNX runtime optimization, prompt engineering for technical content, and building robust data pipelines that handle messy real-world model outputs.

What's next for NSight

  • Model Comparison: Enable users to upload multiple models and compare their decision-making patterns side-by-side
  • Export Reports: Generate PDF reports with all visualizations and AI summaries for sharing with stakeholders
  • Batch Analysis: Allow users to explain predictions on entire test sets, identifying patterns in where models succeed or fail
  • Custom Prompt Templates: Let users customize the AI report generation to focus on specific aspects relevant to their domain
  • Model Performance Metrics: Integrate accuracy, precision, recall, and other metrics alongside explainability insights
  • Real-time Explanations: Build an API endpoint for production systems to get real-time explanations alongside predictions

Built With

Share this project:

Updates