1// New: Local ML model (free, <5ms latency)2const response =awaitfetch('http://localhost:7860/predict/estimate',{3method:'POST',4headers:{'Content-Type':'application/json'},5body:JSON.stringify({6block_type: block.type,7tech_node: block.techNode,8priority: block.priority,9transistor_count: block.transistorCount,10has_dependencies: block.dependencies?.length >0,11num_dependencies: block.dependencies?.length ||0,12constraint_complexity: block.constraintComplexity||1.0,13drc_iterations: block.drcIterations||214})15});16const estimate =await response.json();
Add Bottleneck Scanning to Cron Job
javascript
1// In server/cron/bottleneckScanner.js2const blocks =awaitBlock.find({status:{$ne:'Completed'}});34for(const block of blocks){5const risk =awaitfetch('http://localhost:7860/predict/bottleneck',{6method:'POST',7headers:{'Content-Type':'application/json'},8body:JSON.stringify({9block_type: block.type,10tech_node: block.techNode,11estimated_hours: block.estimatedHours,12hours_logged: block.hoursLogged,13current_stage: block.status,14days_in_current_stage:daysSinceLastTransition(block),15drc_violations_total: block.drcViolations,16is_overdue:newDate()> block.dueDate17})18});19const result =await risk.json();2021if(result.should_alert){22// Create notification for manager23awaitNotification.create({24type:'stuck',25message:`ML Alert: ${block.name} has HIGH bottleneck risk`,26recommendations: result.recommendations27});28 io.emit('newNotification',{blockId: block._id,risk: result });29}30}
Add Completion ETA to Block Detail
javascript
1// In GET /api/blocks/:id2const completion =awaitfetch('http://localhost:7860/predict/completion',{3method:'POST',4headers:{'Content-Type':'application/json'},5body:JSON.stringify({6block_type: block.type,7tech_node: block.techNode,8estimated_hours: block.estimatedHours,9current_stage: block.status,10cumulative_hours: block.hoursLogged,11cumulative_days:daysSinceStart(block),12cumulative_drc_violations: block.drcViolations13})14});15const eta =await completion.json();16// eta.remaining_hours, eta.estimated_completion_date, eta.progress_percent
tech_node_encoded (6.8%) — Advanced nodes are harder
constraint_complexity (2.7%) — Analog constraints add overhead
Completion Prediction — Top Features
current_stage_idx (44.9%) — Current stage is the strongest signal
stages_completed (22.3%) — Progress through pipeline
avg_hours_per_stage_so_far (21.0%) — Pace of work predicts future
🔧 Retraining
bash
1# Generate new training data from ALWAS MongoDB exports2python training/generate_dataset.py
34# Train all models5python training/train_models.py
6python training/train_completion.py
Recommended retraining schedule: Monthly, or when >100 new completed blocks accumulate.
📦 Files
models/
hours_estimator.joblib # XGBoost regressor
complexity_xgb.joblib # XGBoost classifier (ensemble member)
complexity_lgb.joblib # LightGBM classifier (ensemble member)
bottleneck_predictor.joblib # Calibrated XGBoost classifier
completion_predictor.joblib # XGBoost regressor for remaining time
tech_node_encoder.joblib # LabelEncoder
block_type_encoder.joblib # LabelEncoder
priority_encoder.joblib # OrdinalEncoder
complexity_encoder.joblib # LabelEncoder
bottleneck_encoder.joblib # LabelEncoder
feature_config.json # Feature lists and supported values
metrics.json # Model evaluation metrics
inference_server.py # FastAPI inference server
training/
generate_dataset.py # Synthetic data generator
train_models.py # Model training (Models 1-3)
train_completion.py # Completion model training (Model 4)
📐 Performance vs Groq API
Metric
Groq llama-3.3-70b
ALWAS ML Models
Latency
~300ms
<5ms
Cost per request
$0.002
Free
Internet required
Yes
No
Structured output
Sometimes
Always (JSON guaranteed)
Batch support
Limited
200 blocks/call
Bottleneck detection
No
Yes (real-time)
Completion prediction
No
Yes (R²=0.945)
Explainability
LLM narrative
Feature importance + reasoning
License
MIT — Built for EPIC Build-A-Thon 2026 | Epical Layouts Pvt. Ltd.