TraceLens is an advanced visual code tracer and runtime DSAI/ML auditor engineered for the IBM Bob 2.0 Hackathon (lablab.ai). Static code analysis can only predict what might happen; TraceLens reveals the deterministic runtime reality. It records every executed line, variable mutation, loop iteration, branch decision, tensor shape transition, and data-leakage flaw in real time inside a sandboxed subprocess—accompanied by contextual, zero-hallucination runtime explanations powered by IBM Granite 3.8B Instruct.
Problem & Solution
Problem:
Debugging intricate algorithmic loops, tracking mutating variables across multi-step pipelines, and spotting insidious data science methodology bugs (like mathematical moment leakage from fitting scalers or oversampling prior to train_test_split) is painful with traditional debuggers or ad-hoc print statements. Developers struggle to understand what actually executed at runtime.
Solution:
Engineered a dual-engine architecture: LogicLens provides an interactive time-traveling execution tracer with hierarchical loop unrolling and branch analyzers; ModelLens runs automated ML taint diagnostics to detect leakage and class imbalances. Integrated Bob AI Explainer (IBM Granite 3.8B) for grounded explanations and one-click in-place Git diff patch remediation.
Key Features
- LogicLens Time-Traveling Scrubber: Step forward, backward, play/pause, scrub to specific steps, and adjust playback speed dynamically across execution history
- State Board & Variable Deltas: Real-time register inspector tracking variable values, scalar mutations, types, and tensor dimensions across time
- Hierarchical Loop Visualizer: Unrolls nested loops into parent-child iteration trees, tracking iteration counters, inner/outer boundaries, and early-exit hooks
- Branch Decision Analyzer: Evaluates boolean expressions on
if/elif/elseblocks, explicitly highlighting chosen vs. unvisited pathways - ModelLens ML Leakage Forensics: Detects mathematical moment contamination (e.g.
scaler.fit_transform()before split) and hazardous class imbalance ratios - Live In-Place Remediation: Generates color-coded Git diff patches with a one-click "Apply Fix" action that cleans contaminated code in real time
- Bob AI Explainer (IBM Granite 3.8B): Zero-hallucination execution explanations strictly grounded in real runtime trace deltas, backed by an in-memory 20-min TTL cache
- Deterministic Execution Sandbox: Clean child process isolation via
multiprocessing.spawn, 30s hard wall-clock timeout, and restricted builtin security guards - Automated Dependency Provisioner: Scans AST imports and auto-resolves canonical PyPI packages (
scikit-learn,imblearn,pandas,scipy) - Tabular Dataset Dropzone: Handles direct CSV, TSV, and Parquet file uploads up to 100MB with isolated workspace mounting and auto-cleanup TTL
Technologies Used:
Project Metrics
What I Learned
- Architecting high-performance runtime execution tracing using Python's
sys.settraceand two-level call filters - Enforcing multi-process sandbox isolation with
multiprocessing.spawn, signal watchdogs, and atomic file transports - Building static AST analysis pre-passes to extract control-flow loops, branches, and dependency trees before execution
- Designing algorithmic data-leakage forensics to intercept statistical moment contamination in ML preprocessing pipelines
- Integrating IBM Granite 3.8B with WatsonX APIs and prompting techniques grounded strictly on execution step deltas
- Developing reactive, full-featured developer tooling with React 19, timeline scrubbers, and live diff remediation workflows
Built for the IBM Bob 2.0 Hackathon on lablab.ai with live official web application.