-
-
Tensor Coach understand what happened in your PyTorch code.
-
Follow explanations back to recorded operations and source lines.
-
1. Public examples support cloud fallback when on-device AI is unavailable.
-
Explore tensor relationships from real execution records.
-
Review the exact payload before approving a cloud request.
Inspiration
Learning PyTorch often means encountering an error message without understanding what happened to your tensors. A dimension mismatch tells you that something failed, but it may not reveal how you confused the batch and feature axes. A missing gradient can be even harder to explain.
We wanted to make those moments useful for learning. Instead of immediately supplying corrected code, Tensor Coach helps learners inspect their actual execution, understand the evidence, and test their own correction.
Hybrid AI fits this problem because learners may be working with private code. They should be able to investigate locally and choose explicitly when to send information to a cloud model.
What it does
Tensor Coach is a Python/PyTorch learning workspace that connects code, execution evidence, tensor visualizations, and AI guidance.
Learners can explore supplied examples or write their own code and assertions. After execution, they can inspect recorded operations, tensor shapes, bounded value samples, exception locations, and supported expected versus actual comparisons.
For supported operations, interactive visualizations explain relationships such as reduction groups, reshaping, transposition, and broadcasting. AI hints can point to a recorded operation and its source line, giving learners a concrete place to investigate.
The inference route depends on the context:
- Own code, edited examples, and imported reports: on-device inference through Firebase AI Logic, without automatic cloud fallback.
- An explicitly requested cloud explanation: the learner reviews the exact payload before sending it.
- Unchanged public examples: on-device inference is preferred, with cloud fallback available so visitors without a ready local model can try the experience. The interface displays the actual inference source. Editing code invalidates old advice, and a fresh execution—not the model’s opinion—determines whether the learner’s assertions pass. ## How we built it We built the workspace with React, TypeScript, and CodeMirror. Live AI inference uses Firebase AI Logic with separate on-device and cloud configurations, protected by Firebase App Check.
The execution and visualization layers work independently of AI. A bounded Python/PyTorch observer records supported operations and runtime evidence. Deterministic React and SVG renderers turn those observations into interactive scenes. The model selects permitted evidence references; it does not generate executable visualization code or invent coordinates.
Structured responses, source reference validation, and response size limits constrain how AI output enters the interface.
Local execution uses fresh, resource-limited CPU containers with networking disabled, read only root filesystems, non root users, and no host directory mounts. This runner is designed for local use; static hosting does not expose a public Docker execution service. Notebook export and report import provide an alternative workflow, with imported observations clearly labeled as self reported.
We also separated the independent studio from a pre-existing private learning application. Reused foundations and the earlier coach prototype are disclosed in the repository’s NOTICE.md; we do not claim every component was created during the hackathon.
Challenges we ran into
Making explanations trustworthy. A model can return valid JSON and cite a real observation while still giving an incorrect explanation. We separated recorded facts, computed visual relationships, and model interpretations, and avoided treating structural validation as proof of correctness.
Making privacy survive ordinary editing. A supplied public example can become private as soon as someone changes it. We implemented routing rules that revoke automatic cloud permission after editing, including across undo and reload.
Keeping advice tied to the right execution. An explanation can become misleading after a code change. We invalidate stale advice when its code or execution context changes.
Working with on-device availability and quality. Browser support, model preparation, and local reasoning quality vary. We tested device, cloud, and unavailable-device paths separately and displayed the inference source without treating it as proof of an exact model generation.
Showing useful evidence without pretending to trace everything. Observations are bounded, and visual contracts cover supported operations. Missing information remains unknown rather than being filled in with a simulated execution.
Accomplishments that we're proud of
We built a workflow where learners can move from a failing line to a recorded tensor operation, inspect its inputs and outputs, make a correction, and rerun their own checks.
We verified genuine on-device guidance, separately approved cloud explanations, and cloud fallback for unchanged public examples. We also checked that reviewing or cancelling a cloud payload does not send an inference request, and that private-code workflows do not silently fall back to the cloud.
The visual evidence remains usable without an AI response. That makes the execution inspector a learning tool in its own right.
We are also proud of the provenance controls: imported reports remain self-reported, stale advice is hidden, and passing assertions stays separate from an AI explanation.
What we learned
Hybrid AI requires more than choosing between two models. It requires clear decisions about which information may leave the device, when fallback is permitted, and how users can understand what actually happened.
We learned that a smaller, evidence-linked hint can be more useful than a confident diagnosis. We also learned that deterministic visualizations and generative explanations have different responsibilities: the visualization should remain faithful to recorded execution, while the explanation must acknowledge uncertainty.
Our testing also showed the limits of local reasoning. Valid output and navigable evidence links do not guarantee a good answer. We have not yet demonstrated learning gains or cost savings, and those require evaluation beyond a working demo.
What's next for Tensor Coach
We want to test Tensor Coach with PyTorch beginners and measure whether they can explain an error, repair it independently, and transfer that understanding to a new problem.
We also plan to expand supported visual contracts, improve guidance when observations are incomplete, and evaluate explanation quality across more error types and device configurations.
For broader deployment, we would add authenticated execution infrastructure, server-enforced usage budgets, and operational monitoring.
The goal remains the same: help learners understand their next step well enough to take it themselves.
Built With
- ai
- app
- check
- codemirror
- docker
- logic
- nano
- python
- pytorch
- react
- svg
- typescript
- vite