# Psyche Domain (Serwaa) Performance Baseline Documentation

**Document Version:** 1.0 **Analysis Date:** January 2026 **Analyst:** Claude
Code (Opus 4.5) **Source Repository:** `/home/ubuntu/oshun/serwaa/`

---

## Executive Summary

This document establishes the performance baseline for the Serwaa codebase
(future Psyche domain), covering:

- Avatar rendering performance characteristics
- End-to-end response latency targets
- Conferencing integration latency requirements
- Quality metrics and validation thresholds
- Monitoring and benchmarking infrastructure

### Key Performance Targets

| Metric              | Target             | Warning | Critical |
| ------------------- | ------------------ | ------- | -------- |
| Avatar Rendering    | 30 FPS @ 1024x1024 | <27 FPS | <20 FPS  |
| STT Latency         | 100 ms             | 150 ms  | 200 ms   |
| TTS Latency         | 100 ms             | 150 ms  | 200 ms   |
| LLM Inference       | 200 ms             | 300 ms  | 400 ms   |
| End-to-End Response | 500 ms             | 750 ms  | 1000 ms  |
| A/V Sync Offset     | 20 ms (excellent)  | 50 ms   | 100 ms   |

---

## 1. Avatar Rendering Performance (Task 24.1.3.1)

### 1.1 Resolution and FPS Configuration

**Source:** `/services/avatar-engine/src/avatar_engine/config.py`

| Quality Preset | Resolution | Target FPS  | Use Case                  |
| -------------- | ---------- | ----------- | ------------------------- |
| LOW            | 512x512    | 60          | Mobile, low bandwidth     |
| MEDIUM         | 768x768    | 45          | Standard video calls      |
| HIGH (default) | 1024x1024  | 30          | HD conferencing           |
| ULTRA          | 1024x1024  | Max quality | Recordings, presentations |

**Configurable Range:**

- Width/Height: 256 - 2048 pixels
- FPS: 15 - 120 frames per second

### 1.2 3D Gaussian Splatting (3DGS) Parameters

| Parameter     | Default | Range      | Impact                    |
| ------------- | ------- | ---------- | ------------------------- |
| Max Gaussians | 100,000 | 10K - 500K | Quality vs VRAM           |
| SH Degree     | 3       | 0 - 4      | View-dependent effects    |
| Tile Size     | 16 px   | 8 - 32     | Rasterization granularity |
| Background    | White   | RGB        | Compositing               |

### 1.3 Rendering Features Configuration

#### Temporal Anti-Aliasing (TAA)

- **Enabled:** Default
- **History Weight:** 0.9 (temporal stability)
- **Jitter:** 0.5 pixels
- **Alpha Threshold:** 1e-3
- **History Clamping:** Enabled

#### Dynamic Resolution Scaling

- **Enabled:** Optional (disabled by default)
- **Min Scale:** 0.5x
- **Max Scale:** 1.0x
- **Scale Step:** 0.05
- **EMA Alpha:** 0.2
- **Cooldown:** 5 frames

#### Level of Detail (LOD)

- **Enabled:** Default
- **Min Pixel Radius:** 0.0
- **Max Gaussians Cap:** Unlimited (0)

#### Culling Optimizations

- **Depth Sorting:** Enabled
- **Frustum Culling:** Enabled

### 1.4 GPU Memory Estimates by Resolution

Based on 3DGS implementation with 100K Gaussians:

| Resolution | Estimated VRAM | Recommended GPU         |
| ---------- | -------------- | ----------------------- |
| 512x512    | ~2-3 GB        | RTX 3060 (8 GB)         |
| 768x768    | ~3-4 GB        | RTX 3070 (8 GB)         |
| 1024x1024  | ~4-6 GB        | RTX 3080 (10 GB)        |
| 1536x1536  | ~6-8 GB        | RTX 4080 (16 GB)        |
| 2048x2048  | ~8-12 GB       | RTX 4090 (24 GB) / A100 |

**Note:** Actual VRAM usage depends on:

- Number of active Gaussians
- TAA history buffers
- Additional feature buffers (AO, etc.)
- Model weights in memory

### 1.5 Cold Start Time Components

| Component              | Estimated Time   | Notes           |
| ---------------------- | ---------------- | --------------- |
| PyTorch/CUDA Init      | 2-5 seconds      | First CUDA call |
| Model Loading          | 1-3 seconds      | 3DGS weights    |
| FLAME Model Init       | 0.5-1 second     | Face model      |
| Preprocessing Pipeline | 0.5-1 second     | MediaPipe init  |
| First Frame Render     | 100-500 ms       | JIT compilation |
| **Total Cold Start**   | **5-10 seconds** | First request   |

### 1.6 Expression Transition Latency

**Face Detection Configuration:**

- Detector: MediaPipe (default)
- Min Face Size: 128 pixels
- Detection Confidence: 0.9
- Target Processing FPS: 30

**Expression Pipeline:**

- Landmark Detection: ~10-20 ms
- FLAME Parameter Extraction: ~5-10 ms
- Gaussian Update: ~5-10 ms
- Render: ~16-33 ms (30-60 FPS)
- **Total Expression Transition:** ~35-70 ms

### 1.7 GPU Tier Performance Expectations

Based on benchmarking infrastructure in `/scripts/benchmarks/gpu_benchmark.py`:

| GPU Tier   | Example  | Expected FPS @ 1024x1024 | VRAM     | Notes              |
| ---------- | -------- | ------------------------ | -------- | ------------------ |
| Entry      | RTX 3060 | 20-25 FPS                | 8 GB     | LOW/MEDIUM quality |
| Mid        | RTX 3080 | 30-40 FPS                | 10 GB    | HIGH quality       |
| High       | RTX 4090 | 50-60 FPS                | 24 GB    | ULTRA quality      |
| Datacenter | A100     | 60+ FPS                  | 40/80 GB | Multiple streams   |
| Datacenter | H100     | 80+ FPS                  | 80 GB    | Maximum throughput |

### 1.8 Quality Validation Thresholds

**Source:** `/services/avatar-engine/src/avatar_engine/utils/metrics.py`

| Metric              | Minimum Acceptable | Target  | Excellent |
| ------------------- | ------------------ | ------- | --------- |
| PSNR                | 25.0 dB            | 30.0 dB | 35.0+ dB  |
| SSIM                | 0.85               | 0.90    | 0.95+     |
| LPIPS               | 0.15 (max)         | 0.10    | 0.05      |
| Identity Similarity | 0.70               | 0.85    | 0.95+     |

---

## 2. End-to-End Response Latency (Task 24.1.3.2)

### 2.1 Voice Pipeline Latency Budget

**Source:** `/packages/common/src/common/metrics/performance.py`

| Component            | Target     | Warning (1.5x) | Critical (2x) |
| -------------------- | ---------- | -------------- | ------------- |
| Audio Capture        | 20 ms      | 30 ms          | 40 ms         |
| Audio Preprocessing  | 10 ms      | 15 ms          | 20 ms         |
| STT Inference        | 100 ms     | 150 ms         | 200 ms        |
| Intent Detection     | 20 ms      | 30 ms          | 40 ms         |
| Entity Extraction    | 20 ms      | 30 ms          | 40 ms         |
| Context Retrieval    | 30 ms      | 45 ms          | 60 ms         |
| RAG Retrieval        | 50 ms      | 75 ms          | 100 ms        |
| LLM Prompt Prep      | 10 ms      | 15 ms          | 20 ms         |
| **LLM Inference**    | **200 ms** | **300 ms**     | **400 ms**    |
| TTS Synthesis        | 100 ms     | 150 ms         | 200 ms        |
| Audio Postprocessing | 10 ms      | 15 ms          | 20 ms         |
| Lipsync Generation   | 20 ms      | 30 ms          | 40 ms         |
| Avatar Rendering     | 33 ms      | 50 ms          | 66 ms         |
| Network Egress       | 20 ms      | 30 ms          | 40 ms         |
| **End-to-End Total** | **500 ms** | **750 ms**     | **1000 ms**   |

### 2.2 LLM Provider Latency Expectations

| Provider  | Model             | Expected Latency | Notes                 |
| --------- | ----------------- | ---------------- | --------------------- |
| Anthropic | Claude 3.5 Sonnet | 150-300 ms       | Streaming first token |
| Anthropic | Claude 3 Opus     | 300-500 ms       | More reasoning        |
| OpenAI    | GPT-4 Turbo       | 200-400 ms       | Streaming             |
| OpenAI    | GPT-4o            | 150-250 ms       | Optimized             |
| Local     | Llama 3.1 70B     | 100-200 ms       | A100 required         |

**Timeout Configuration:**

- LLM Timeout: 60 seconds (env: `LLM_TIMEOUT_SECONDS`)
- RAG Timeout: 5 seconds (env: `RAG_TIMEOUT_SECONDS`)
- Long-term Memory Timeout: 5 seconds (env: `LONG_TERM_MEMORY_TIMEOUT_SECONDS`)

### 2.3 Memory Retrieval Latency

| Memory Type          | Expected Latency | Storage            |
| -------------------- | ---------------- | ------------------ |
| In-Context (Working) | 1-5 ms           | Redis              |
| Short-term (Session) | 5-15 ms          | PostgreSQL         |
| Long-term (Archival) | 20-50 ms         | Qdrant (vector)    |
| Knowledge Base (RAG) | 50-100 ms        | Qdrant + reranking |

**Database Performance Thresholds:**

- PostgreSQL P95: 50 ms (regression threshold)
- Redis P95: 10 ms (regression threshold)

### 2.4 Audio Quality Monitoring

**Source:**
`/services/voice-engine/src/voice_engine/audio/quality_monitoring.py`

| Metric         | Acceptable | Poor       | Critical |
| -------------- | ---------- | ---------- | -------- |
| Clipping Ratio | < 0.1%     | < 1%       | < 5%     |
| DC Offset      | < 0.02     | < 0.05     | < 0.1    |
| RMS Level      | > -45 dBFS | > -55 dBFS | -        |
| SNR            | > 10 dB    | > 5 dB     | -        |
| Dropout Ratio  | < 5%       | < 10%      | -        |

### 2.5 Voice-to-Voice Response Time Breakdown

**Target: < 500 ms total**

```
┌─────────────────────────────────────────────────────────────────────┐
│                    Voice-to-Voice Pipeline                          │
├─────────────────────────────────────────────────────────────────────┤
│                                                                     │
│  Audio In ──► STT ──► NLU ──► LLM ──► TTS ──► Audio Out            │
│    20ms      100ms    40ms   200ms   100ms     20ms                 │
│                                                                     │
│  ├───────────────────── 480ms total ─────────────────────────────┤  │
│                                                                     │
│  + Avatar render (parallel): 33ms                                   │
│  + Network latency: ~20ms                                           │
│                                                                     │
│  Total with avatar: ~500ms                                          │
│                                                                     │
└─────────────────────────────────────────────────────────────────────┘
```

### 2.6 Latency Monitoring Configuration

**Histogram Buckets (ms):** [5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000,
10000]

**Percentiles Tracked:** P50, P75, P90, P95, P99

**Aggregation Window:** 60 seconds

**Sample Rate:** 1.0 (all requests)

---

## 3. Conferencing Integration Latency (Task 24.1.3.3)

### 3.1 A/V Synchronization Targets

**Source:** `/services/voice-engine/src/voice_engine/sync/`

| Quality Level | Offset Threshold | User Experience          |
| ------------- | ---------------- | ------------------------ |
| Excellent     | ≤ 20 ms          | Imperceptible            |
| Good          | ≤ 50 ms          | Acceptable               |
| Acceptable    | ≤ 100 ms         | Noticeable but tolerable |
| Poor          | > 100 ms         | Distracting              |
| Critical      | > 200 ms         | Unusable                 |

### 3.2 Sync Measurement Configuration

| Parameter          | Value        | Description                   |
| ------------------ | ------------ | ----------------------------- |
| Measurement Window | 2.0 seconds  | Rolling window for sync calc  |
| Sample Interval    | 0.05 seconds | 20 samples/second             |
| Outlier Threshold  | 3.0 σ        | Statistical outlier removal   |
| Min Valid Samples  | 5            | Minimum for valid measurement |
| Smoothing Factor   | 0.3          | Exponential moving average    |

### 3.3 Sync Compensation Configuration

| Parameter              | Value       | Description                   |
| ---------------------- | ----------- | ----------------------------- |
| Strategy               | GRADUAL     | Smooth corrections over time  |
| Target                 | VISUAL      | Adjust video timing           |
| Min Correction Trigger | 10 ms       | Minimum offset to correct     |
| Max Single Correction  | 500 ms      | Maximum adjustment per step   |
| Correction Rate        | 0.1         | Fraction corrected per update |
| Smooth Correction Time | 200 ms      | Duration to apply correction  |
| Drift Detection Window | 5.0 seconds | Window for drift calc         |
| Drift Threshold        | 5.0 ms/sec  | Max acceptable drift rate     |
| Max Total Adjustment   | 2000 ms     | Maximum cumulative adjustment |

### 3.4 Platform-Specific Latency Expectations

| Platform        | Video Injection | Audio Sync | Notes              |
| --------------- | --------------- | ---------- | ------------------ |
| Zoom            | 50-100 ms       | ±20 ms     | Virtual camera API |
| Google Meet     | 80-150 ms       | ±30 ms     | Chrome extension   |
| Microsoft Teams | 60-120 ms       | ±25 ms     | NDI/Virtual camera |
| Webex           | 70-130 ms       | ±25 ms     | Virtual camera     |

### 3.5 Frame Rate and Drop Monitoring

**Source:** `/packages/common/src/common/metrics/performance.py`

| Metric            | Target | Threshold      |
| ----------------- | ------ | -------------- |
| Video Capture FPS | 30     | Variance ≤ 10% |
| Video Output FPS  | 30     | Variance ≤ 10% |
| Avatar Render FPS | 30     | Variance ≤ 10% |
| Display FPS       | 60     | Variance ≤ 10% |

**Frame Drop Detection:**

- Dropped Frame Threshold: 50 ms (frame exceeds expected interval by 50ms)
- Measurement Window: 1.0 second
- Max Frame History: 1,000 frames

### 3.6 Audio Quality Score (MOS Estimation)

**Mean Opinion Score Categories:**

| MOS Score | Quality   | Description                     |
| --------- | --------- | ------------------------------- |
| 4.3 - 5.0 | Excellent | Indistinguishable from original |
| 3.6 - 4.3 | Good      | Perceptible but not annoying    |
| 2.6 - 3.6 | Fair      | Slightly annoying               |
| 1.6 - 2.6 | Poor      | Annoying                        |
| 1.0 - 1.6 | Bad       | Very annoying                   |

**MOS Computation Weights:**

| Factor         | Weight | Excellent Value |
| -------------- | ------ | --------------- |
| Codec Quality  | 15%    | Opus: 4.5       |
| SNR            | 25%    | ≥ 35 dB         |
| Packet Loss    | 25%    | 0%              |
| Jitter         | 15%    | ≤ 20 ms         |
| Bitrate        | 10%    | Sufficient      |
| Speech Clarity | 10%    | High            |

### 3.7 Network Requirements

| Quality         | Min Bandwidth (Up) | Min Bandwidth (Down) | Latency  |
| --------------- | ------------------ | -------------------- | -------- |
| Audio Only      | 64 kbps            | 64 kbps              | < 150 ms |
| SD Video (480p) | 1 Mbps             | 1 Mbps               | < 100 ms |
| HD Video (720p) | 2.5 Mbps           | 2.5 Mbps             | < 80 ms  |
| Full HD (1080p) | 4 Mbps             | 4 Mbps               | < 60 ms  |

---

## 4. GPU Benchmarking Infrastructure

### 4.1 Benchmark Tool Configuration

**Source:** `/scripts/benchmarks/gpu_benchmark.py`

#### Quick Benchmark Preset

```python
warmup_iterations = 10
measured_iterations = 50
matmul_sizes = [1024, 2048]
conv2d_shapes = [(8, 64, 128, 56, 56, 3)]
bandwidth_test_size = 256 MB
```

#### Standard Benchmark Preset

```python
warmup_iterations = 20
measured_iterations = 200
matmul_sizes = [1024, 2048, 4096]
conv2d_shapes = [
    (16, 64, 128, 112, 112, 3),
    (8, 128, 256, 56, 56, 3)
]
bandwidth_test_size = 1024 MB
```

#### Stress Benchmark Preset

```python
warmup_iterations = 30
measured_iterations = 300
matmul_sizes = [2048, 4096, 8192]
conv2d_shapes = [
    (16, 64, 128, 224, 224, 3),
    (8, 128, 256, 112, 112, 3)
]
bandwidth_test_size = 2048 MB
```

### 4.2 Supported Precision Modes

| Mode | Description    | VRAM Usage | Performance              |
| ---- | -------------- | ---------- | ------------------------ |
| FP32 | Full precision | 100%       | Baseline                 |
| FP16 | Half precision | 50%        | 2x faster (Tensor Cores) |
| BF16 | Brain float    | 50%        | 2x faster (better range) |

### 4.3 Benchmark Metrics

- **TFLOPS:** Tera Floating Point Operations Per Second
- **GBPS:** Giga Bytes Per Second (memory bandwidth)
- **Latency:** Average operation time in milliseconds

---

## 5. Monitoring Infrastructure

### 5.1 Prometheus Scrape Configuration

**Source:** `/infrastructure/docker/prometheus/prometheus.yml`

| Service           | Port | Scrape Interval |
| ----------------- | ---- | --------------- |
| API Gateway       | 8000 | 10 seconds      |
| Avatar Engine     | 8001 | 10 seconds      |
| Voice Engine      | 8002 | 10 seconds      |
| Behavior Engine   | 8003 | 10 seconds      |
| Perception Engine | 8004 | 10 seconds      |
| Computer Use      | 8005 | 10 seconds      |
| Conferencing      | 8006 | 10 seconds      |
| Orchestrator      | 8007 | 10 seconds      |
| Knowledge Base    | 8008 | 10 seconds      |
| Persona Service   | 8009 | 10 seconds      |

### 5.2 GPU Metrics Collection

| Source          | Port    | Interval  | Metrics                       |
| --------------- | ------- | --------- | ----------------------------- |
| NVIDIA DCGM     | 9400    | 5 seconds | GPU utilization, memory, temp |
| Triton Server   | 8002    | 5 seconds | Inference latency, throughput |
| Per-Service GPU | Various | 5 seconds | Service-specific GPU usage    |

### 5.3 Infrastructure Metrics

| Service | Port | Interval   |
| ------- | ---- | ---------- |
| Redis   | 6379 | Default    |
| Qdrant  | 6333 | 30 seconds |
| MinIO   | 9000 | 30 seconds |

**Global Settings:**

- Default Scrape Interval: 15 seconds
- Evaluation Interval: 15 seconds

---

## 6. Performance Testing Utilities

### 6.1 Performance Timer Utility

**Source:** `/tests/utils/performance.py`

**Features:**

- Context manager timing
- Function/async decorators
- Memory tracking (tracemalloc)
- Benchmark runner with warmup
- Statistical analysis (mean, std, percentiles)
- Markdown report export

### 6.2 Regression Testing

**Source:** `/scripts/performance/perf_regression.py`

**Configuration:**

- Warmup iterations: 25
- Measured iterations: 100
- Percentiles: P50, P95

**Thresholds:**

- PostgreSQL P95: 50 ms
- Redis P95: 10 ms

---

## 7. Performance Optimization Recommendations

### 7.1 Avatar Engine Optimizations

| Optimization       | Impact              | Implementation         |
| ------------------ | ------------------- | ---------------------- |
| Dynamic Resolution | 20-50% FPS gain     | Enable when FPS drops  |
| LOD Adjustment     | 10-30% VRAM savings | Distance-based culling |
| TAA Disable        | 10-15% FPS gain     | Quality tradeoff       |
| Gaussian Culling   | 20-40% speedup      | Frustum + occlusion    |
| Mixed Precision    | 30-50% speedup      | FP16 on Tensor Cores   |

### 7.2 Voice Pipeline Optimizations

| Optimization        | Impact              | Implementation          |
| ------------------- | ------------------- | ----------------------- |
| Streaming STT       | 100-200ms reduction | Real-time transcription |
| LLM Streaming       | 200-400ms reduction | First token latency     |
| Parallel Processing | 50-100ms reduction  | Concurrent pipelines    |
| Response Caching    | 50-90% reduction    | Common queries          |
| Model Quantization  | 20-40% speedup      | INT8 inference          |

### 7.3 Conferencing Optimizations

| Optimization     | Impact             | Implementation     |
| ---------------- | ------------------ | ------------------ |
| Frame Buffering  | Smoother playback  | 2-3 frame buffer   |
| Adaptive Bitrate | Network resilience | Quality scaling    |
| Jitter Buffer    | Audio quality      | Adaptive sizing    |
| Predictive Sync  | Better A/V sync    | Drift compensation |

---

## 8. Baseline Measurement Procedures

### 8.1 Avatar Rendering Benchmark

```bash
# Run GPU benchmark
cd /home/ubuntu/oshun/serwaa
python scripts/benchmarks/gpu_benchmark.py --preset standard --dtype fp16

# Expected output:
# - MatMul TFLOPS
# - Conv2D TFLOPS
# - Memory Bandwidth GBPS
# - Per-resolution FPS estimates
```

### 8.2 End-to-End Latency Measurement

```bash
# Run latency tests
pytest tests/performance/ -v --benchmark-enable

# Metrics collected:
# - P50, P95, P99 latencies
# - Component breakdown
# - Memory usage
```

### 8.3 A/V Sync Measurement

```bash
# Run sync tests
pytest tests/voice_engine/sync/ -v

# Metrics collected:
# - Sync offset distribution
# - Drift rate
# - Correction effectiveness
```

---

## 9. Performance SLOs (Service Level Objectives)

### 9.1 Availability SLOs

| Service          | Availability | Max Downtime/Month |
| ---------------- | ------------ | ------------------ |
| Avatar Engine    | 99.9%        | 43.8 minutes       |
| Voice Engine     | 99.9%        | 43.8 minutes       |
| API Gateway      | 99.95%       | 21.9 minutes       |
| Overall Platform | 99.5%        | 3.65 hours         |

### 9.2 Latency SLOs

| Metric         | P50    | P95    | P99     |
| -------------- | ------ | ------ | ------- |
| API Response   | 100 ms | 300 ms | 500 ms  |
| Avatar Render  | 33 ms  | 50 ms  | 66 ms   |
| Voice Response | 500 ms | 750 ms | 1000 ms |
| A/V Sync       | 20 ms  | 50 ms  | 100 ms  |

### 9.3 Quality SLOs

| Metric          | Target    | Minimum |
| --------------- | --------- | ------- |
| Avatar SSIM     | 0.90      | 0.85    |
| Audio MOS       | 4.0       | 3.6     |
| Frame Drop Rate | < 1%      | < 5%    |
| Sync Quality    | Excellent | Good    |

---

## 10. Summary Tables

### 10.1 Avatar Performance Summary

| Metric     | LOW      | MEDIUM   | HIGH      | ULTRA       |
| ---------- | -------- | -------- | --------- | ----------- |
| Resolution | 512x512  | 768x768  | 1024x1024 | 1024x1024   |
| Target FPS | 60       | 45       | 30        | Max Quality |
| Est. VRAM  | 2-3 GB   | 3-4 GB   | 4-6 GB    | 6-8 GB      |
| Min GPU    | RTX 3060 | RTX 3070 | RTX 3080  | RTX 4090    |

### 10.2 Latency Budget Summary

| Component     | Budget | Cumulative |
| ------------- | ------ | ---------- |
| Audio Capture | 20 ms  | 20 ms      |
| STT           | 100 ms | 120 ms     |
| NLU           | 40 ms  | 160 ms     |
| LLM           | 200 ms | 360 ms     |
| TTS           | 100 ms | 460 ms     |
| Network       | 40 ms  | 500 ms     |

### 10.3 Quality Thresholds Summary

| Metric   | Minimum | Target | Excellent |
| -------- | ------- | ------ | --------- |
| PSNR     | 25 dB   | 30 dB  | 35+ dB    |
| SSIM     | 0.85    | 0.90   | 0.95+     |
| MOS      | 3.6     | 4.0    | 4.3+      |
| A/V Sync | 100 ms  | 50 ms  | 20 ms     |

---

## Appendix A: Key Configuration Files

| File                                                                  | Purpose                 |
| --------------------------------------------------------------------- | ----------------------- |
| `/services/avatar-engine/src/avatar_engine/config.py`                 | Avatar rendering config |
| `/services/avatar-engine/src/avatar_engine/utils/metrics.py`          | Quality metrics         |
| `/services/voice-engine/src/voice_engine/audio/quality_monitoring.py` | Audio monitoring        |
| `/services/voice-engine/src/voice_engine/sync/measurement.py`         | Sync measurement        |
| `/services/voice-engine/src/voice_engine/sync/compensation.py`        | Sync compensation       |
| `/packages/common/src/common/metrics/performance.py`                  | Latency tracking        |
| `/scripts/benchmarks/gpu_benchmark.py`                                | GPU benchmarking        |
| `/scripts/performance/perf_regression.py`                             | Regression testing      |
| `/tests/utils/performance.py`                                         | Test utilities          |
| `/infrastructure/docker/prometheus/prometheus.yml`                    | Monitoring config       |

---

## Appendix B: Environment Variables

| Variable                           | Default | Description            |
| ---------------------------------- | ------- | ---------------------- |
| `LLM_TIMEOUT_SECONDS`              | 60      | LLM request timeout    |
| `RAG_TIMEOUT_SECONDS`              | 5       | RAG retrieval timeout  |
| `LONG_TERM_MEMORY_TIMEOUT_SECONDS` | 5       | Memory access timeout  |
| `AVATAR_QUALITY`                   | HIGH    | Default quality preset |
| `TARGET_FPS`                       | 30      | Target frame rate      |
| `CUDA_VISIBLE_DEVICES`             | 0       | GPU selection          |

---

## Document Metadata

| Field         | Value                        |
| ------------- | ---------------------------- |
| Created       | January 2026                 |
| Last Updated  | January 2026                 |
| Status        | Complete                     |
| Owner         | Psyche Domain Migration Team |
| Review Cycle  | Monthly                      |
| Related Tasks | 24.1.3.1, 24.1.3.2, 24.1.3.3 |
