Skip to content

Commit c08c44f

Browse files
author
Bala Vignesh S
committed
feat: integrate TitanMem as experimental memory subsystem with honest benchmark results
- Add src/titanmem/ module (win32_monitor, metrics) - Add benchmarks/titanmem/ with reproducible blind test harness - Add docs/titanmem_benchmarks.md with full methodology and raw numbers - Update README: remove unearned claims, add TitanMem section with evidence - TitanMem v1 status: did not outperform native OS paging under controlled testing - Add design principle: Measure Before You Claim
1 parent 2db330b commit c08c44f

10 files changed

Lines changed: 595 additions & 56 deletions

File tree

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,5 @@ opentelemetry_sdk = "0.32.1"
4646
opentelemetry-otlp = "0.32.0"
4747
tracing-opentelemetry = "0.33.0"
4848
reqwest = { version = "0.13.4", features = ["blocking"] }
49+
memmap2 = "0.9.10"
50+
windows-sys = { version = "0.61.2", features = ["Win32_Foundation", "Win32_System_Memory", "Win32_System_ProcessStatus", "Win32_System_Threading", "Win32_Security"] }

README.md

Lines changed: 60 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
<h1 align="center">Hypercore</h1>
66

77
<p align="center">
8-
<strong>Hypercore is an OpenAI-compatible LLM inference server written in Rust.</strong>
8+
<strong>CPU-first LLM inference runtime for local AI ownership.</strong>
99
</p>
1010

1111
<p align="center">
1212
<a href="#quickstart">Quickstart</a> •
1313
<a href="#system-capabilities">Capabilities</a> •
1414
<a href="#benchmarks">Benchmarks</a> •
15+
<a href="#titanmem">TitanMem</a> •
1516
<a href="#limitations">Limitations</a> •
1617
<a href="#deployment">Deploy</a>
1718
</p>
@@ -20,21 +21,18 @@
2021
<img src="https://img.shields.io/badge/rust-1.80+-orange?logo=rust" alt="Rust" />
2122
<img src="https://img.shields.io/badge/license-MIT-blue" alt="License" />
2223
<img src="https://img.shields.io/badge/OpenAI-compatible-green" alt="OpenAI Compatible" />
23-
<img src="https://img.shields.io/badge/status-production--ready-brightgreen" alt="Status" />
2424
</p>
2525

2626
---
2727

28+
Hypercore is an OpenAI-compatible LLM inference server written in Rust, designed for internal APIs, edge inference, and on-prem deployments where reliability matters more than raw throughput.
29+
2830
- **Continuous batching** (up to 4 sessions)
2931
- **Hard memory + context bounds** (no silent OOMs)
3032
- **CPU-first**, single ~15MB binary
3133
- **Prometheus + OpenTelemetry** built in
3234
- **Drop-in replacement** for OpenAI SDK
3335

34-
*Best for: internal APIs, edge inference, on-prem deployments*
35-
36-
Hypercore is a CPU-first, OpenAI-compatible LLM inference runtime focused on deterministic scheduling, bounded resource usage, and production stability.
37-
3836
---
3937

4038
## Quickstart
@@ -117,9 +115,9 @@ curl http://localhost:8080/v1/chat/completions \
117115

118116
## Benchmarks
119117

120-
Measured behavior on reference hardware (AMD Ryzen 9 7900X, DDR5) running `hypercore bench` with a 0.5B Q5_K_M GGUF model.
118+
Measured on reference hardware (AMD Ryzen 9 7900X, DDR5) with a 0.5B Q5_K_M GGUF model.
121119

122-
*Note: Results will vary significantly based on model size, quantization, and CPU architecture.*
120+
*Results vary based on model size, quantization, and CPU architecture.*
123121

124122
| Metric | Value |
125123
|--------|-------|
@@ -130,7 +128,35 @@ Measured behavior on reference hardware (AMD Ryzen 9 7900X, DDR5) running `hyper
130128
| **Throughput (1 session)** | `~45 tokens/sec` |
131129
| **Throughput (4 sessions)**| `~110 tokens/sec` |
132130

133-
*Comparisons to other runtimes (vLLM, llama.cpp, TGI) via standardized harness will be published in v1.1.*
131+
---
132+
133+
## TitanMem
134+
135+
TitanMem is Hypercore's experimental memory virtualization subsystem. It was designed to improve inference speed when running models larger than available physical RAM.
136+
137+
**Status: Experimental — current implementation does not outperform native OS paging.**
138+
139+
We built TitanMem, benchmarked it rigorously under enforced memory pressure (via `SetProcessWorkingSetSizeEx` hard working set limits), and discovered that the Windows kernel's native demand paging already handles mmap'd model files near-optimally. Our prefetch strategy actively increased page faults and reduced throughput.
140+
141+
We published the data anyway because honest engineering matters more than marketing.
142+
143+
👉 **[Full benchmark results and methodology](docs/titanmem_benchmarks.md)**
144+
145+
### Key Finding
146+
147+
| Budget | Baseline Tok/s | TitanMem Tok/s | Baseline Page Faults | TitanMem Page Faults |
148+
|--------|---------------|---------------|---------------------|---------------------|
149+
| 1024 MB | **0.81** | 0.87 | 5,695,894 | 5,738,633 |
150+
| 2048 MB | **1.92** | 1.54 | 1,594,375 | 1,765,599 |
151+
152+
TitanMem v1 is archived. Research continues into layer-aware scheduling and custom block I/O approaches.
153+
154+
### Reproduce
155+
156+
```bash
157+
cargo build --release
158+
python benchmarks/titanmem/run_blind_benchmarks.py
159+
```
134160

135161
---
136162

@@ -140,6 +166,15 @@ Measured behavior on reference hardware (AMD Ryzen 9 7900X, DDR5) running `hyper
140166
- **Max concurrency is bounded** (default: 4 sessions)
141167
- **Not optimized for high-throughput public LLM APIs**
142168
- **Best suited for internal / edge / controlled environments**
169+
- **TitanMem memory engine is experimental and does not yet demonstrate an advantage**
170+
171+
---
172+
173+
## Architecture
174+
175+
Hypercore enforces strict lifecycle tracking, invariant assertions on KV-cache slot allocation, and proactive memory pressure monitoring.
176+
177+
👉 **[Read the Architecture Document](docs/architecture.md)**
143178

144179
---
145180

@@ -163,7 +198,6 @@ services:
163198
```
164199
165200
### 2. systemd Service
166-
Deploying on a bare-metal Linux node? Drop this into `/etc/systemd/system/hypercore.service`:
167201
```ini
168202
[Unit]
169203
Description=Hypercore LLM Inference Runtime
@@ -179,45 +213,6 @@ Environment="RUST_LOG=info"
179213
WantedBy=multi-user.target
180214
```
181215

182-
### 3. Railway / Render (Serverless Containers)
183-
Hypercore is perfect for serverless container platforms because it has zero bloat and boots instantly.
184-
1. Add a `Dockerfile` that downloads your GGUF and runs the binary.
185-
2. Set the `PORT` env var (Hypercore binds to it automatically).
186-
3. Deploy!
187-
188-
---
189-
190-
## Architecture
191-
192-
Hypercore enforces strict lifecycle tracking, invariant assertions on KV-cache slot allocation, and proactive memory pressure monitoring.
193-
194-
👉 **[Read the Architecture Document](docs/architecture.md)**
195-
196-
---
197-
198-
## "Why Not vLLM?" FAQ
199-
200-
Hypercore targets a different deployment class than vLLM.
201-
202-
- **GPU-First vs CPU-First:** vLLM expects a cluster of A100s or H100s and uses PagedAttention to maximize throughput on GPUs. Hypercore is designed for the 95% of deployments that don't need a $20k GPU: internal tools, edge devices, and enterprise APIs running on standard VMs.
203-
- **Python vs Rust:** vLLM has a large Python dependency graph. Hypercore is a single 15MB statically linked binary.
204-
- **Throughput vs Reliability:** vLLM is optimized for maximum token generation. Hypercore optimizes for safety bounds — if a server runs out of memory, Hypercore rejects the request instantly with a clean `503` rather than failing mid-generation.
205-
206-
---
207-
208-
## Design Philosophy
209-
210-
Hypercore is built on three core principles that guide every engineering decision:
211-
212-
### 1. Boring is What Users Trust
213-
Every component is designed to be **predictable under load**. Hypercore chooses explicit error handling over silent fallbacks, deterministic scheduling over probabilistic heuristics, and clear failure modes over optimistic retries.
214-
215-
### 2. No Silent Mutations
216-
If Hypercore can't fulfill a request exactly as specified, it rejects it with a clear error. It will never silently truncate your prompt, quietly reduce `max_tokens`, or drop requests without telling you. Every admission decision, every timeout, every rejection is logged and metriced.
217-
218-
### 3. Safety is Not Optional
219-
Memory limits aren't suggestions. Request timeouts aren't configurable to "infinity." Body size limits can't be disabled. The Safety Governor runs continuously, monitoring system memory and swap pressure.
220-
221216
---
222217

223218
## CLI Commands
@@ -231,9 +226,6 @@ hypercore chat --model model.gguf
231226

232227
# Run benchmarks
233228
hypercore bench --model model.gguf --concurrency 4 --tokens 100
234-
235-
# Stress test
236-
hypercore stress --model model.gguf --rate 10 --duration 60
237229
```
238230

239231
---
@@ -276,6 +268,22 @@ safe_mode: true
276268

277269
---
278270

271+
## Design Philosophy
272+
273+
### 1. Boring is What Users Trust
274+
Every component is designed to be **predictable under load**. Hypercore chooses explicit error handling over silent fallbacks, deterministic scheduling over probabilistic heuristics, and clear failure modes over optimistic retries.
275+
276+
### 2. No Silent Mutations
277+
If Hypercore can't fulfill a request exactly as specified, it rejects it with a clear error. It will never silently truncate your prompt, quietly reduce `max_tokens`, or drop requests without telling you.
278+
279+
### 3. Safety is Not Optional
280+
Memory limits aren't suggestions. Request timeouts aren't configurable to "infinity." Body size limits can't be disabled.
281+
282+
### 4. Measure Before You Claim
283+
Every performance claim in this repository is backed by reproducible benchmarks. If a subsystem doesn't demonstrate an advantage under rigorous testing, we say so.
284+
285+
---
286+
279287
## Contributing
280288

281289
Contributions are welcome! Please:
@@ -290,8 +298,6 @@ Contributions are welcome! Please:
290298

291299
## Security
292300

293-
Hypercore takes security seriously at every layer:
294-
295301
| Layer | Protection |
296302
|-------|------------|
297303
| **Network** | Optional Bearer token auth, CORS controls |
@@ -301,8 +307,6 @@ Hypercore takes security seriously at every layer:
301307
| **Runtime** | 120s request timeouts prevent resource exhaustion |
302308
| **Shutdown** | 3-stage drain prevents data loss |
303309

304-
**Responsible Disclosure:** If you find a security vulnerability, please email the maintainer directly rather than opening a public issue.
305-
306310
---
307311

308312
## License

benchmarks/titanmem/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# TitanMem Benchmark
2+
3+
**Status: Experimental — Did not outperform native OS paging.**
4+
5+
See the [benchmark results](../../docs/titanmem_benchmarks.md) for full analysis.
6+
7+
## Run
8+
9+
```bash
10+
cargo build --release
11+
python benchmarks/titanmem/run_blind_benchmarks.py
12+
```

0 commit comments

Comments
 (0)