PhiForecasterGPU takes a 50-timestep window of 36 welfare signal features and predicts the next 10 timesteps for both the aggregate Phi score and all 8 individual constructs.
Input (50 × 36)
↓
CNN1D (2 conv layers, kernel=3, hidden=256)
↓
Stacked LSTM (2 layers, hidden=256)
↓
Additive Attention (query-key-value)
↓
┌───────────────┬────────────────────┐
│ Phi Head │ Construct Head │
│ (MLP → 10) │ (MLP → 10 × 8) │
└───────────────┴────────────────────┘
Phi is a rigorous ethical-affective objective function grounded in care ethics (hooks 2000), capability theory (Sen 1999), and Ubuntu philosophy:
1 import torch
2 from huggingface_hub import hf_hub_download
3
4 # Download checkpoint
5 path = hf_hub_download ( "crichalchemist/phi-forecaster" , "phi_forecaster_best.pt" )
6
7 # Load model (see spaces/maninagarden/model.py for class definitions)
8 from model import PhiForecasterGPU
9 model = PhiForecasterGPU ( input_size = 36 , hidden_size = 256 , n_layers = 2 , pred_len = 10 )
10 model . load_state_dict ( torch . load ( path , map_location = "cpu" , weights_only = True ) )
11 model . eval ( )
12
13 # Inference: (batch, seq_len=50, features=36) -> phi, constructs, attention
14 X = torch . randn ( 1 , 50 , 36 )
15 phi_pred , construct_pred , attn = model ( X )
16 # phi_pred: (1, 10, 1) — next 10 Phi values
17 # construct_pred: (1, 10, 8) — next 10 values for each construct
18 # attn: (1, 50) — attention weights over input window
Try it at
crichalchemist/maninagarden — interactive scenario explorer, custom forecasting, and experiment comparison.
This model implements the Phi(humanity) welfare function formalized in the detective-llm project. Key theoretical foundations: