Linearc LogoLINEARC
Back to Case Studies Archive
AI INFRASTRUCTURE & CACHINGAuthor: Rishabh Sharma

Layerzero — Hybrid AI Document Summarization Platform

Multi-Model LLM Routing with SHA-256 Latency Compression

Layerzero Interactive Execution TopologySHA-256 Latency Compression Engine
01
Document Ingest
Mimetype parsing (PDF/DOCX/URL)
02
SHA-256 Hasher
Generates unique buffer cache key
03
Redis Cache Check
Hit: ~150ms instant response
04
Dynamic LLM Router
Miss: Cerebras / Gemini / Sarvam / Ollama
Latency Path Benchmark:Cache Hit: ~150ms | Cache Miss: ~8.5s → Auto-Cached

Client / Project Snapshot

Layerzero is a full-stack, hybrid AI document summarization platform built and shipped as a college project (submitted under 'Academic Paper Summarizer'). It lets users summarize documents using a choice of AI models, with production-grade infrastructure behind it.

The Problem

AI summarization is easy to prototype but expensive to run well — repeated queries against the same document meant redundant, slow LLM calls every time, with response times stretching to several seconds per request. For a tool meant to be used repeatedly against the same set of papers/documents, that latency made the product feel sluggish and wasted API costs on duplicate work.

My Role & Approach

Solely architected and built the backend infrastructure — Node.js/Express (ESM) API, MongoDB for persistence, and a Redis caching layer (via Upstash) keyed on SHA-256 hashes of document content. Containerized the stack with Docker Compose, deployed to AWS EC2 with GitHub Actions CD, and shipped the frontend on Cloudflare Workers. Integrated four AI providers (Gemini 2.5 Flash, Cerebras GPT-OSS-120B, Sarvam 30B, Gemma 4 via Ollama) behind a unified client layer, and debugged production issues including a nested CORS array bug, a cookie-parsing typo, a port-mapping misconfiguration, and an OAuth breakage on Cloudflare Pages.

The Solution / What You Built

  • Node.js/Express (ESM) backend with MongoDB persistence
  • Redis (Upstash) caching layer using SHA-256 content hashing for cache keys
  • Multi-model AI layer: Gemini 2.5 Flash, Cerebras GPT-OSS-120B, Sarvam 30B, Gemma 4 via Ollama
  • Dockerized, deployed on AWS EC2 with GitHub Actions CD
  • Frontend deployed on Cloudflare Workers

Results / Impact

Cache hit response time cut from ~9 seconds to ~150ms — a ~98% latency reduction on repeated queries, turning a noticeably slow summarization flow into a near-instant one.

Call to Action

Interested in backend architecture that's built to actually perform under repeated load, not just work in a demo?

Book a call
Technologies Used
Node.jsExpress.js (ESM)Redis (Upstash)MongoDBDocker ComposeAWS EC2GitHub Actions CDCloudflare WorkersGemini 2.5 FlashCerebrasSarvam 30BOllama Gemma