Guides Cognitive Ergonomics Training Pipeline - kennetholsenatm-gif/q_mini_wasm_v2 GitHub Wiki
Purpose: This document provides visual and conceptual guidance for understanding the q_mini_wasm_v2 training pipeline. It follows cognitive ergonomics principles to reduce mental load when working with the system.
Think of the training pipeline as a knowledge refinery that transforms raw information into trained expertise:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β KNOWLEDGE REFINERY β
β β
β Raw Knowledge Sources β
β ββββββββββββ ββββββββββββ ββββββββββββ β
β β Wolfram β β PubChem β β OEIS β β External APIs β
β β (Math) β β(Chemistryβ β(Sequencesβ β
β ββββββ¬ββββββ ββββββ¬ββββββ ββββββ¬ββββββ β
β β β β β
β βββββββββββββββ΄ββββββββββββββ β
β β β
// ... (truncated)
// See source for complete code
βββββββββββββββββββ
β Training Loop β
β Batch Complete β
ββββββββββ¬βββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββ
β batch_count % interval == 0 ? β
ββββββββββ¬βββββββββββ¬βββββββββββ
β β
YES β β NO
// ... (truncated)
// See source for complete code
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β STAGE 1: ACQUISITION β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β HTTP Request Response Parser β
β βββββββββββ βββββββββββββββββ β
β β GET api β βββ200 OKββββββΆ β JSON β float β β Error handling β
β β /query β [1.2, 3.4] β vector β β exponential backoff β
β βββββββββββ βββββββββ¬ββββββββ β
β β β
β Rate Limit: 100 req/min βΌ β
// ... (truncated)
// See source for complete code
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β START: Configure Pipeline β
βββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββ
β Need real-time API β
β data? β
βββββββββββββ¬ββββββββββββ
β
βββββββββββββ΄ββββββββββββ
// ... (truncated)
// See source for complete code
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β ERROR LAYERS β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β Layer 4: API Errors (recoverable) β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Rate limit exceeded β Backoff β Retry β β
β β Network timeout β Log β Use synthetic fallback β β
β β Invalid response β Skip batch β Continue β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
// ... (truncated)
// See source for complete code
| Metric | Healthy Range | Action if Outside |
|---|---|---|
ff_goodness_delta |
> 0 | If < 0: Negative samples too similar to positive - adjust corruption rate |
expert_utilization |
0.2-0.8 per expert | If < 0.1: Expert underused - consider topology change |
betti_beta_1 |
5-20 | If > 30: Too many cycles - reduce edges; If < 3: Too sparse - add edges |
routing_quality |
> 0.6 | If < 0.5: Trigger topology reconfiguration |
ds_api_failures |
< 5% | If > 10%: Check API keys and network connectivity |
// When starting with empty queue
PipelineConfig config;
config.enable_knowledge_engine = true; // Enable API calls
config.acquisition_threads = 4; // Fill queue quickly
pipeline.initialize(config);
// Wait for buffer to fill before training
while (pipeline.get_metrics().ds_queue_depth < config.batch_size * 2) {
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
pipeline.start_training();// Check metrics periodically and adjust
auto metrics = pipeline.get_metrics();
if (metrics.betti_beta_1 > 30) {
// Too complex - simplify topology
pipeline.trigger_topology_evaluation();
// This will reduce edges automatically
}// Try to resume from checkpoint
if (pipeline.import_model("checkpoint_epoch_50.bin")) {
std::cout << "Resumed from epoch 50\n";
} else {
std::cout << "Starting fresh\n";
} βββββββββββββββββββββββββββββββββββββββ
β USER CODE / WUI β
β (Controls: start, stop, configure) β
βββββββββββββββββ¬ββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β AUTONOMOUS TRAINING PIPELINE β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
// ... (truncated)
// See source for complete code
| Operation | Code Pattern | Expected Latency |
|---|---|---|
| Initialize pipeline | pipeline.initialize(config) |
100-500ms |
| Get one sample | synthesizer.get_sample() |
10-100ms (blocking) |
| Process batch | pipeline.process_batch() |
50-500ms (depends on k) |
| Betti evaluation | pipeline.trigger_topology_evaluation() |
10-100ms |
| Checkpoint | pipeline.export_model(path) |
100-1000ms |
Document Version: 1.0 | Generated for q_mini_wasm_v2 training pipeline