Inspiration
Our inspiration for this project came from our team's own lived experiences. Say you study hard for a given midterm - you feel confident, but you receive a bad grade. You don't understand why, until you realize you wrote the wrong notes down in the first place.
And logical mistakes spread like wildfire. A wrong variance gives a wrong standard deviation, which gives a wrong confidence interval. By the time you realize you made a mistake, mounds of remedy work await. But if Grammarly could catch a typo the instant you make it, we believed we could do the same for reasoning.
What it does
Lattice is a Chrome extension that builds logical sequences as you write in Google Docs, Overleaf, and any text field.
- Catches mistakes and their consequences. It flags erroneous statements. It also flags erroneous statements built on that error, and you can easily find the root cause of a failing sequence.
- Hints, not answers. Lattice only guides, never gives. But if you're stuck, a Lattice walks you back to where the mistake started, and works with you to fit together the puzzle pieces.
- Shows how your work fits together. Hold ⌥ and click any statement to see its reasoning chain: everything it relies on above, and everything built on it below. You can step through it line by line, like a debugger for your reasoning.
How we built it
Lattice treats each document as a program. Think of it like Lean for natural language.
1. Finding statements. Before you can check reasoning, you need to know which sentences make a claim. We fine-tuned DistilBERT on Microsoft's Claimify dataset to classify every sentence as a claim or not. It runs locally and scores a whole document in about a tenth of a second. We set the threshold for 98% recall: a missed claim is never checked, while a false one is cheap because the checker throws it out.
2. Evaluating like an interpreter. Our code walks the document top-down and keeps an environment of every name bound above, with lexical scoping, shadowing and per-problem scopes. If a student writes
$$x = 10, \qquad x = x + x, \qquad x + 5 = 30,$$
the second line reads the old $x$, and the third is checked against $x = 20$. Claude then judges truthiness one paragraph at a time against that given environment, the verdicts above it, and the problem it's answering. It returns structured output: a verdict and a confidence, what it defines, what it reads, what it relies on, and whether it's a consequence of an earlier mistake.
3. Incremental, like a build system. Every checked statement records its dependencies, so an edit only reruns the statements that depend on it. We also check up to four paragraphs ahead speculatively and keep each result only if the assumptions it was checked under held.
4. The graph. The records are now a directed acyclic graph in document order. Option + click shows a statement's sequence, everything it depends on and everything that depends on it.
Stack: TypeScript Chrome extension (Maniver holding the API key, Claude for checking and tutoring, and Python, PyTorch and Hugging Face Transformers for the classifier.
Challenges we ran into
Restarting from scratch. By far the biggest challenge we ran into was parting with our first idea halfway through the hackathon. The original Lattice (on our old-main branch) was a persistent "understanding graph" for college students. But as we interacted with our extension, we realized a number of context switches were occurring. So we restarted with the new question of what if the feedback occurred directly in a given document, at runtime.
Logical language. The second biggest challenge we faced was parsing a logical language. Generating logical relations in a body of natural language is an extremely hard task, and we had to start from the very definition of what makes something logical (something based on clear reasoning), but we had to ensure our evaluation of what makes a statement truthy/falsy was 100% accurate, as any fallacy in this would break down our entire project. To do so, we combined the strengths of a fine-tuned model and Opus 5.5, creating a strong defense against false statements.
-Latency With the scope we had, we had to use LLMs, but the caveat to this is latency. We had to apply every optimization trick in the book to reduce the time cost of statement evals such that we kept our "at runtime" goal. I think we did pretty well.
Accomplishments that we're proud of
One of our biggest eureka moments was coming up with our new idea, especially when we learned no one's built a company to do it yet! It seems so simple yet so robust, and it is something we plan on using for our own academic purposes.
Another eureka moment was seeing Lattice correctly prove some of my Theory of Computation homework wrong (which LLMs at the time could not do...), and it actually matched the feedback I had gotten from my professor! (Alan)
What we learned
- We learned to never give up. Our best idea came when we least expected it- and it would have never come if we had packed our bags and walked.
What's next for Lattice
- Although we show Lattice as an assistant, we believe reasoning chains in natural language as a means of text relations have so much potential in so many domains - imagine a lawyer drafting a contract, warned of a contradiction 10 pages ago. Or a doctor reading clinical notes to find a diagnosis, relying on a falsy value. We believe Lattice is the pathway towards truth.
Built With
- chrome
- claude
- distilbert
- google-docs
- overleaf
- python
- pytorch
- typescript
Log in or sign up for Devpost to join the conversation.