avaliev commited on
Commit
4de614b
·
1 Parent(s): 8f3dee7

Add submission writing artifacts

Browse files
Files changed (4) hide show
  1. DEMO_VIDEO_PITCH.md +39 -0
  2. HF_TECH_PAPER.md +219 -0
  3. LINKEDIN_POST.md +42 -0
  4. README.md +6 -0
DEMO_VIDEO_PITCH.md ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DiffSense Demo Video Pitch
2
+
3
+ ## 20-Second Selling Pitch
4
+
5
+ DiffSense is a private, local-first pull request reviewer for teams that cannot send proprietary code to cloud review bots. Paste a diff or public GitHub PR URL, click **Review diff**, and get inline severity-tagged findings plus structured JSON. The deterministic reviewer works immediately, while optional bridges for Mellum, Nemotron, Tiny Titan, MiniCPM-V, and Modal are ready for hosted providers or local checkpoints under `/data`.
6
+
7
+ ## 60-Second Demo Script
8
+
9
+ Hi, this is DiffSense, our Build Small hackathon project.
10
+
11
+ The problem is that AI code review is useful, but most review bots require sending private source code to a hosted SaaS. That does not work for security-sensitive teams, regulated teams, or unreleased products.
12
+
13
+ DiffSense is a local-first alternative. On the left, I configure optional model passes: Mellum for summaries, Nemotron for routing, Tiny Titan for a lightweight checker, MiniCPM-V for screenshots and diagrams, and a Modal bridge for hosted inference.
14
+
15
+ In the center, I paste a public GitHub PR URL or a unified diff. I can also attach PR screenshots or diagrams for the vision path. Now I click **Review diff**.
16
+
17
+ The app fetches or parses the diff, runs a deterministic review engine, and returns a summary. The model runtime panel shows that `/data` is mounted and writable, with persistent checkpoint slots ready for local model weights.
18
+
19
+ On the right, DiffSense renders the detailed review as an inline diff: file headers, hunk headers, line numbers, severity badges, comments, and suggested fixes. Under that, it exposes structured JSON so the output can be copied into PR automation.
20
+
21
+ The key design choice is reliability. The deterministic review path always works, and model bridges enhance it when OAuth, provider routes, Modal, or local checkpoints are available.
22
+
23
+ So the product is useful now, private by default, and ready for small-model local inference.
24
+
25
+ ## User Flow Checklist
26
+
27
+ 1. Show the title and tagline: private, offline-first PR review.
28
+ 2. Point to the sidebar model toggles.
29
+ 3. Paste or keep the public PR URL in the center input.
30
+ 4. Upload an image if you want to show the MiniCPM-V path.
31
+ 5. Click **Review diff**.
32
+ 6. Read the summary and model runtime status.
33
+ 7. Move to the right pane and show the inline review.
34
+ 8. Scroll to the structured JSON.
35
+ 9. Close with the privacy and reliability point.
36
+
37
+ ## One-Line Close
38
+
39
+ DiffSense turns a diff into a review artifact, not a chat transcript: private by default, useful without a GPU, and ready for local small-model checkpoints.
HF_TECH_PAPER.md ADDED
@@ -0,0 +1,219 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DiffSense: A Local-First Pull Request Reviewer Built During Build Small
2
+
3
+ ## Abstract
4
+
5
+ DiffSense is a privacy-first pull request review assistant built for the Hugging Face Build Small hackathon. The app accepts either a unified diff or a public GitHub pull request URL, parses the changed files and hunks, runs a deterministic review engine for high-signal security and correctness risks, and renders the result as inline review comments with structured JSON output.
6
+
7
+ The core design choice is simple: the app must remain useful even when hosted model providers are unavailable, cold, rate-limited, or missing a particular model route. DiffSense therefore treats deterministic review as the always-on path and model inference as an enhancement layer. It exposes bridge points for JetBrains Mellum 2, NVIDIA Nemotron 3 Nano, NVIDIA Nemotron 3 Nano 4B, OpenBMB MiniCPM-V 4.6, and Modal, while also preparing persistent local checkpoint slots under the Space bucket mounted at `/data`.
8
+
9
+ ## Motivation
10
+
11
+ Code review is a daily workflow for engineering teams, but most AI review tools assume that source code can be sent to a third-party SaaS service. That assumption is often wrong. Teams working on customer data, unreleased products, internal APIs, regulated systems, or security-sensitive infrastructure may need review assistance without exporting private code.
12
+
13
+ DiffSense is aimed at that gap. It is not trying to replace a human reviewer with a black-box chat interface. Instead, it turns a diff into a concrete review artifact:
14
+
15
+ - severity-tagged findings,
16
+ - per-file and per-hunk locations,
17
+ - inline comments attached to changed lines,
18
+ - actionable fix suggestions,
19
+ - JSON output that can be copied into automation or a pull request workflow.
20
+
21
+ The hackathon constraint shaped the product in a useful way. Rather than building a large hosted reviewer that only works when every model endpoint is healthy, we built a small, inspectable workflow that starts from deterministic analysis and adds model passes where they make the product better.
22
+
23
+ ## Product Experience
24
+
25
+ The app is a Gradio Space with a three-part workspace:
26
+
27
+ - The left sidebar configures model and provider passes.
28
+ - The center pane accepts the diff or pull request URL, image uploads, and shows the summary/model trace after processing.
29
+ - The right pane shows the detailed inline review and structured JSON.
30
+
31
+ The user flow is intentionally short:
32
+
33
+ 1. Open the Space.
34
+ 2. Paste a unified diff or a public GitHub PR URL.
35
+ 3. Optionally upload PR screenshots, diagrams, or UI diffs.
36
+ 4. Click **Review diff**.
37
+ 5. Read inline comments and copy the structured JSON if needed.
38
+
39
+ For public GitHub PRs, DiffSense appends `.diff` to the pull request URL and fetches the public unified diff with a short timeout. Pasted diffs stay inside the app process unless a model/provider pass is explicitly enabled.
40
+
41
+ ## Architecture
42
+
43
+ ```text
44
+ Unified diff or public GitHub PR URL
45
+ -> normalize input
46
+ -> fetch public .diff when needed
47
+ -> parse unified diff into files, hunks, and changed lines
48
+ -> run deterministic review rules
49
+ -> optionally summarize with Mellum bridge
50
+ -> optionally route/triage with Nemotron bridge
51
+ -> optionally sanity-check with Tiny Titan bridge
52
+ -> optionally process uploaded images with MiniCPM-V bridge
53
+ -> optionally POST to Modal endpoint
54
+ -> render summary, agent trace, inline diff review, and JSON
55
+ ```
56
+
57
+ The app is implemented in a single `app.py` file to keep the Space easy to inspect during judging. The key pieces are:
58
+
59
+ - `normalize_diff`: accepts pasted diffs or public GitHub PR URLs.
60
+ - `parse_unified_diff`: converts unified diff text into file/hunk/line dataclasses.
61
+ - `review_diff`: applies deterministic code-review rules.
62
+ - `summarize_with_model`: narrows the model role to summarizing known findings.
63
+ - `run_nemotron_router`: produces routing/triage notes.
64
+ - `run_tiny_titan_checker`: produces a compact <=4B sanity-check path.
65
+ - `run_minicpm_vision`: accepts image uploads for PR screenshots and diagrams.
66
+ - `render_review`: renders a custom HTML diff view with inline findings.
67
+ - `render_agent_trace`: exposes model runtime and bridge status.
68
+
69
+ ## Deterministic Review Engine
70
+
71
+ The deterministic path is the product's reliability layer. It parses added lines and checks for review risks that are common, high-signal, and easy to explain:
72
+
73
+ - hardcoded credentials,
74
+ - disabled TLS or JWT verification,
75
+ - unsafe `pickle` deserialization,
76
+ - dynamic execution via `eval` or `exec`,
77
+ - `shell=True` subprocess calls,
78
+ - SQL string interpolation,
79
+ - bare `except:`,
80
+ - temporary `TODO`, `FIXME`, or `HACK` markers,
81
+ - return-contract changes such as newly introduced `return None`,
82
+ - large behavior changes outside test files.
83
+
84
+ Each finding is normalized into this shape:
85
+
86
+ ```json
87
+ {
88
+ "file": "src/auth.py",
89
+ "hunk": "@@ -1,9 +1,13 @@",
90
+ "line": 11,
91
+ "severity": "critical",
92
+ "category": "security",
93
+ "comment": "The change disables a verification check, which can turn a trusted boundary into a bypass.",
94
+ "suggestion": "Keep verification enabled and add a narrowly scoped test fixture for local development.",
95
+ "source": "deterministic"
96
+ }
97
+ ```
98
+
99
+ This made the app demoable under time pressure. Even if all hosted inference routes fail, the reviewer still produces useful output.
100
+
101
+ ## Model and Provider Bridges
102
+
103
+ DiffSense integrates the hackathon model stack as optional bridge points rather than hard dependencies.
104
+
105
+ | Role | Model or Provider | Purpose |
106
+ | --- | --- | --- |
107
+ | Code summary | `JetBrains/Mellum2-12B-A2.5B-Instruct` | Summarize deterministic findings and diff risk |
108
+ | Agentic routing | `nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-BF16` | Triage changed files, merge risk, and follow-up tests |
109
+ | Tiny checker | `nvidia/NVIDIA-Nemotron-3-Nano-4B-BF16` | <=4B lightweight review sanity check |
110
+ | Visual context | `openbmb/MiniCPM-V-4.6` | PR screenshot, UI diff, and diagram context |
111
+ | External runtime | Modal endpoint | Optional POST bridge via `DIFFSENSE_MODAL_ENDPOINT` |
112
+
113
+ The model prompts are intentionally constrained. For example, Mellum is asked to summarize deterministic findings rather than invent findings from scratch. This keeps the output auditable and prevents the model layer from undermining the review engine.
114
+
115
+ ## Local Checkpoint Strategy
116
+
117
+ The Space is configured with a read/write Hugging Face bucket mounted at `/data`. DiffSense creates and monitors these model slots:
118
+
119
+ ```text
120
+ /data/models/mellum2-instruct
121
+ /data/models/nemotron-3-nano-30b-a3b
122
+ /data/models/nemotron-3-nano-4b
123
+ /data/models/minicpm-v-4.6
124
+ ```
125
+
126
+ Each slot is considered ready when it contains a `config.json`. Text-model bridge calls first check for local checkpoints before falling back to hosted Hugging Face Inference routes. This lets the app grow from a reliable deterministic demo into a local/ZeroGPU-backed model reviewer without committing checkpoints into the Space repo.
127
+
128
+ The app also reports model runtime status directly in the UI so judges can see the configured local-first paths.
129
+
130
+ ## Privacy Model
131
+
132
+ DiffSense has three privacy tiers:
133
+
134
+ 1. Pasted diff with model toggles off: diff analysis stays in the app process.
135
+ 2. Public GitHub PR URL: the app fetches the public `.diff` document.
136
+ 3. Optional model/provider pass: compact diff context and deterministic findings are sent to the selected provider or local checkpoint path.
137
+
138
+ This is why the deterministic review path is not just a fallback. It is the privacy-preserving default that makes the tool useful for sensitive code.
139
+
140
+ ## Gradio UI Design
141
+
142
+ The UI uses `gr.Blocks` with custom CSS and HTML rendering rather than a chatbot layout. That choice matters because code review is a reading and scanning task. A chat transcript is the wrong shape for a diff.
143
+
144
+ The current layout is optimized for a demo and for actual use:
145
+
146
+ - configuration in the sidebar,
147
+ - input and summary in the center,
148
+ - detailed inline review in the larger right pane,
149
+ - JSON output beneath the detailed review.
150
+
151
+ Findings are rendered inside the diff with severity badges, file headers, hunk headers, line numbers, and suggested fixes. This makes the output feel like a review artifact rather than a model response.
152
+
153
+ ## Development Process
154
+
155
+ The project was built under a tight hackathon deadline with Codex as an active build partner.
156
+
157
+ The build sequence was:
158
+
159
+ 1. Analyze the hackathon constraints and sponsor badge criteria.
160
+ 2. Choose a real developer workflow that benefits from local AI: pull request review.
161
+ 3. Build a deterministic reviewer first so the demo could never be blocked by model availability.
162
+ 4. Add a custom Gradio UI for a non-chat, code-review-specific experience.
163
+ 5. Add public GitHub PR URL fetching.
164
+ 6. Add model/provider bridge toggles for Mellum, Nemotron, Tiny Titan, MiniCPM-V, and Modal.
165
+ 7. Add persistent `/data` checkpoint slots for ZeroGPU/local checkpoint readiness.
166
+ 8. Stabilize Space runtime by disabling experimental Gradio SSR.
167
+ 9. Rebalance the UI into configuration, input/summary, and detailed review panes.
168
+ 10. Iterate the visible model status copy so the app reads as local-first and resilient rather than broken when hosted providers are unavailable.
169
+
170
+ The most important engineering decision was to reduce risk early. A deterministic reviewer with a custom diff renderer is valuable on its own; model bridges then improve the experience rather than define it.
171
+
172
+ ## Failure Handling
173
+
174
+ The app is designed to stay useful across common hackathon failure modes:
175
+
176
+ - hosted model route unavailable,
177
+ - OAuth token missing,
178
+ - Space rebuild,
179
+ - provider rate limit,
180
+ - cold start,
181
+ - missing local checkpoints,
182
+ - public PR URL fetch failure.
183
+
184
+ For model failures, the UI reports that the bridge is armed and that deterministic fallback is active. The review still completes.
185
+
186
+ For rebuild persistence, model files belong under `/data`, not `/app`. The `/app` directory can be reset during rebuilds, but the mounted bucket persists as long as it remains attached to the Space.
187
+
188
+ ## Hackathon Fit
189
+
190
+ DiffSense targets the Backyard AI track because it is a practical local AI tool for a daily developer workflow.
191
+
192
+ It also maps cleanly to sponsor badges:
193
+
194
+ - Gradio app: implemented as a Hugging Face Space using Gradio.
195
+ - Best Use of Codex: Codex was used throughout design, implementation, debugging, deployment, and documentation.
196
+ - Best Agent: the app is a staged review pipeline with parsing, classification, summarization, routing, and rendering.
197
+ - Off Brand: custom diff UI instead of a stock chat interface.
198
+ - Best Demo: one-click sample or public PR URL produces clear review output quickly.
199
+ - Best MiniCPM Build: MiniCPM-V 4.6 image path is integrated for visual PR context.
200
+ - Nemotron Hardware Prize: Nemotron 3 Nano router bridge is integrated.
201
+ - Tiny Titan: Nemotron 3 Nano 4B checker path is integrated.
202
+ - Best Use of Modal: Modal endpoint bridge is included through `DIFFSENSE_MODAL_ENDPOINT`.
203
+
204
+ ## What We Would Build Next
205
+
206
+ The next product improvements are straightforward:
207
+
208
+ 1. Add a real Modal endpoint and set `DIFFSENSE_MODAL_ENDPOINT`.
209
+ 2. Stage quantized checkpoints under `/data/models`.
210
+ 3. Add downloadable patch suggestions.
211
+ 4. Add GitHub comment export.
212
+ 5. Add per-rule enable/disable controls.
213
+ 6. Add a richer MiniCPM-V demo with screenshots and architecture diagrams.
214
+
215
+ ## Conclusion
216
+
217
+ DiffSense is small by design. It does not require a perfect model endpoint to be useful, and it does not ask teams to send private code to a SaaS reviewer. It turns a diff into a structured, inspectable review artifact and creates clear extension points for local checkpoints and sponsor models.
218
+
219
+ That combination, reliable deterministic review plus optional small-model intelligence, is the core idea: useful now, private by default, and ready to grow into a fully local AI code review workflow.
LINKEDIN_POST.md ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LinkedIn Post Draft
2
+
3
+ We built DiffSense for the Hugging Face Build Small hackathon: a private, local-first pull request reviewer for teams that cannot send proprietary code to cloud review bots.
4
+
5
+ The idea is simple:
6
+
7
+ Paste a unified diff or public GitHub PR URL.
8
+ Get severity-tagged review findings.
9
+ Read inline comments attached to changed lines.
10
+ Copy structured JSON into your PR workflow.
11
+
12
+ The core review path is deterministic and runs inside the app process, so the demo stays useful even when model providers are cold, rate-limited, or unavailable. Then we add optional small-model bridges for the hackathon stack:
13
+
14
+ - JetBrains Mellum 2 for code-review summaries
15
+ - NVIDIA Nemotron 3 Nano for agentic routing and triage
16
+ - NVIDIA Nemotron 3 Nano 4B for a Tiny Titan checker pass
17
+ - OpenBMB MiniCPM-V 4.6 for PR screenshots, diagrams, and UI context
18
+ - Modal through a provider bridge for hosted inference
19
+
20
+ The Space also has a persistent `/data` bucket mount with local checkpoint slots, so the app is ready for ZeroGPU/local model runs without putting weights in the repo.
21
+
22
+ What I like most about this project is that it is not a chat UI pretending to be a code-review tool. DiffSense renders a custom inline diff view with file headers, hunk headers, line numbers, severity badges, comments, suggested fixes, and machine-readable JSON.
23
+
24
+ Built with Gradio, Hugging Face Spaces, Codex, and open model targets under the Build Small constraints.
25
+
26
+ Try the Space: https://huggingface.co/spaces/build-small-hackathon/DiffSense
27
+
28
+ #BuildSmall #HuggingFace #Gradio #LocalAI #CodeReview #OpenSource #AIEngineering
29
+
30
+ ## Shorter Version
31
+
32
+ We shipped DiffSense for the Hugging Face Build Small hackathon.
33
+
34
+ It is a private, local-first PR reviewer: paste a diff or public GitHub PR URL, get inline severity-tagged findings and structured JSON without relying on a SaaS code review bot.
35
+
36
+ The app has a deterministic review engine for reliability, plus optional bridges for Mellum 2, Nemotron 3 Nano, Tiny Titan, MiniCPM-V 4.6, Modal, and persistent `/data` checkpoint slots.
37
+
38
+ The result is not a chat transcript. It is a real code-review artifact: inline comments, hunk-level findings, suggested fixes, and JSON output.
39
+
40
+ Space: https://huggingface.co/spaces/build-small-hackathon/DiffSense
41
+
42
+ #BuildSmall #HuggingFace #Gradio #LocalAI #CodeReview
README.md CHANGED
@@ -147,6 +147,12 @@ Then open `http://localhost:7860`.
147
  4. Show the JSON output as a practical artifact for PR automation.
148
  5. Toggle the optional model summary to show the small-model enhancement path.
149
 
 
 
 
 
 
 
150
  ## Social Post Draft
151
 
152
  DiffSense is our Build Small hackathon project: a private PR reviewer for teams that cannot send proprietary code to cloud bots.
 
147
  4. Show the JSON output as a practical artifact for PR automation.
148
  5. Toggle the optional model summary to show the small-model enhancement path.
149
 
150
+ ## Submission Artifacts
151
+
152
+ - [HF technical paper](HF_TECH_PAPER.md)
153
+ - [LinkedIn post draft](LINKEDIN_POST.md)
154
+ - [Demo video pitch](DEMO_VIDEO_PITCH.md)
155
+
156
  ## Social Post Draft
157
 
158
  DiffSense is our Build Small hackathon project: a private PR reviewer for teams that cannot send proprietary code to cloud bots.