--- license: cc-by-sa-4.0 tags: - tiny - edge-ai - micro-model - boolean - comparison - RaspizdAI --- # pizdecB3 **pizdecB3** (format: `n.f.c` → name.function.count) is a tiny boolean comparison model. - **n** = pizdec - **f** = B (Boolean) - **c** = 3 (third model in the series) It takes two numbers and predicts one of three relations: - `>` (greater) - `=` (equal) - `<` (less) Also supports string input in the format `x?y`. ## Model Details | Property | Value | |-----------------------|----------------------------------------| | Parameters | ~1731 | | Input | two floats `(a, b)` or string `"a?b"` | | Output | `<`, `=`, or `>` | | Architecture | small MLP (input features: `a, b, a-b`) | | Framework | PyTorch + Safetensors | | License | CC-BY-SA-4.0 | ## Training Dynamics Here is the visualization of the model's training metrics (Loss and Accuracy): ![Training Metrics](training_metrics.png) ## Intended Use - Extremely lightweight number comparison - Edge / constrained environments - Educational / experimental micro-models - Fun baseline for boolean tasks **Not intended for** high-precision scientific computing or production systems that require perfect floating-point equality handling. ## Example inference script ```python import torch import torch.nn as nn from safetensors.torch import load_file from pathlib import Path class PizdecB3(nn.Module): def __init__(self): super().__init__() self.net = nn.Sequential( nn.Linear(3, 32), nn.ReLU(), nn.Linear(32, 32), nn.ReLU(), nn.Linear(32, 16), nn.ReLU(), nn.Linear(16, 3) ) def forward(self, x): return self.net(x) def _prepare(self, a, b): a = torch.tensor([[float(a)]], dtype=torch.float32) b = torch.tensor([[float(b)]], dtype=torch.float32) return torch.cat([a, b, a - b], dim=1) def predict(self, a, b) -> str: with torch.no_grad(): x = self._prepare(a, b) logits = self.forward(x) pred = torch.argmax(logits, dim=-1).item() return ["<", "=", ">"][pred] def predict_str(self, s: str) -> str: try: left, right = s.strip().split("?") return self.predict(left, right) except: return "format error" @classmethod def from_pretrained(cls, path="pizdecB3"): model = cls() state = load_file(Path(path) / "model.safetensors") model.load_state_dict(state) model.eval() return model # Load model = PizdecB3.from_pretrained("pizdecB3") # Usage print(model.predict(10, 5)) # > print(model.predict(3, 3)) # = print(model.predict_str("8?2")) # > ``` ## Known Limitations * Struggles with very close floating-point numbers (e.g. `100` vs `99.9`, `7.0` vs `7.01`) * Exact equality on large floats can be unstable * No support for non-numeric input * Not suitable for high-precision comparison tasks * Performance degrades when numbers differ by less than ~0.01–0.05 depending on magnitude ## Files * `model.safetensors` — model weights * `config.json` — basic config * `training_metrics.png` — training visualization --- Part of the experimental **RaspizdAI** micro-model collection.