GuiXi (龟息) means "turtle breathing" - the art of slow, steady, minimal respiration. Just as a turtle can endure long periods with minimal breath, GuiXi enables AI model inference and training over ordinary networks with drastically reduced bandwidth requirements.
The core philosophy: Inference doesn't have to be bandwidth-hungry. Through intelligent compression, semantic caching, delta synchronization, and protocol optimization, GuiXi achieves up to 10-100x bandwidth reduction without sacrificing response quality.
Target Users:
- Developers deploying LLMs in bandwidth-constrained environments
- Edge AI applications with limited connectivity
- Multi-node training across geographic regions
- Mobile apps integrating LLM capabilities
GuiXi Architecture
├── guixi/
│ ├── __init__.py # Version and exports
│ ├── __main__.py # Entry point
│ ├── cli.py # CLI interface
│ ├── gui.py # PySide6 GUI
│ ├── app.py # Flask web app
│ ├── api.py # Python API
│ ├── core.py # Business logic
│ ├── compress.py # Compression engine
│ ├── cache.py # Semantic cache
│ ├── protocol.py # Binary protocol
│ └── sync.py # Delta sync
├── templates/ # Web templates
├── data/ # Sample data
└── tests/ # Test suite
Real-time compression of streaming tokens using LZ4/zstd:
Raw Token Stream: [3421, 8923, 1042, 5678, ...] (4 bytes each)
Compressed: 0x1A4B8C2D... (variable length)
Compression Ratios:
- LZ4: 2-4x ratio, <1ms latency
- Zstd: 4-8x ratio, 2-5ms latency
Cache similar prompts using embedding-based similarity:
# Embed prompt → search cache → if similarity > 0.95, return cached
# Cache structure: (embedding_vector) → response_tokensCache Hit Scenarios:
- Exact match: 100% bandwidth savings
- Near duplicate (>95% similarity): 90%+ savings
- Semantic similarity (>80%): 50%+ savings
Only transmit changes between states:
Client State: [A, B, C, D, E]
Server State: [A, B, C, X, Y, Z]
Delta: [+X, +Y, +Z, -D, -E]
Reduce token representation precision:
| Encoding | Bits/Token | Range | Use Case |
|---|---|---|---|
| int8 | 8 | -128 to 127 | Small vocabularies |
| int16 | 16 | -32K to 32K | Standard vocab |
| int32 | 32 | -2B to 2B | Large vocab |
| Huffman | variable | ~4 avg | Frequency-optimized |
Dynamic batch sizing based on network conditions:
# Network good → larger batches (more throughput)
# Network poor → smaller batches (lower latency)
# Algorithm: AIMD (Additive Increase Multiplicative Decrease)Binary protocol over WebSocket for minimum overhead:
Header (8 bytes):
- Magic: 0x47585849 ('GXXI')
- Version: uint8
- Flags: uint8 (compression, encryption, etc.)
- Length: uint32 (payload length)
Payload:
- Compressed token stream or delta updates
@dataclass
class TokenStream:
tokens: List[int]
compression: str # 'none', 'lz4', 'zstd'
timestamp: float
@dataclass
class CacheEntry:
embedding: np.ndarray
response: TokenStream
prompt_hash: str
created_at: float
access_count: int
@dataclass
class DeltaUpdate:
additions: List[int]
deletions: List[int]
position: int
@dataclass
class InferenceRequest:
prompt: str
max_tokens: int
temperature: float
compression: str
cache_policy: str # 'force', 'read', 'write', 'none'# Start server
guixi server --host 0.0.0.0 --port 8080 --model llama2
# Inference with bandwidth stats
guixi infer "What is AI?" --compress lz4 --stats
# Benchmark bandwidth
guixi bench --prompt-file prompts.txt --iterations 100
# Cache management
guixi cache --stats --clearfrom guixi import GuiXiClient
client = GuiXiClient("ws://server:8080", compression="lz4")
# Streaming inference
async for token in client.stream("Explain quantum computing"):
print(token, end="", flush=True)
# Batched inference
results = await client.batch_infer(prompts, batch_size=10)
# Cache control
client.cache_write("my_key", tokens)
cached = client.cache_read("my_key")- Server dashboard with bandwidth metrics
- Real-time compression ratio visualization
- Cache hit rate charts
- Inference log with token timing
# REST endpoints
POST /api/infer # Single inference
POST /api/batch # Batched inference
GET /api/cache/stats # Cache statistics
WS /api/stream # WebSocket streaming
# Request format
{
"prompt": "What is AI?",
"max_tokens": 100,
"temperature": 0.7,
"compression": "lz4",
"cache": "read"
}| Metric | Baseline | With GuiXi | Improvement |
|---|---|---|---|
| Token bandwidth | 4 bytes/token | 0.8 bytes/token | 5x |
| Cache hit rate | 0% | 30-70% (application dependent) | variable |
| Compression latency | N/A | <5ms | - |
| Protocol overhead | ~200 bytes/msg | ~12 bytes/msg | 16x |
| Overall bandwidth | 100% | 10-30% | 3-10x |
Client <-> GuiXi Proxy <-> LLM Server
|
+-- Compression
+-- Caching
+-- Protocol translation
Client App <-> GuiXi Client SDK <-> LLM Server
|
+-- Local compression
+-- Local cache
+-- Smart batching
Edge Device <-> GuiXi Edge <-> Cloud LLM
|
+-- Offline cache
+-- Delta sync
+-- Disconnection handling
- Use
lz4for fast compression,zstandardfor high compression - Embeddings via
sentence-transformersfor semantic cache - WebSocket via
websocketslibrary - GUI via PySide6 with pyqtgraph for visualization
- Protocol versioning for forward compatibility