plato-ai 0.1.0.dev0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. plato/__init__.py +1 -0
  2. plato/bench/__init__.py +1 -0
  3. plato/bench/csvio.py +120 -0
  4. plato/bench/fit_spike.py +1138 -0
  5. plato/bench/fit_spike_test.py +310 -0
  6. plato/bench/hidden_size_guard.py +142 -0
  7. plato/bench/hidden_size_guard_test.py +75 -0
  8. plato/bench/offload.py +132 -0
  9. plato/bench/results/.gitkeep +1 -0
  10. plato/bench/results/decode_sweep.csv +13 -0
  11. plato/bench/results/fit.csv +3 -0
  12. plato/bench/results/hidden_size_guard.json +7 -0
  13. plato/bench/results/microbench.csv +2 -0
  14. plato/bench/results/prefill.csv +2 -0
  15. plato/bench/results/section_8_1.md +55 -0
  16. plato/bench/results/verbalise_decode_remeasure.csv +101 -0
  17. plato/bench/throughput.py +900 -0
  18. plato/bench/throughput_test.py +297 -0
  19. plato/data/__init__.py +1 -0
  20. plato/data/episodes.py +839 -0
  21. plato/data/episodes_test.py +165 -0
  22. plato/data/fixtures/c2_golden/MANIFEST.json +26 -0
  23. plato/data/fixtures/c2_golden/README.md +8 -0
  24. plato/data/fixtures/c2_golden/a5369b2d057d4a4fb0553bfb28975ef097bb792c7eb7fa3f376edeaee21e01a5.jsonl +100 -0
  25. plato/data/fixtures/c2_golden/episodes.jsonl +100 -0
  26. plato/data/pipeline.py +473 -0
  27. plato/data/pipeline_test.py +204 -0
  28. plato/data/renderers.py +121 -0
  29. plato/data/renderers_test.py +267 -0
  30. plato/data/synthetic/__init__.py +1 -0
  31. plato/data/synthetic/__main__.py +5 -0
  32. plato/data/synthetic/c0.py +992 -0
  33. plato/data/synthetic/c0_test.py +381 -0
  34. plato/data/synthetic/c2.py +1452 -0
  35. plato/data/synthetic/c2_test.py +392 -0
  36. plato/data/synthetic/cli.py +309 -0
  37. plato/data/synthetic/cli_test.py +111 -0
  38. plato/data/synthetic/credential.schema.json +39 -0
  39. plato/data/synthetic/hygiene.py +211 -0
  40. plato/data/synthetic/judge.py +352 -0
  41. plato/data/synthetic/providers.py +567 -0
  42. plato/data/synthetic/providers_test.py +350 -0
  43. plato/data/synthetic/realise.py +1867 -0
  44. plato/data/synthetic/realise_test.py +1345 -0
  45. plato/data/synthetic/repeat_copy.py +231 -0
  46. plato/data/synthetic/repeat_copy_test.py +43 -0
  47. plato/data/synthetic/veto.py +230 -0
  48. plato/data/synthetic/veto_test.py +192 -0
  49. plato/eval/__init__.py +1 -0
  50. plato/eval/ablations.py +478 -0
  51. plato/eval/ablations_test.py +485 -0
  52. plato/eval/budget.py +360 -0
  53. plato/eval/budget_test.py +167 -0
  54. plato/eval/stats.py +1688 -0
  55. plato/eval/stats_test.py +937 -0
  56. plato/memory/__init__.py +1 -0
  57. plato/memory/access.py +680 -0
  58. plato/memory/access_test.py +724 -0
  59. plato/memory/addressing.py +421 -0
  60. plato/memory/addressing_test.py +658 -0
  61. plato/memory/boundary_test.py +127 -0
  62. plato/memory/config.py +94 -0
  63. plato/memory/design_test.py +724 -0
  64. plato/memory/errors.py +17 -0
  65. plato/memory/golden_test.py +555 -0
  66. plato/memory/ops.py +214 -0
  67. plato/memory/ops_test.py +98 -0
  68. plato/memory/parity_adapters.py +193 -0
  69. plato/memory/parity_adapters_test.py +122 -0
  70. plato/memory/property_test.py +570 -0
  71. plato/memory/state.py +406 -0
  72. plato/memory/state_test.py +205 -0
  73. plato/model/__init__.py +1 -0
  74. plato/model/bare_load.py +77 -0
  75. plato/model/bare_load_test.py +26 -0
  76. plato/model/encoder.py +446 -0
  77. plato/model/encoder_test.py +178 -0
  78. plato/model/episodes.py +194 -0
  79. plato/model/episodes_test.py +81 -0
  80. plato/model/fakes.py +232 -0
  81. plato/model/fixtures/__init__.py +1 -0
  82. plato/model/fixtures/etime_features.npz +0 -0
  83. plato/model/fixtures/etime_proj_2048.npz +0 -0
  84. plato/model/fixtures/etime_proj_4096.npz +0 -0
  85. plato/model/fixtures/make_fixtures.py +126 -0
  86. plato/model/gate.py +264 -0
  87. plato/model/gate_test.py +213 -0
  88. plato/model/heads.py +374 -0
  89. plato/model/heads_test.py +233 -0
  90. plato/model/hf.py +572 -0
  91. plato/model/lora.py +240 -0
  92. plato/model/lora_test.py +100 -0
  93. plato/model/lr.py +59 -0
  94. plato/model/lr_test.py +58 -0
  95. plato/model/pins.py +12 -0
  96. plato/model/pins_test.py +42 -0
  97. plato/model/reader.py +245 -0
  98. plato/model/reader_test.py +134 -0
  99. plato/model/registry.py +145 -0
  100. plato/model/registry_test.py +94 -0
  101. plato/model/rosters/__init__.py +1 -0
  102. plato/model/rosters/dump.py +29 -0
  103. plato/model/rosters/qwen3_5_0_8b.txt +186 -0
  104. plato/model/rosters/qwen3_5_2b.txt +186 -0
  105. plato/model/smoke.py +944 -0
  106. plato/model/smoke_mutant_results.json +13713 -0
  107. plato/model/smoke_results.json +13523 -0
  108. plato/model/smoke_test.py +321 -0
  109. plato/obs/__init__.py +1 -0
  110. plato/obs/viewer.py +1242 -0
  111. plato/obs/viewer_test.py +409 -0
  112. plato/package_metadata_test.py +46 -0
  113. plato/testing/__init__.py +1 -0
  114. plato/testing/data_mutants.py +379 -0
  115. plato/testing/eval_mutants.py +200 -0
  116. plato/testing/memory_mutants.py +387 -0
  117. plato/testing/model_mutants.py +80 -0
  118. plato/testing/mutants.py +110 -0
  119. plato/testing/mutants_meta_test.py +231 -0
  120. plato/testing/obs_mutants.py +32 -0
  121. plato/train/__init__.py +1 -0
  122. plato/train/curriculum.py +34 -0
  123. plato/train/curriculum_test.py +14 -0
  124. plato_ai-0.1.0.dev0.dist-info/METADATA +255 -0
  125. plato_ai-0.1.0.dev0.dist-info/RECORD +129 -0
  126. plato_ai-0.1.0.dev0.dist-info/WHEEL +4 -0
  127. plato_ai-0.1.0.dev0.dist-info/entry_points.txt +2 -0
  128. plato_ai-0.1.0.dev0.dist-info/licenses/LICENSE +203 -0
  129. plato_ai-0.1.0.dev0.dist-info/licenses/NOTICE +11 -0
plato/__init__.py ADDED
@@ -0,0 +1 @@
1
+ """plato: a controller-operated DNC memory that any LLM can use."""
@@ -0,0 +1 @@
1
+ """Fit-check and controller-plane throughput benchmarks."""
plato/bench/csvio.py ADDED
@@ -0,0 +1,120 @@
1
+ """Idempotent CSV helpers for S7 bench outputs.
2
+
3
+ A cell is skipped when a row with the same key columns already exists
4
+ (M0 §9 Spot mitigation: each bench run ≤ 30 min and idempotent).
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ import csv
10
+ from collections.abc import Mapping, Sequence
11
+ from pathlib import Path
12
+ from typing import cast
13
+
14
+
15
+ def cell(value: object) -> str:
16
+ """Render a CSV cell. Bools are ``true``/``false`` (not ``1``/``0``).
17
+
18
+ ``None`` is an empty field (OOM / incomplete-step metrics). The markdown
19
+ writer prints ``—`` for empty numeric cells.
20
+ """
21
+
22
+ if value is None:
23
+ return ""
24
+ if isinstance(value, bool):
25
+ return "true" if value else "false"
26
+ if isinstance(value, float):
27
+ return f"{value:.8g}"
28
+ return str(value)
29
+
30
+
31
+ def csv_rows(path: Path) -> list[dict[str, str]]:
32
+ if not path.is_file():
33
+ return []
34
+ with path.open(newline="", encoding="utf-8") as handle:
35
+ reader = csv.DictReader(handle)
36
+ rows: list[dict[str, str]] = []
37
+ for raw in reader:
38
+ typed = cast(dict[object, object], raw)
39
+ row: dict[str, str] = {}
40
+ for key, value in typed.items():
41
+ if not isinstance(key, str):
42
+ continue
43
+ row[key] = "" if value is None else str(value)
44
+ rows.append(row)
45
+ return rows
46
+
47
+
48
+ def csv_has_row(path: Path, key: Mapping[str, str]) -> bool:
49
+ """True iff some existing row matches every ``key`` column exactly."""
50
+
51
+ for row in csv_rows(path):
52
+ if all(row.get(name) == value for name, value in key.items()):
53
+ return True
54
+ return False
55
+
56
+
57
+ def csv_append(
58
+ path: Path,
59
+ fieldnames: Sequence[str],
60
+ row: Mapping[str, object],
61
+ ) -> None:
62
+ """Append ``row`` (creating the file + header if needed)."""
63
+
64
+ path.parent.mkdir(parents=True, exist_ok=True)
65
+ new_file = not path.is_file() or path.stat().st_size == 0
66
+ with path.open("a", newline="", encoding="utf-8") as handle:
67
+ writer = csv.DictWriter(handle, fieldnames=list(fieldnames), extrasaction="ignore")
68
+ if new_file:
69
+ writer.writeheader()
70
+ rendered: dict[str, str] = {name: cell(row.get(name, "")) for name in fieldnames}
71
+ writer.writerow(rendered)
72
+
73
+
74
+ def csv_upsert(
75
+ path: Path,
76
+ fieldnames: Sequence[str],
77
+ row: Mapping[str, object],
78
+ key: Mapping[str, str],
79
+ ) -> None:
80
+ """Replace the row matching ``key``, or append if none exists.
81
+
82
+ Read-modify-write of the whole file. Extra rows with the same key are
83
+ dropped so a prior append-on-OOM cannot leave duplicates.
84
+ """
85
+
86
+ path.parent.mkdir(parents=True, exist_ok=True)
87
+ rendered: dict[str, str] = {name: cell(row.get(name, "")) for name in fieldnames}
88
+ written: list[dict[str, str]] = []
89
+ replaced = False
90
+ for old in csv_rows(path):
91
+ if all(old.get(name) == value for name, value in key.items()):
92
+ if not replaced:
93
+ written.append(rendered)
94
+ replaced = True
95
+ continue
96
+ written.append({name: old.get(name, "") for name in fieldnames})
97
+ if not replaced:
98
+ written.append(rendered)
99
+ with path.open("w", newline="", encoding="utf-8") as handle:
100
+ writer = csv.DictWriter(handle, fieldnames=list(fieldnames), extrasaction="ignore")
101
+ writer.writeheader()
102
+ for item in written:
103
+ writer.writerow(item)
104
+
105
+
106
+ def lookup_row(path: Path, key: Mapping[str, str]) -> dict[str, str] | None:
107
+ for row in csv_rows(path):
108
+ if all(row.get(name) == value for name, value in key.items()):
109
+ return row
110
+ return None
111
+
112
+
113
+ def parse_float(row: Mapping[str, str], name: str) -> float | None:
114
+ raw = row.get(name)
115
+ if raw is None or raw == "":
116
+ return None
117
+ try:
118
+ return float(raw)
119
+ except ValueError:
120
+ return None