AI Code Review Assistant & MLOps Pipeline
AI-powered GitHub Action for automated pull request code reviews using a fine-tuned LLM with LoRA
Empirical benchmark comparing INT8 Post-Training Quantized ONNX against vanilla TorchScript C++ tracing.
01 // SYSTEM OVERVIEW
Code reviews are essential for software quality but consume significant senior engineering bandwidth. This project implements an AI-powered GitHub Action that automatically analyzes pull request diffs, flags security vulnerabilities and anti-patterns, and posts actionable inline comments using an LLM fine-tuned with Low-Rank Adaptation (LoRA).
02 // THE PROBLEM & ENGINEERING SIGNIFICANCE
Manual PR reviews often create engineering bottlenecks, delaying deployments while senior developers catch routine syntax, security, or style issues.
Automating initial code review passes frees senior engineers to focus on high-level architecture while maintaining rigorous codebase standards.
- •Keeping review comments concise, actionable, and free from repetitive hallucinated criticisms.
- •Parsing unified git diffs and mapping comments to precise line numbers.
- •Minimizing inference latency so PR checks complete within standard CI/CD time budgets.
03 // DATA PIPELINE & PREPROCESSING
- Diff parsing and tokenization filtering out generated lockfiles and assets
- Context window compaction retaining hunk headers and surrounding scope lines
- Prompt template structuring with zero-shot formatting constraints
04 // SYSTEM ARCHITECTURE & DATA FLOW
GitHub PR Webhook -> GitHub Action Runner -> Dockerized Inference Container -> LoRA Model -> Actionable Markdown Review -> GitHub PR Comments API.
Triggers on pull_request events and extracts the modified git diff hunks.
Cleans diffs, removes lockfiles, and constructs structured evaluation prompts.
Language model adapted on high-quality code review datasets.
Posts inline markdown suggestions and summary reviews via GitHub REST API.
05 // MODEL ENGINEERING & HYPERPARAMETERS
Fine-tuned with rank r=16, alpha=32, target modules [q_proj, v_proj] using Hugging Face PEFT.
- • LoRA Rank: 16
- • LoRA Alpha: 32
- • Learning Rate: 2e-4
- • Epochs: 3
06 // FAILURE ANALYSIS & ZERO-TRUST SAFEGUARDS
- • Massive pull requests modifying 1,000+ lines exceeding LLM context windows.
- • Exotic language syntaxes not present in fine-tuning corpus.
07 // PRODUCTION DEPLOYMENT SPECS
08 // ARCHITECTURAL DECISIONS & TRADE-OFFS
09 // PLANNED IMPROVEMENTS & NEXT REVISIONS
- →Incorporate repository-wide static analysis (AST parsers) as an additional context layer for the LLM.
- →Add automated one-click 'Apply Suggestion' GitHub patch generation.