Agent file
The mlp_npz format — what has to be in the .npz and what the server runs on it.
An agent for nlhe-hu-v2 is a single .npz file: a multilayer perceptron saved with numpy.savez. The format is
called mlp_npz.
What the file contains
| key | content |
|---|---|
W0..W{n-1}, b0..b{n-1} | float32 or float64. W_i has shape (out, in). Layer i computes W_i @ x + b_i. |
n_layers | integer scalar, 1..16 |
obs_mean | float vector of length 180 |
obs_std | float vector of length 180, strictly positive everywhere |
obs_clip | positive float scalar |
activation | "elu", "relu" or "tanh" |
Optional keys spec_json and meta_json are accepted and ignored. No other keys are allowed. No object arrays,
all values finite.
What the server runs
Every decision, in order:
x = clip( (obs - obs_mean) / obs_std, -obs_clip, +obs_clip )
for i in 0..n_layers - 1:
x = W_i @ x + b_i
if i < n_layers - 1:
x = activation(x)
return x # shape (6,), raw logits
That's it. The last layer has 6 outputs and no activation — raw logits go straight to the server's masking and softmax.
Limits
- At most 1,000,000 parameters total (sum of all
W_iandb_ientries). - At most 16 MiB on disk.
- At most 16 layers, each at most 4,096 wide.
- All values finite (no NaN, no inf).
Over any of these and the file is rejected at upload.
Writing the file
Two helpers in the kit, same guarantees:
- NumPy:
proxypoker.agent_file.save(...) - PyTorch:
examples/export_npz.export(...)
Both:
- Re-load the written file with the server's own loader before returning, so you can't ship something the server would reject.
- Do a round-trip check:
export()also confirms the exported MLP produces the same outputs as the torch model.
obs_std with zeros
If some observation inputs never vary in your training data, std will be 0 for them — and the server rejects a
file with any zero in obs_std (because it would divide by zero).
Use proxypoker.agent_file.safe_std, which replaces zeros with 1. The corresponding obs_mean will subtract to 0
and the input will go in at value 0 — exactly what you'd want for a constant feature.
Normalization lives in the file
Don't normalize observations outside the file. The server passes raw observations to your weights; the only
normalization applied is the obs_mean/obs_std/obs_clip triple stored in the file. If you normalize in your
training loop and ship a file with obs_mean = 0, obs_std = 1, your deployed agent will see very different
numbers than it was trained on.
What's not allowed
- Code inside the file. There's no eval, no pickle, no custom classes — it's parsed by numpy as data.
- A softmax or activation after the last layer baked into the weights. The server expects raw logits.
- Illegal-button masking inside the weights. The server does this.
- Lookup tables. The parameter limit (1M) is tight for a reason; stuffing tables into bias terms doesn't scale.
- Files that write outside the format. Extra keys other than
spec_json/meta_jsonreject the upload.