v4 flagship Space (3 tiers) from registry v2 (earlier contents: 906bc45ae05c)
Browse files- README.md +5 -5
- geomgnn/access.py +10 -10
- geomgnn/api.py +11 -10
- geomgnn/app_flagship.py +64 -68
- geomgnn/ground_ui.py +7 -7
- geomgnn/ui.py +27 -17
- registry.yaml +11 -7
README.md
CHANGED
|
@@ -27,17 +27,17 @@ The model of our paper *A physics-corrected graph neural network for the capacit
|
|
| 27 |
|
| 28 |
1. Try a bundled example, or sign in with Hugging Face and upload your own GDS file.
|
| 29 |
2. Pick the ground layer and the conductor layer (1/0 and 1/10 by default). If both are on one layer, the Space finds the ground and shows its pick on a numbered image for you to confirm.
|
| 30 |
-
3. Choose a
|
| 31 |
|
| 32 |
-
##
|
| 33 |
|
| 34 |
-
|
|
| 35 |
|---|---|---|---|
|
| 36 |
| Accurate (default) | the extrapolated prior from two coarse method-of-moments solves, corrected by the networks | 1.05 (0.132 / 0.188) | 1.1 s |
|
| 37 |
| Balanced | the same recipe on two coarser solves | 2.044 (0.258 / 0.348) | 0.56 s |
|
| 38 |
| Fast | a learned prior replaces the solves, then the networks correct it | 3.175 (0.583 / 0.824) | 0.24 s |
|
| 39 |
|
| 40 |
-
The 39 layouts are generated rings with a neighbour (3 or 4 conductors) that no part of any
|
| 41 |
|
| 42 |
Fast is for quick screening of the component families it was trained on. Use Accurate otherwise.
|
| 43 |
|
|
@@ -63,4 +63,4 @@ The examples run without sign-in. Sign in with Hugging Face to run your own layo
|
|
| 63 |
|
| 64 |
## Privacy
|
| 65 |
|
| 66 |
-
Uploaded layouts are processed in memory and held there only while the Space runs, to answer repeat requests. Nothing is written to permanent storage, and no file names or geometry are logged or kept. To enforce the daily limit, your Hugging Face username and your network address are turned into keyed hashes, held in memory and cleared at the end of the UTC day. They are never stored or logged. We keep only daily totals (runs per
|
|
|
|
| 27 |
|
| 28 |
1. Try a bundled example, or sign in with Hugging Face and upload your own GDS file.
|
| 29 |
2. Pick the ground layer and the conductor layer (1/0 and 1/10 by default). If both are on one layer, the Space finds the ground and shows its pick on a numbered image for you to confirm.
|
| 30 |
+
3. Choose a model and a substrate, and press Predict. You get the matrix in fF, self terms included.
|
| 31 |
|
| 32 |
+
## Models
|
| 33 |
|
| 34 |
+
| model | how it works | error on 39 new layouts, % (MAE / RMSE, fF) | median time |
|
| 35 |
|---|---|---|---|
|
| 36 |
| Accurate (default) | the extrapolated prior from two coarse method-of-moments solves, corrected by the networks | 1.05 (0.132 / 0.188) | 1.1 s |
|
| 37 |
| Balanced | the same recipe on two coarser solves | 2.044 (0.258 / 0.348) | 0.56 s |
|
| 38 |
| Fast | a learned prior replaces the solves, then the networks correct it | 3.175 (0.583 / 0.824) | 0.24 s |
|
| 39 |
|
| 40 |
+
The 39 layouts are generated rings with a neighbour (3 or 4 conductors) that no part of any model saw in training. On them the extrapolated prior alone scores 1.765 % (MAE 0.275 / RMSE 0.376 fF). Times are on two CPUs of an Intel Xeon E5-2640 v4 cluster node.
|
| 41 |
|
| 42 |
Fast is for quick screening of the component families it was trained on. Use Accurate otherwise.
|
| 43 |
|
|
|
|
| 63 |
|
| 64 |
## Privacy
|
| 65 |
|
| 66 |
+
Uploaded layouts are processed in memory and held there only while the Space runs, to answer repeat requests. Nothing is written to permanent storage, and no file names or geometry are logged or kept. To enforce the daily limit, your Hugging Face username and your network address are turned into keyed hashes, held in memory and cleared at the end of the UTC day. They are never stored or logged. We keep only daily totals (runs per model and per layout size, refusals by reason, errors, response times and the number of distinct users that day) to understand how the demo is used. Hugging Face keeps ordinary web access logs under its own policy.
|
geomgnn/access.py
CHANGED
|
@@ -38,12 +38,12 @@ class LimitReached(LayoutError):
|
|
| 38 |
|
| 39 |
def __init__(self, reason: str, text: str):
|
| 40 |
self.reason, self.text, self.head = reason, text, HEADS[reason]
|
| 41 |
-
super().__init__(f"{text}
|
| 42 |
|
| 43 |
@property
|
| 44 |
def limit_html(self) -> str:
|
| 45 |
-
return (f"{html.escape(self.text)} <a href='{LOCAL_GUIDE}' target='_blank' rel='noopener'>Run
|
| 46 |
-
"
|
| 47 |
|
| 48 |
|
| 49 |
@dataclass
|
|
@@ -115,8 +115,8 @@ def check_file(path, w: Who) -> bool:
|
|
| 115 |
"""True when the file is the user's own layout (not a bundled example); anonymous served calls get examples only."""
|
| 116 |
own = not is_example(path)
|
| 117 |
if w.served and own and w.user is None:
|
| 118 |
-
raise LimitReached("auth", "
|
| 119 |
-
"without sign-in.")
|
| 120 |
return own
|
| 121 |
|
| 122 |
|
|
@@ -142,12 +142,12 @@ class Quota:
|
|
| 142 |
with self.lock:
|
| 143 |
self._roll()
|
| 144 |
if own and self.users.get(w.user, 0) >= DAILY:
|
| 145 |
-
raise LimitReached("quota", f"You have used
|
| 146 |
-
f"00:00 UTC
|
| 147 |
-
"do not count.")
|
| 148 |
if self.ips.get(w.ip, 0) >= IP_DAILY:
|
| 149 |
-
raise LimitReached("ip", f"
|
| 150 |
-
f"UTC
|
| 151 |
|
| 152 |
def charge(self, w: Who, own: bool) -> None:
|
| 153 |
if not w.served:
|
|
|
|
| 38 |
|
| 39 |
def __init__(self, reason: str, text: str):
|
| 40 |
self.reason, self.text, self.head = reason, text, HEADS[reason]
|
| 41 |
+
super().__init__(f"{text} On your own computer there are no limits: {LOCAL_GUIDE}")
|
| 42 |
|
| 43 |
@property
|
| 44 |
def limit_html(self) -> str:
|
| 45 |
+
return (f"{html.escape(self.text)} <a href='{LOCAL_GUIDE}' target='_blank' rel='noopener'>Run the models on your own "
|
| 46 |
+
"computer</a> to avoid these limits.")
|
| 47 |
|
| 48 |
|
| 49 |
@dataclass
|
|
|
|
| 115 |
"""True when the file is the user's own layout (not a bundled example); anonymous served calls get examples only."""
|
| 116 |
own = not is_example(path)
|
| 117 |
if w.served and own and w.user is None:
|
| 118 |
+
raise LimitReached("auth", "To run your own layout, sign in with Hugging Face using the button at the top. The examples "
|
| 119 |
+
"run without sign-in.")
|
| 120 |
return own
|
| 121 |
|
| 122 |
|
|
|
|
| 142 |
with self.lock:
|
| 143 |
self._roll()
|
| 144 |
if own and self.users.get(w.user, 0) >= DAILY:
|
| 145 |
+
raise LimitReached("quota", f"You have used all {DAILY} of today's predictions for your own layouts. The count "
|
| 146 |
+
f"resets at 00:00 UTC, in {_reset_in()}. The examples, and repeats of a result you "
|
| 147 |
+
"already have, do not count.")
|
| 148 |
if self.ips.get(w.ip, 0) >= IP_DAILY:
|
| 149 |
+
raise LimitReached("ip", f"Your network has made {IP_DAILY} predictions today, the most we allow. The count "
|
| 150 |
+
f"resets at 00:00 UTC, in {_reset_in()}.")
|
| 151 |
|
| 152 |
def charge(self, w: Who, own: bool) -> None:
|
| 153 |
if not w.served:
|
geomgnn/api.py
CHANGED
|
@@ -49,13 +49,14 @@ CALIBRATED_CAVEAT = (
|
|
| 49 |
"0.111 fF) on the training stack; self terms 0.96-1.22 % (MAE 0.48-0.79, RMSE 0.52-0.86 fF) at 10-50 um Si and 0.89 % "
|
| 50 |
"(0.92 / 1.07 fF) at 1000 um, against 0.24 % (0.18 / 0.22 fF)")
|
| 51 |
TESTED_RANGE = "Si at 10-1000 µm, or eps_r 3.8-24 at 350 µm"
|
| 52 |
-
CALIBRATED_SCORE = ("On 15 held-out designs the mutual entries were 0.21-1.02 % (MAE 0.07-0.33 fF, RMSE 0.09-0.45 fF), against
|
| 53 |
-
"(MAE 0.080 fF, RMSE 0.111 fF) on the training stack
|
|
|
|
| 54 |
FAST_ROUTE = "fast: eps-rescaled training-stack prediction; thickness not modelled"
|
| 55 |
-
FAST_WARNING = ("Fast does not solve the prior at your stack
|
| 56 |
-
"ignores thickness.
|
| 57 |
-
"
|
| 58 |
-
"(0.13 / 0.18 fF) on the same solves
|
| 59 |
|
| 60 |
|
| 61 |
def on_training_stack(eps_r: float, thickness_um: float) -> bool:
|
|
@@ -101,14 +102,14 @@ def substrate_route(eps_r: float, thickness_um: float, solves_prior: bool = True
|
|
| 101 |
def substrate_line(res: dict) -> str:
|
| 102 |
"""One Markdown line of a result's substrate route for the Space reports."""
|
| 103 |
sub = res.get("substrate_route") or {}
|
| 104 |
-
head = f"
|
| 105 |
r = sub.get("route", "training stack")
|
| 106 |
if r == "training stack":
|
| 107 |
return head + "the training stack"
|
| 108 |
if r == FAST_ROUTE:
|
| 109 |
return head + f"eps-rescaled training-stack prediction (factor (1+eps_r)/(1+11.45) = {sub['eps_rescale_factor']:.4f}), thickness not modelled"
|
| 110 |
return head + "physics prior solved at your stack, networks and embedding at the training stack (calibrated route" + (
|
| 111 |
-
"" if sub.get("tested") else "
|
| 112 |
|
| 113 |
PRIOR_IMPLS = ("frozen", "cpu_fast")
|
| 114 |
_HMAT0 = dict(proxy.HMAT)
|
|
@@ -481,8 +482,8 @@ def physical_warning(chk: dict, C: np.ndarray) -> str | None:
|
|
| 481 |
bad.append(f"the signal block is not positive definite (smallest eigenvalue {chk['signal_block_min_eig']:.4g} fF)")
|
| 482 |
if not bad:
|
| 483 |
return None
|
| 484 |
-
return ("physical check failed: " + "
|
| 485 |
-
"
|
| 486 |
|
| 487 |
|
| 488 |
def predict_gnn(prepared, name: str, reg, substrate="Si (cryogenic, training)", thickness_um: float = 350.0, model_dir=None,
|
|
|
|
| 49 |
"0.111 fF) on the training stack; self terms 0.96-1.22 % (MAE 0.48-0.79, RMSE 0.52-0.86 fF) at 10-50 um Si and 0.89 % "
|
| 50 |
"(0.92 / 1.07 fF) at 1000 um, against 0.24 % (0.18 / 0.22 fF)")
|
| 51 |
TESTED_RANGE = "Si at 10-1000 µm, or eps_r 3.8-24 at 350 µm"
|
| 52 |
+
CALIBRATED_SCORE = ("On 15 held-out designs the mutual entries were within 0.21-1.02 % (MAE 0.07-0.33 fF, RMSE 0.09-0.45 fF), against "
|
| 53 |
+
"0.23 % (MAE 0.080 fF, RMSE 0.111 fF) on the training stack. The self terms were within 1.22 % (MAE up to 0.92 fF, "
|
| 54 |
+
"RMSE up to 1.07 fF).")
|
| 55 |
FAST_ROUTE = "fast: eps-rescaled training-stack prediction; thickness not modelled"
|
| 56 |
+
FAST_WARNING = ("Fast does not solve the prior at your stack. It rescales its 350 µm silicon answer by (1 + eps_r) / (1 + 11.45) and "
|
| 57 |
+
"ignores thickness. Off the stack we measured a median error of 6.4 % (MAE 1.7 fF, RMSE 2.4 fF), and 13 % (3.4 / 4.7 fF) "
|
| 58 |
+
"across Si thicknesses of 10-1000 µm. Use the Accurate model for other substrates. It solves the prior at your eps_r and "
|
| 59 |
+
"thickness and gets 0.48 % (0.13 / 0.18 fF) on the same solves.")
|
| 60 |
|
| 61 |
|
| 62 |
def on_training_stack(eps_r: float, thickness_um: float) -> bool:
|
|
|
|
| 102 |
def substrate_line(res: dict) -> str:
|
| 103 |
"""One Markdown line of a result's substrate route for the Space reports."""
|
| 104 |
sub = res.get("substrate_route") or {}
|
| 105 |
+
head = f"Substrate: {res.get('substrate')} (eps_r {res['eps_r']:g}), {res['thickness_um']:g} µm, "
|
| 106 |
r = sub.get("route", "training stack")
|
| 107 |
if r == "training stack":
|
| 108 |
return head + "the training stack"
|
| 109 |
if r == FAST_ROUTE:
|
| 110 |
return head + f"eps-rescaled training-stack prediction (factor (1+eps_r)/(1+11.45) = {sub['eps_rescale_factor']:.4f}), thickness not modelled"
|
| 111 |
return head + "physics prior solved at your stack, networks and embedding at the training stack (calibrated route" + (
|
| 112 |
+
"" if sub.get("tested") else ", untested combination") + ")"
|
| 113 |
|
| 114 |
PRIOR_IMPLS = ("frozen", "cpu_fast")
|
| 115 |
_HMAT0 = dict(proxy.HMAT)
|
|
|
|
| 482 |
bad.append(f"the signal block is not positive definite (smallest eigenvalue {chk['signal_block_min_eig']:.4g} fF)")
|
| 483 |
if not bad:
|
| 484 |
return None
|
| 485 |
+
return ("physical check failed: " + ", ".join(bad) + ". This matrix is not physical, so do not use it. A model that solves the "
|
| 486 |
+
"physics, such as Accurate, is the safer choice, especially outside the trained component families.")
|
| 487 |
|
| 488 |
|
| 489 |
def predict_gnn(prepared, name: str, reg, substrate="Si (cryogenic, training)", thickness_um: float = 350.0, model_dir=None,
|
geomgnn/app_flagship.py
CHANGED
|
@@ -50,27 +50,28 @@ def served(reg=None) -> list[str]:
|
|
| 50 |
def resolve(reg, model) -> str:
|
| 51 |
m = str(model or reg["flagship_hub"]["default_arm"]).strip().lower()
|
| 52 |
if m not in served(reg):
|
| 53 |
-
raise ValueError(f"
|
| 54 |
return m
|
| 55 |
|
| 56 |
|
| 57 |
def tiers_md(reg) -> str:
|
| 58 |
"""The tier accordion: one row per served tier with its one fresh check (B5) against the physics alone; the full tables are on
|
| 59 |
the model card."""
|
| 60 |
-
rows = [f"|
|
| 61 |
f"{UI.pct(t['b5']) if t.get('b5') else 'n/a'} | {UI.pct(t['b5_physics']) if t.get('b5_physics') else 'n/a'} |"
|
| 62 |
for t in (FS.tiers(reg)[k] for k in served(reg))]
|
| 63 |
sid = reg["flagship_hub"]["space"]
|
| 64 |
-
return "\n".join(["|
|
| 65 |
-
f"
|
| 66 |
-
"one held-out check is
|
| 67 |
-
"median relative error over the mutual entries against Q3D
|
| 68 |
-
f"[model card](https://huggingface.co/spaces/{sid}/blob/main/README.md)
|
|
|
|
| 69 |
|
| 70 |
|
| 71 |
def expected(reg, k) -> str | None:
|
| 72 |
b5 = FS.tiers(reg)[k].get("b5")
|
| 73 |
-
return f"
|
| 74 |
|
| 75 |
|
| 76 |
def _predict(lay, model, substrate, thickness_um, w=None, own=False):
|
|
@@ -147,18 +148,17 @@ def report_md(res: dict, reg) -> str:
|
|
| 147 |
st = res.get("prior_stack")
|
| 148 |
lv = res.get("levels_ppg") or []
|
| 149 |
sub = (res.get("substrate_route") or {}).get("route", "training stack")
|
| 150 |
-
lines = [f"-
|
| 151 |
-
"-
|
| 152 |
-
|
| 153 |
-
"learned prior surrogate (no field solve)")]
|
| 154 |
if sub == "training stack":
|
| 155 |
lines.append("- " + A.substrate_line(res))
|
| 156 |
-
lines.append("-
|
| 157 |
+ f" ({t.get('threads')} threads)")
|
| 158 |
ws = [w for w in res["warnings"] if not (w.startswith("physical check failed") or w == A.FAST_WARNING or
|
| 159 |
w.startswith("substrate eps_r "))]
|
| 160 |
if ws:
|
| 161 |
-
lines += ["", "
|
| 162 |
return "\n".join(lines)
|
| 163 |
|
| 164 |
|
|
@@ -206,13 +206,13 @@ def models_fn():
|
|
| 206 |
out = []
|
| 207 |
for k in served(reg):
|
| 208 |
t = FS.tiers(reg)[k]
|
| 209 |
-
out.append({"id": k, "title": t["title"], "summary": t.get("summary"), "warning": t.get("warning"),
|
| 210 |
"own": t.get("own") or {}, "b5": t.get("b5"), "b5_physics": t.get("b5_physics"), "time_space": t.get("time_space"), "time_x86": t.get("time_x86"),
|
| 211 |
"stack": t.get("stack"), "levels_ppg": [float(p) for p in t.get("ppg") or []], "default": k == h["default_arm"],
|
| 212 |
"max_conductors": int(h["max_conductors"]), "limits": limits()})
|
| 213 |
from . import paper as PA
|
| 214 |
return out + [{"geomgnn_version": __version__, "tlsq_infer_version": TLSQ_VERSION, "registry_version": reg["version"],
|
| 215 |
-
"training_layouts": h.get("training_layouts"),
|
| 216 |
"startup": dict(PA.STARTUP)}]
|
| 217 |
|
| 218 |
|
|
@@ -221,38 +221,37 @@ def limits() -> dict:
|
|
| 221 |
"free": "repeats answered from the cache and the examples", "local_guide": AC.LOCAL_GUIDE}
|
| 222 |
|
| 223 |
|
| 224 |
-
def paper_models(reg) -> dict:
|
| 225 |
-
"""The paper's models on Hugging Face (model repositories; there is no paper Space)."""
|
| 226 |
-
h = reg["flagship_hub"]
|
| 227 |
-
return {"paper": h["paper_models"], "earlier_draft": sorted({m["repo_id"] for m in reg.models.values() if m.get("repo_id")})}
|
| 228 |
|
| 229 |
|
| 230 |
-
LEDE = "
|
| 231 |
-
LIMITS_MD = (f"The examples run without sign-in.
|
| 232 |
-
f"layouts with fewer than {AC.MAX_NETS} conductors, ground included.
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
"
|
| 236 |
-
"
|
| 237 |
-
"
|
|
|
|
| 238 |
"ordinary web access logs under its own policy.")
|
| 239 |
VIEWS = ["Layers", "Nets"]
|
|
|
|
|
|
|
| 240 |
EXAMPLE_NOTES = {"lattice_1q.gds": "≈20 s on Accurate", "lattice_5q.gds": "≈20 s on Accurate"}
|
| 241 |
-
LAYER_HELP = ("Set each layer
|
| 242 |
-
"islands
|
| 243 |
-
"
|
| 244 |
|
| 245 |
|
| 246 |
def about_md(reg) -> str:
|
| 247 |
h = reg["flagship_hub"]
|
| 248 |
-
pm = paper_models(reg)
|
| 249 |
-
return f"""Planar layouts only: one metal layer of zero thickness on a dielectric substrate. Each tier corrects thin-film physics (Fast: a learned prior) with networks trained on Q3D. Private preview while the paper is in preparation.
|
| 250 |
|
| 251 |
-
|
|
|
|
|
|
|
| 252 |
|
| 253 |
-
|
| 254 |
|
| 255 |
-
|
| 256 |
|
| 257 |
```python
|
| 258 |
from gradio_client import Client, handle_file
|
|
@@ -262,7 +261,7 @@ r = c.predict(handle_file("layout.gds"), "1/0", "1/10", 0, "Si (cryogenic, train
|
|
| 262 |
r["names"], r["matrix_fF"]
|
| 263 |
```
|
| 264 |
|
| 265 |
-
|
| 266 |
|
| 267 |
{PRIVACY_MD}
|
| 268 |
|
|
@@ -304,18 +303,18 @@ def nets_caption(lay, full_ground=None, select="") -> str:
|
|
| 304 |
n_all = int(lay.info.get("n_bodies_total") or lay.n_conductors)
|
| 305 |
lines = [f"Nets numbered as in the matrix: G and {_names(lay.names)}."]
|
| 306 |
if lay.window is not None and full_ground and _size(full_ground) == _size(lay.ground.bounds):
|
| 307 |
-
lines.append(f"
|
| 308 |
-
f"{_size(full_ground)}
|
| 309 |
elif lay.window is not None:
|
| 310 |
lines.append(f"Ground cropped from {_size(full_ground)} to {_size(lay.ground.bounds)} (dashed window, margin "
|
| 311 |
-
f"{lay.info['margin_um']:,.0f} µm)
|
| 312 |
f"Ground cropped to {_size(lay.ground.bounds)} (dashed window).")
|
| 313 |
else:
|
| 314 |
lines.append(f"Full ground plane, {_size(lay.ground.bounds)} (the training geometry).")
|
| 315 |
if lay.n_conductors < n_all:
|
| 316 |
sel = ", ".join(f"C{x.strip()}" for x in str(select).split(",") if x.strip())
|
| 317 |
-
lines.append(f"Modelling {lay.n_conductors} of {n_all} conductors ({sel}
|
| 318 |
-
"not modelled.")
|
| 319 |
return "".join(f"<p class='tl-note'>{html.escape(x)}</p>" for x in lines)
|
| 320 |
|
| 321 |
|
|
@@ -422,8 +421,8 @@ def stack_note(reg, substrate, custom_eps, thickness) -> str:
|
|
| 422 |
if on:
|
| 423 |
return ""
|
| 424 |
return UI.callout("warn", "Off the training stack (Si, eps_r 11.45, 350 µm)", [
|
| 425 |
-
f"Accurate and Balanced solve the physics prior at your stack and the networks correct it unchanged
|
| 426 |
-
"Fast rescales its prediction and
|
| 427 |
|
| 428 |
|
| 429 |
def _api(fn, n_out):
|
|
@@ -439,32 +438,33 @@ def build_app(title: str, examples_dir=None):
|
|
| 439 |
ex = sorted(Path(examples_dir).glob("*.gds")) if examples_dir and Path(examples_dir).exists() else []
|
| 440 |
AC.register_examples(ex)
|
| 441 |
usage_stats()
|
| 442 |
-
label = {"accurate": "Accurate (≈1 s, default)", "balanced": "Balanced (≈0.5 s)", "fast": "Fast (≈0.1 s
|
| 443 |
with UI.blocks(title, delete_cache=(60, PURGE_AGE_S)) as demo:
|
| 444 |
gr.HTML(UI.header(reg["flagship_hub"]["title"], LEDE), container=False, padding=False, elem_classes="tl-flush")
|
| 445 |
with gr.Row():
|
| 446 |
with gr.Column(scale=1):
|
| 447 |
with gr.Row(elem_classes="tl-login"):
|
| 448 |
gr.LoginButton(size="sm", scale=0, min_width=220)
|
| 449 |
-
gr.Markdown(f"Sign in to run your own layout
|
| 450 |
-
f"
|
|
|
|
| 451 |
elem_classes="tl-note")
|
| 452 |
gds = gr.File(label="GDS file", file_types=[".gds", ".gds2", ".gdsii"])
|
| 453 |
if ex:
|
| 454 |
demo.tl_examples = UI.examples(gds, ex, label="Examples", example_labels=[
|
| 455 |
-
p.name + (f" ({EXAMPLE_NOTES[p.name]})" if p.name in EXAMPLE_NOTES else "") for p in ex])
|
| 456 |
upload_msg = gr.HTML(elem_classes="tl-flush")
|
| 457 |
with gr.Accordion("Layers", open=False, visible=False) as layer_acc:
|
| 458 |
layer_help = gr.Markdown(LAYER_HELP, visible=False)
|
| 459 |
layers = gr.Dataframe(headers=LAYER_COLS, datatype=["number", "number", "str", "number", "number", "str"], value=None,
|
| 460 |
-
label="
|
| 461 |
pick, role = UI.layer_editor()
|
| 462 |
-
with gr.Accordion("Options: model a subset
|
| 463 |
-
select = gr.Textbox(label="
|
| 464 |
-
crop = gr.Checkbox(False, label="
|
| 465 |
with gr.Row(visible=False) as crop_row:
|
| 466 |
-
margin = gr.Slider(0, 300, value=0, step=1, label="
|
| 467 |
-
margin_um = gr.Number(value=None, label="
|
| 468 |
with gr.Column(scale=1):
|
| 469 |
with gr.Row(visible=False, elem_classes="tl-viewbar") as viewbar:
|
| 470 |
view = gr.Radio(VIEWS, value=VIEWS[0], show_label=False, container=False, elem_id="tl-view", label="view", scale=0,
|
|
@@ -472,25 +472,23 @@ def build_app(title: str, examples_dir=None):
|
|
| 472 |
svg_btn = gr.DownloadButton("Download SVG", value=None, size="sm", variant="secondary", visible=False, scale=0,
|
| 473 |
min_width=130)
|
| 474 |
img = gr.Image(type="filepath", interactive=False, show_label=False, label="layout", elem_id="tl-viewer", buttons=["download", "fullscreen"],
|
| 475 |
-
height=440, alt_text="The uploaded layout
|
| 476 |
-
"numbered as the matrix (Nets).")
|
| 477 |
view_msg = gr.HTML(elem_classes="tl-flush")
|
| 478 |
gparts = GU.build()
|
| 479 |
gst = gparts[0]
|
| 480 |
with gr.Row(equal_height=False):
|
| 481 |
-
model = gr.Radio([(label.get(k, k), k) for k in ms], value=default, label="
|
| 482 |
scale=3, min_width=300)
|
| 483 |
-
substrate = gr.Dropdown(subs, value=subs[0], label="
|
| 484 |
custom_eps = gr.Number(value=11.45, label="eps_r", visible=False, scale=1, min_width=110)
|
| 485 |
-
thickness = gr.Number(value=350, label="
|
| 486 |
sub_note = gr.HTML(elem_classes="tl-flush")
|
| 487 |
-
with gr.Accordion("
|
| 488 |
gr.Markdown(tiers_md(reg))
|
| 489 |
-
fast_cb = None
|
| 490 |
if "fast" in ms:
|
| 491 |
-
gr.Markdown("
|
| 492 |
-
"
|
| 493 |
-
fast_cb = gr.Checkbox(False, label="Use Fast (≈0.1 s) instead of the tier above", elem_classes="tl-check")
|
| 494 |
pred_btn = gr.Button("Predict", variant="primary")
|
| 495 |
status = gr.HTML(elem_classes="tl-flush")
|
| 496 |
with gr.Column(visible=False) as result_box, gr.Row():
|
|
@@ -500,11 +498,12 @@ def build_app(title: str, examples_dir=None):
|
|
| 500 |
mat_note = gr.HTML(container=False, padding=False, elem_classes="tl-flush")
|
| 501 |
with gr.Column():
|
| 502 |
csv_f = gr.File(label="CSV (fF, full precision)")
|
| 503 |
-
json_f = gr.File(label="JSON (matrix
|
| 504 |
with result_box:
|
| 505 |
report = gr.Markdown()
|
| 506 |
with gr.Accordion("About", open=False):
|
| 507 |
gr.Markdown(about_md(reg))
|
|
|
|
| 508 |
res_state = gr.State(None)
|
| 509 |
vst = gr.State({})
|
| 510 |
with gr.Row(visible=False):
|
|
@@ -532,9 +531,6 @@ def build_app(title: str, examples_dir=None):
|
|
| 532 |
ui_predict.__name__ = "predict_fn_ui"
|
| 533 |
uouts = pouts + [status, result_box, mat_note]
|
| 534 |
hidden = dict(api_visibility="private", show_progress="hidden")
|
| 535 |
-
if fast_cb:
|
| 536 |
-
model.change(lambda k: gr.update(value=k == "fast"), model, fast_cb, **hidden)
|
| 537 |
-
fast_cb.input(lambda on: "fast" if on else default, fast_cb, model, **hidden)
|
| 538 |
substrate.change(lambda s: gr.update(visible=s == CUSTOM), substrate, custom_eps, **hidden)
|
| 539 |
for ev in (substrate.change, custom_eps.change, thickness.change):
|
| 540 |
ev(lambda s, e, t: stack_note(reg, s, e, t), [substrate, custom_eps, thickness], sub_note, **hidden)
|
|
|
|
| 50 |
def resolve(reg, model) -> str:
|
| 51 |
m = str(model or reg["flagship_hub"]["default_arm"]).strip().lower()
|
| 52 |
if m not in served(reg):
|
| 53 |
+
raise ValueError(f"Model {model!r} is not available here. Choose one of {served(reg)}.")
|
| 54 |
return m
|
| 55 |
|
| 56 |
|
| 57 |
def tiers_md(reg) -> str:
|
| 58 |
"""The tier accordion: one row per served tier with its one fresh check (B5) against the physics alone; the full tables are on
|
| 59 |
the model card."""
|
| 60 |
+
rows = [f"| {UI.md(t['title'].split(':')[0])} | {UI.md(t['title'].split(':', 1)[-1].strip())} | "
|
| 61 |
f"{UI.pct(t['b5']) if t.get('b5') else 'n/a'} | {UI.pct(t['b5_physics']) if t.get('b5_physics') else 'n/a'} |"
|
| 62 |
for t in (FS.tiers(reg)[k] for k in served(reg))]
|
| 63 |
sid = reg["flagship_hub"]["space"]
|
| 64 |
+
return "\n".join(["| model | method | error on 39 new layouts | physics alone |", "|---|---|---|---|", *rows, "",
|
| 65 |
+
f"We trained these networks on all {int(reg['flagship_hub']['training_layouts']):,} Q3D layouts of the training "
|
| 66 |
+
"stack, so their one held-out check is 39 layouts of a generated family with 3-4 conductors, none of them seen in "
|
| 67 |
+
"training. The error is the median relative error over the mutual entries against Q3D, averaged over the layouts. "
|
| 68 |
+
f"The [model card](https://huggingface.co/spaces/{sid}/blob/main/README.md) has the in-sample fits, the held-out "
|
| 69 |
+
"numbers from the paper and the timings."])
|
| 70 |
|
| 71 |
|
| 72 |
def expected(reg, k) -> str | None:
|
| 73 |
b5 = FS.tiers(reg)[k].get("b5")
|
| 74 |
+
return f"Expect an error of {UI.pct(b5)} on a new design of a trained family. We measured this on 39 layouts the model never saw." if b5 else None
|
| 75 |
|
| 76 |
|
| 77 |
def _predict(lay, model, substrate, thickness_um, w=None, own=False):
|
|
|
|
| 148 |
st = res.get("prior_stack")
|
| 149 |
lv = res.get("levels_ppg") or []
|
| 150 |
sub = (res.get("substrate_route") or {}).get("route", "training stack")
|
| 151 |
+
lines = [f"- Model: {UI.md(res['tier_title'].split(':')[0])} ({res['package_version']}, registry v{res['registry_version']})",
|
| 152 |
+
"- Physics: " + (f"thin-film solves at {' and '.join(f'{p:g}' for p in lv)} panels per gap" if st else
|
| 153 |
+
"a learned surrogate of the physics prior, with no field solve")]
|
|
|
|
| 154 |
if sub == "training stack":
|
| 155 |
lines.append("- " + A.substrate_line(res))
|
| 156 |
+
lines.append("- Time: " + ", ".join(f"{k.replace('_s', '')} {v:.2f} s" for k, v in t.items() if isinstance(v, float))
|
| 157 |
+ f" ({t.get('threads')} threads)")
|
| 158 |
ws = [w for w in res["warnings"] if not (w.startswith("physical check failed") or w == A.FAST_WARNING or
|
| 159 |
w.startswith("substrate eps_r "))]
|
| 160 |
if ws:
|
| 161 |
+
lines += ["", "Warnings:", ""] + [f"- {UI.md(w)}" for w in ws]
|
| 162 |
return "\n".join(lines)
|
| 163 |
|
| 164 |
|
|
|
|
| 206 |
out = []
|
| 207 |
for k in served(reg):
|
| 208 |
t = FS.tiers(reg)[k]
|
| 209 |
+
out.append({"id": k, "title": t["title"], "summary": t.get("summary"), "warning": t.get("warning"),
|
| 210 |
"own": t.get("own") or {}, "b5": t.get("b5"), "b5_physics": t.get("b5_physics"), "time_space": t.get("time_space"), "time_x86": t.get("time_x86"),
|
| 211 |
"stack": t.get("stack"), "levels_ppg": [float(p) for p in t.get("ppg") or []], "default": k == h["default_arm"],
|
| 212 |
"max_conductors": int(h["max_conductors"]), "limits": limits()})
|
| 213 |
from . import paper as PA
|
| 214 |
return out + [{"geomgnn_version": __version__, "tlsq_infer_version": TLSQ_VERSION, "registry_version": reg["version"],
|
| 215 |
+
"training_layouts": h.get("training_layouts"),
|
| 216 |
"startup": dict(PA.STARTUP)}]
|
| 217 |
|
| 218 |
|
|
|
|
| 221 |
"free": "repeats answered from the cache and the examples", "local_guide": AC.LOCAL_GUIDE}
|
| 222 |
|
| 223 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 224 |
|
| 225 |
|
| 226 |
+
LEDE = "Upload the GDS of a planar superconducting layout and get its full Maxwell capacitance matrix in fF."
|
| 227 |
+
LIMITS_MD = (f"The examples run without sign-in. To run your own layout, sign in with Hugging Face. You get {AC.DAILY} predictions per day "
|
| 228 |
+
f"(UTC) for layouts with fewer than {AC.MAX_NETS} conductors, ground included. Asking again for a result you already have "
|
| 229 |
+
"does not count.")
|
| 230 |
+
PRIVACY_MD = ("We process uploaded layouts in memory and keep them there only while the Space runs, to answer repeat requests. Nothing "
|
| 231 |
+
"is written to permanent storage, and we never log or keep file names or geometry. To enforce the daily limit, we turn your "
|
| 232 |
+
"Hugging Face username and your network address into keyed hashes, which stay in memory and are cleared at the end of the "
|
| 233 |
+
"UTC day. They are never stored or logged. We keep only daily totals (runs per model and per layout size, refusals by "
|
| 234 |
+
"reason, errors, response times and the number of distinct users that day) to see how the demo is used. Hugging Face keeps "
|
| 235 |
"ordinary web access logs under its own policy.")
|
| 236 |
VIEWS = ["Layers", "Nets"]
|
| 237 |
+
EXAMPLE_NAMES = {"interdigital.gds": "interdigital capacitor", "lattice_1q.gds": "one-qubit grid", "lattice_5q.gds": "five-qubit grid",
|
| 238 |
+
"shielded_concentric.gds": "shielded concentric", "transmon_pocket.gds": "TransmonPocket", "xmon.gds": "Xmon"}
|
| 239 |
EXAMPLE_NOTES = {"lattice_1q.gds": "≈20 s on Accurate", "lattice_5q.gds": "≈20 s on Accurate"}
|
| 240 |
+
LAYER_HELP = ("Set the role of each layer by picking it from the list or clicking its row. Use `ground` for the ground plane (one net), "
|
| 241 |
+
"`conductor` for metal islands (each connected body is one net, C1, C2, …), `ground+conductor` when both are on one layer "
|
| 242 |
+
"(we then find the ground) and `ignore` for markers, junctions and labels. By default 1/0 is ground and 1/10 is conductor.")
|
| 243 |
|
| 244 |
|
| 245 |
def about_md(reg) -> str:
|
| 246 |
h = reg["flagship_hub"]
|
|
|
|
|
|
|
| 247 |
|
| 248 |
+
return f"""The models handle planar layouts only, i.e., one metal layer of zero thickness on a dielectric substrate. Each model computes a thin-film physics prior (Fast learns it instead) and corrects it with networks trained on Q3D simulations. This is a private preview while the paper is in preparation.
|
| 249 |
+
|
| 250 |
+
|
| 251 |
|
| 252 |
+
{LIMITS_MD} Files can be up to {LIMITS['max_file_mb']:g} MB and {LIMITS['max_polygons']:,} polygons, and the Space answers one request at a time. These limits come from the server, not from the models. To go past them, [run the models on your own computer]({AC.LOCAL_GUIDE}).
|
| 253 |
|
| 254 |
+
You can also call the demo from Python with gradio_client. "Use via API" at the bottom of the page lists every endpoint.
|
| 255 |
|
| 256 |
```python
|
| 257 |
from gradio_client import Client, handle_file
|
|
|
|
| 261 |
r["names"], r["matrix_fF"]
|
| 262 |
```
|
| 263 |
|
| 264 |
+
The arguments are, in order, the GDS file, the ground layers, the conductor layers, the crop margin in gaps (0 keeps the training geometry), the substrate, eps_r (for a custom substrate), the thickness in µm, the model ({', '.join(served(reg))}) and the ground pieces ("" picks them automatically when ground and conductors share a layer).
|
| 265 |
|
| 266 |
{PRIVACY_MD}
|
| 267 |
|
|
|
|
| 303 |
n_all = int(lay.info.get("n_bodies_total") or lay.n_conductors)
|
| 304 |
lines = [f"Nets numbered as in the matrix: G and {_names(lay.names)}."]
|
| 305 |
if lay.window is not None and full_ground and _size(full_ground) == _size(lay.ground.bounds):
|
| 306 |
+
lines.append(f"The crop window (dashed, margin {lay.info['margin_um']:,.0f} µm) holds the whole ground plane, "
|
| 307 |
+
f"{_size(full_ground)}, so nothing is cut.")
|
| 308 |
elif lay.window is not None:
|
| 309 |
lines.append(f"Ground cropped from {_size(full_ground)} to {_size(lay.ground.bounds)} (dashed window, margin "
|
| 310 |
+
f"{lay.info['margin_um']:,.0f} µm). This is no longer the training geometry." if full_ground else
|
| 311 |
f"Ground cropped to {_size(lay.ground.bounds)} (dashed window).")
|
| 312 |
else:
|
| 313 |
lines.append(f"Full ground plane, {_size(lay.ground.bounds)} (the training geometry).")
|
| 314 |
if lay.n_conductors < n_all:
|
| 315 |
sel = ", ".join(f"C{x.strip()}" for x in str(select).split(",") if x.strip())
|
| 316 |
+
lines.append(f"Modelling {lay.n_conductors} of {n_all} conductors ({sel}, shown as {_names(lay.names)} in the matrix). "
|
| 317 |
+
"Hatched shapes are not modelled.")
|
| 318 |
return "".join(f"<p class='tl-note'>{html.escape(x)}</p>" for x in lines)
|
| 319 |
|
| 320 |
|
|
|
|
| 421 |
if on:
|
| 422 |
return ""
|
| 423 |
return UI.callout("warn", "Off the training stack (Si, eps_r 11.45, 350 µm)", [
|
| 424 |
+
f"Accurate and Balanced solve the physics prior at your stack, and the networks correct it unchanged. We tested this on "
|
| 425 |
+
f"{A.TESTED_RANGE}. Fast only rescales its prediction, and it tells you so."])
|
| 426 |
|
| 427 |
|
| 428 |
def _api(fn, n_out):
|
|
|
|
| 438 |
ex = sorted(Path(examples_dir).glob("*.gds")) if examples_dir and Path(examples_dir).exists() else []
|
| 439 |
AC.register_examples(ex)
|
| 440 |
usage_stats()
|
| 441 |
+
label = {"accurate": "Accurate (≈1 s, default)", "balanced": "Balanced (≈0.5 s)", "fast": "Fast (≈0.1 s, trained families only)"}
|
| 442 |
with UI.blocks(title, delete_cache=(60, PURGE_AGE_S)) as demo:
|
| 443 |
gr.HTML(UI.header(reg["flagship_hub"]["title"], LEDE), container=False, padding=False, elem_classes="tl-flush")
|
| 444 |
with gr.Row():
|
| 445 |
with gr.Column(scale=1):
|
| 446 |
with gr.Row(elem_classes="tl-login"):
|
| 447 |
gr.LoginButton(size="sm", scale=0, min_width=220)
|
| 448 |
+
gr.Markdown(f"Sign in to run your own layout, with {AC.DAILY} predictions per day for layouts with fewer than "
|
| 449 |
+
f"{AC.MAX_NETS} conductors including ground. The examples run without sign-in. "
|
| 450 |
+
f"[On your own computer there are no limits]({AC.LOCAL_GUIDE}).",
|
| 451 |
elem_classes="tl-note")
|
| 452 |
gds = gr.File(label="GDS file", file_types=[".gds", ".gds2", ".gdsii"])
|
| 453 |
if ex:
|
| 454 |
demo.tl_examples = UI.examples(gds, ex, label="Examples", example_labels=[
|
| 455 |
+
EXAMPLE_NAMES.get(p.name, p.stem) + (f" ({EXAMPLE_NOTES[p.name]})" if p.name in EXAMPLE_NOTES else "") for p in ex])
|
| 456 |
upload_msg = gr.HTML(elem_classes="tl-flush")
|
| 457 |
with gr.Accordion("Layers", open=False, visible=False) as layer_acc:
|
| 458 |
layer_help = gr.Markdown(LAYER_HELP, visible=False)
|
| 459 |
layers = gr.Dataframe(headers=LAYER_COLS, datatype=["number", "number", "str", "number", "number", "str"], value=None,
|
| 460 |
+
label="Layers in the file", show_label=False, interactive=False)
|
| 461 |
pick, role = UI.layer_editor()
|
| 462 |
+
with gr.Accordion("Options: model a subset or crop the ground", open=False):
|
| 463 |
+
select = gr.Textbox(label="Conductors to model, e.g. 1,2,3 (leave empty for all)", value="")
|
| 464 |
+
crop = gr.Checkbox(False, label="Crop the ground plane around the conductors (no longer the training geometry)", elem_classes="tl-check")
|
| 465 |
with gr.Row(visible=False) as crop_row:
|
| 466 |
+
margin = gr.Slider(0, 300, value=0, step=1, label="Margin in conductor-to-ground gaps (0 sets the window automatically)")
|
| 467 |
+
margin_um = gr.Number(value=None, label="Or a margin in µm, which overrides the slider")
|
| 468 |
with gr.Column(scale=1):
|
| 469 |
with gr.Row(visible=False, elem_classes="tl-viewbar") as viewbar:
|
| 470 |
view = gr.Radio(VIEWS, value=VIEWS[0], show_label=False, container=False, elem_id="tl-view", label="view", scale=0,
|
|
|
|
| 472 |
svg_btn = gr.DownloadButton("Download SVG", value=None, size="sm", variant="secondary", visible=False, scale=0,
|
| 473 |
min_width=130)
|
| 474 |
img = gr.Image(type="filepath", interactive=False, show_label=False, label="layout", elem_id="tl-viewer", buttons=["download", "fullscreen"],
|
| 475 |
+
height=440, alt_text="The uploaded layout, shown by layer (Layers) or as the extracted nets G, C1, "
|
| 476 |
+
"C2, … numbered as in the matrix (Nets).")
|
| 477 |
view_msg = gr.HTML(elem_classes="tl-flush")
|
| 478 |
gparts = GU.build()
|
| 479 |
gst = gparts[0]
|
| 480 |
with gr.Row(equal_height=False):
|
| 481 |
+
model = gr.Radio([(label.get(k, k), k) for k in ms], value=default, label="Model", interactive=True, elem_id="tl-tier",
|
| 482 |
scale=3, min_width=300)
|
| 483 |
+
substrate = gr.Dropdown(subs, value=subs[0], label="Substrate", scale=2, min_width=220)
|
| 484 |
custom_eps = gr.Number(value=11.45, label="eps_r", visible=False, scale=1, min_width=110)
|
| 485 |
+
thickness = gr.Number(value=350, label="Thickness (µm)", scale=1, min_width=120)
|
| 486 |
sub_note = gr.HTML(elem_classes="tl-flush")
|
| 487 |
+
with gr.Accordion("Models and their accuracy", open=False):
|
| 488 |
gr.Markdown(tiers_md(reg))
|
|
|
|
| 489 |
if "fast" in ms:
|
| 490 |
+
gr.Markdown("Use Fast only for quick screening of the component families it was trained on. On new designs it did "
|
| 491 |
+
"worse than the physics alone (see the table above), so use Accurate for anything that matters.")
|
|
|
|
| 492 |
pred_btn = gr.Button("Predict", variant="primary")
|
| 493 |
status = gr.HTML(elem_classes="tl-flush")
|
| 494 |
with gr.Column(visible=False) as result_box, gr.Row():
|
|
|
|
| 498 |
mat_note = gr.HTML(container=False, padding=False, elem_classes="tl-flush")
|
| 499 |
with gr.Column():
|
| 500 |
csv_f = gr.File(label="CSV (fF, full precision)")
|
| 501 |
+
json_f = gr.File(label="JSON (matrix and metadata)")
|
| 502 |
with result_box:
|
| 503 |
report = gr.Markdown()
|
| 504 |
with gr.Accordion("About", open=False):
|
| 505 |
gr.Markdown(about_md(reg))
|
| 506 |
+
gr.HTML(UI.footer(), container=False, padding=False, elem_classes="tl-flush")
|
| 507 |
res_state = gr.State(None)
|
| 508 |
vst = gr.State({})
|
| 509 |
with gr.Row(visible=False):
|
|
|
|
| 531 |
ui_predict.__name__ = "predict_fn_ui"
|
| 532 |
uouts = pouts + [status, result_box, mat_note]
|
| 533 |
hidden = dict(api_visibility="private", show_progress="hidden")
|
|
|
|
|
|
|
|
|
|
| 534 |
substrate.change(lambda s: gr.update(visible=s == CUSTOM), substrate, custom_eps, **hidden)
|
| 535 |
for ev in (substrate.change, custom_eps.change, thickness.change):
|
| 536 |
ev(lambda s, e, t: stack_note(reg, s, e, t), [substrate, custom_eps, thickness], sub_note, **hidden)
|
geomgnn/ground_ui.py
CHANGED
|
@@ -92,16 +92,16 @@ def _md(st, lay) -> str:
|
|
| 92 |
cur = ", ".join(f"#{i}" for i in st["current"])
|
| 93 |
auto = ", ".join(f"#{i}" for i in st["auto"])
|
| 94 |
if st["current"] == st["auto"]:
|
| 95 |
-
head = f"
|
| 96 |
else:
|
| 97 |
-
head = f"
|
| 98 |
-
low = "\n\
|
| 99 |
ok = "Ground confirmed: Predict uses this choice." if st["confirmed"] else "Not confirmed yet: Predict is locked until you confirm."
|
| 100 |
n = len(lay.names)
|
| 101 |
return (f"{head}{low}\n\nWhy the automatic pick: {st['reason']}.\n\nGrey = ground (G #k), coloured = conductors: conductor Ck is piece #k in the image, the table and the matrix "
|
| 102 |
f"({n} conductor{'s' if n != 1 else ''}, {gd['n_pieces']} pieces on layer "
|
| 103 |
-
f"{', '.join(f'{a}/{b}' for a, b in gd['layers'])}).\n\nIf this is right, press
|
| 104 |
-
f"
|
| 105 |
|
| 106 |
|
| 107 |
def _rows(lay):
|
|
@@ -157,7 +157,7 @@ def _set(st, new):
|
|
| 157 |
|
| 158 |
def click_fn(st, fix, evt=None):
|
| 159 |
if st is None or evt is None:
|
| 160 |
-
raise gr.Error("
|
| 161 |
if not fix:
|
| 162 |
gr.Info("Turn on 'Fix it' to change the roles by clicking.")
|
| 163 |
img, md, rows = _view(st)
|
|
@@ -224,7 +224,7 @@ def build():
|
|
| 224 |
reset = gr.Button("Reset to automatic", variant="secondary", size="sm")
|
| 225 |
gr.HTML("<style>#ground-pieces .select-all-checkbox{display:none !important}</style>", container=False, padding=False)
|
| 226 |
table = gr.Dataframe(headers=COLS, elem_id="ground-pieces", show_search="none", datatype=["number", "bool", "str", "number", "str"], interactive=True, static_columns=[0, 2, 3, 4],
|
| 227 |
-
label="
|
| 228 |
wrap=True)
|
| 229 |
return st, box, img, info, confirm, fix, undo, reset, table
|
| 230 |
|
|
|
|
| 92 |
cur = ", ".join(f"#{i}" for i in st["current"])
|
| 93 |
auto = ", ".join(f"#{i}" for i in st["auto"])
|
| 94 |
if st["current"] == st["auto"]:
|
| 95 |
+
head = f"Ground found automatically: piece {cur} (confidence {st['confidence']})."
|
| 96 |
else:
|
| 97 |
+
head = f"Your choice: the ground is piece {cur} (the automatic pick was {auto})."
|
| 98 |
+
low = "\n\nPlease check it, since the automatic pick is uncertain." if st["confidence"] == "low" and st["current"] == st["auto"] else ""
|
| 99 |
ok = "Ground confirmed: Predict uses this choice." if st["confirmed"] else "Not confirmed yet: Predict is locked until you confirm."
|
| 100 |
n = len(lay.names)
|
| 101 |
return (f"{head}{low}\n\nWhy the automatic pick: {st['reason']}.\n\nGrey = ground (G #k), coloured = conductors: conductor Ck is piece #k in the image, the table and the matrix "
|
| 102 |
f"({n} conductor{'s' if n != 1 else ''}, {gd['n_pieces']} pieces on layer "
|
| 103 |
+
f"{', '.join(f'{a}/{b}' for a, b in gd['layers'])}).\n\nIf this is right, press \"Looks right → Predict\". Otherwise turn on "
|
| 104 |
+
f"\"Fix it\" and click a shape (or tick it in the table) to switch it between ground and conductor.\n\n_{ok}_")
|
| 105 |
|
| 106 |
|
| 107 |
def _rows(lay):
|
|
|
|
| 157 |
|
| 158 |
def click_fn(st, fix, evt=None):
|
| 159 |
if st is None or evt is None:
|
| 160 |
+
raise gr.Error("Upload a layout first.")
|
| 161 |
if not fix:
|
| 162 |
gr.Info("Turn on 'Fix it' to change the roles by clicking.")
|
| 163 |
img, md, rows = _view(st)
|
|
|
|
| 224 |
reset = gr.Button("Reset to automatic", variant="secondary", size="sm")
|
| 225 |
gr.HTML("<style>#ground-pieces .select-all-checkbox{display:none !important}</style>", container=False, padding=False)
|
| 226 |
table = gr.Dataframe(headers=COLS, elem_id="ground-pieces", show_search="none", datatype=["number", "bool", "str", "number", "str"], interactive=True, static_columns=[0, 2, 3, 4],
|
| 227 |
+
label="Pieces. Tick 'ground' to make a piece part of the ground (several pieces form one ground net).",
|
| 228 |
wrap=True)
|
| 229 |
return st, box, img, info, confirm, fix, undo, reset, table
|
| 230 |
|
geomgnn/ui.py
CHANGED
|
@@ -23,13 +23,13 @@ MAT = ["tl-matrix"]
|
|
| 23 |
REEXPORT = ("Re-export the layout as GDSII (.gds) from KLayout (File > Save As, format GDS2) or gdstk (Library.write_gds), then "
|
| 24 |
"upload it again.")
|
| 25 |
EMPTY = "<p class='tl-note'>The matrix appears here after Predict.</p>"
|
| 26 |
-
STALE = ("<div class='tl-status stale' role='status'><strong>Inputs changed.</strong>
|
| 27 |
-
"
|
| 28 |
-
MATRIX_NOTE = ("<p class='tl-note'>
|
| 29 |
-
"decimals
|
| 30 |
-
"
|
| 31 |
-
"columns.</p>")
|
| 32 |
-
GROUND_FLAG = "<span class='tl-flag'>†</span>
|
| 33 |
|
| 34 |
|
| 35 |
INK = gr.themes.Color(c50="#f3f6fa", c100="#e4eaf2", c200="#c9d5e4", c300="#a3b6cf", c400="#7590b3", c500="#4f6d94", c600="#3b5a80",
|
|
@@ -59,7 +59,6 @@ CSS = """
|
|
| 59 |
.gradio-container button.secondary { border: 1px solid var(--button-secondary-border-color); font-size: 0.875rem; font-weight: 500;
|
| 60 |
padding: 0 16px; }
|
| 61 |
.tl-flush .html-container { padding: 0 !important; }
|
| 62 |
-
#tl-tier label:has(input[value="fast"]) { display: none; }
|
| 63 |
.gradio-container h2 { font-family: "Source Serif 4", Georgia, serif; font-weight: 600; margin-top: 18px; }
|
| 64 |
.gradio-container .prose p, .gradio-container .prose li, .gradio-container .prose blockquote { max-width: 80ch; }
|
| 65 |
.tl-status { border: 1px solid var(--tl-mute-line); background: var(--tl-mute-bg); color: var(--tl-mute); border-radius: 8px;
|
|
@@ -83,6 +82,8 @@ CSS = """
|
|
| 83 |
.gradio-container label:has(input[type=radio]:focus-visible), .gradio-container label:has(input[type=checkbox]:focus-visible) {
|
| 84 |
box-shadow: 0 0 0 2px #1e3a5f; }
|
| 85 |
.gradio-container button:focus-visible { outline: 2px solid #1e3a5f; outline-offset: 2px; }
|
|
|
|
|
|
|
| 86 |
#tl-tier label, .tl-check label, .tl-touch button, .gradio-container button.primary, .gradio-container button.secondary {
|
| 87 |
min-height: 44px !important; }
|
| 88 |
@media (max-width: 640px) { /* Gradio prefixes rules inside @media with its container: no .gradio-container here */
|
|
@@ -159,6 +160,13 @@ def header(title: str, lede: str, meta: str | None = None) -> str:
|
|
| 159 |
f"<p>{lede}</p>" + (f"<p class='tl-meta'>{meta}</p>" if meta else "") + "</div>")
|
| 160 |
|
| 161 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
def examples(comp, paths, **kw):
|
| 163 |
"""gr.Examples whose cached copies survive delete_cache. Gradio 6.29 copies a File example into the cache with
|
| 164 |
Blocks.temp_files but does not add it to keep_in_cache (the Dataset only stores the file name), so the delete_cache sweep
|
|
@@ -185,8 +193,9 @@ def fig_files(fig, d: Path, stem: str) -> tuple[str, str]:
|
|
| 185 |
|
| 186 |
def matrix_note(res) -> str:
|
| 187 |
flag = "indicative" in str(res.get("self_capacitance", "")) and list(res.get("names") or [])[:1] == ["G"]
|
| 188 |
-
return ("<p class='tl-note'>
|
| 189 |
-
"the CSV and JSON keep full precision." + (f" {GROUND_FLAG}" if flag else "") +
|
|
|
|
| 190 |
"Swipe the matrix sideways for more columns.</p>")
|
| 191 |
|
| 192 |
|
|
@@ -227,20 +236,21 @@ def _checks(c) -> str:
|
|
| 227 |
eig = c.get("signal_block_min_eig")
|
| 228 |
return (f"Symmetric (max |C − Cᵀ| {c['symmetric_max_abs']:.2g} fF), every off-diagonal negative"
|
| 229 |
+ (f", signal block positive definite (smallest eigenvalue {eig:.4g} fF)." if eig is not None else
|
| 230 |
-
"
|
| 231 |
|
| 232 |
|
| 233 |
def _offstack(res) -> str:
|
| 234 |
sub = res.get("substrate_route") or {}
|
| 235 |
e, t = res.get("eps_r"), res.get("thickness_um")
|
| 236 |
if sub.get("route") == A.FAST_ROUTE:
|
| 237 |
-
return (f"Substrate eps_r {e:g}, {t:g} µm. This
|
| 238 |
-
f"prediction
|
| 239 |
-
"
|
| 240 |
-
head = f"Substrate eps_r {e:g}, {t:g} µm
|
|
|
|
| 241 |
if not sub.get("tested", True):
|
| 242 |
-
return head + f"
|
| 243 |
-
return head + f"
|
| 244 |
|
| 245 |
|
| 246 |
def status_html(res, expected: str | None = None) -> str:
|
|
|
|
| 23 |
REEXPORT = ("Re-export the layout as GDSII (.gds) from KLayout (File > Save As, format GDS2) or gdstk (Library.write_gds), then "
|
| 24 |
"upload it again.")
|
| 25 |
EMPTY = "<p class='tl-note'>The matrix appears here after Predict.</p>"
|
| 26 |
+
STALE = ("<div class='tl-status stale' role='status'><strong>Inputs changed.</strong> The matrix shown is for the previous inputs. "
|
| 27 |
+
"Press Predict to update it.</div>")
|
| 28 |
+
MATRIX_NOTE = ("<p class='tl-note'>The diagonal holds the self capacitances and the off-diagonal entries are minus the mutual "
|
| 29 |
+
"capacitances, in fF. The table shows 3 decimals, and the CSV and JSON keep full precision. <span class='tl-flag'>†</span> "
|
| 30 |
+
"The ground self term is only indicative, since it depends on the chip boundary.</p><p class='tl-note tl-scroll-hint'>"
|
| 31 |
+
"Swipe the matrix sideways for more columns.</p>")
|
| 32 |
+
GROUND_FLAG = "<span class='tl-flag'>†</span> The ground self term is only indicative, since it depends on the chip boundary."
|
| 33 |
|
| 34 |
|
| 35 |
INK = gr.themes.Color(c50="#f3f6fa", c100="#e4eaf2", c200="#c9d5e4", c300="#a3b6cf", c400="#7590b3", c500="#4f6d94", c600="#3b5a80",
|
|
|
|
| 59 |
.gradio-container button.secondary { border: 1px solid var(--button-secondary-border-color); font-size: 0.875rem; font-weight: 500;
|
| 60 |
padding: 0 16px; }
|
| 61 |
.tl-flush .html-container { padding: 0 !important; }
|
|
|
|
| 62 |
.gradio-container h2 { font-family: "Source Serif 4", Georgia, serif; font-weight: 600; margin-top: 18px; }
|
| 63 |
.gradio-container .prose p, .gradio-container .prose li, .gradio-container .prose blockquote { max-width: 80ch; }
|
| 64 |
.tl-status { border: 1px solid var(--tl-mute-line); background: var(--tl-mute-bg); color: var(--tl-mute); border-radius: 8px;
|
|
|
|
| 82 |
.gradio-container label:has(input[type=radio]:focus-visible), .gradio-container label:has(input[type=checkbox]:focus-visible) {
|
| 83 |
box-shadow: 0 0 0 2px #1e3a5f; }
|
| 84 |
.gradio-container button:focus-visible { outline: 2px solid #1e3a5f; outline-offset: 2px; }
|
| 85 |
+
#tl-footer { margin-top: 1.5rem; padding-top: .8rem; border-top: 1px solid var(--border-color-primary); font-size: .85rem; color: var(--body-text-color-subdued); text-align: center; }
|
| 86 |
+
#tl-footer p { margin: .15rem 0; }
|
| 87 |
#tl-tier label, .tl-check label, .tl-touch button, .gradio-container button.primary, .gradio-container button.secondary {
|
| 88 |
min-height: 44px !important; }
|
| 89 |
@media (max-width: 640px) { /* Gradio prefixes rules inside @media with its container: no .gradio-container here */
|
|
|
|
| 160 |
f"<p>{lede}</p>" + (f"<p class='tl-meta'>{meta}</p>" if meta else "") + "</div>")
|
| 161 |
|
| 162 |
|
| 163 |
+
def footer() -> str:
|
| 164 |
+
"""Credit and copyright, as on the SQuADDS paper page."""
|
| 165 |
+
site = "<a href='https://sadmanahmedshanto.com'>Sadman Ahmed Shanto</a>"
|
| 166 |
+
return (f"<div id='tl-footer'><p>Models and demo by {site}.</p>"
|
| 167 |
+
f"<p>© Copyright 2026, {site} & Eli Levenson-Falk.</p></div>")
|
| 168 |
+
|
| 169 |
+
|
| 170 |
def examples(comp, paths, **kw):
|
| 171 |
"""gr.Examples whose cached copies survive delete_cache. Gradio 6.29 copies a File example into the cache with
|
| 172 |
Blocks.temp_files but does not add it to keep_in_cache (the Dataset only stores the file name), so the delete_cache sweep
|
|
|
|
| 193 |
|
| 194 |
def matrix_note(res) -> str:
|
| 195 |
flag = "indicative" in str(res.get("self_capacitance", "")) and list(res.get("names") or [])[:1] == ["G"]
|
| 196 |
+
return ("<p class='tl-note'>The diagonal holds the self capacitances and the off-diagonal entries are minus the mutual capacitances, "
|
| 197 |
+
"in fF. The table shows 3 decimals, and the CSV and JSON keep full precision." + (f" {GROUND_FLAG}" if flag else "") +
|
| 198 |
+
"</p><p class='tl-note tl-scroll-hint'>"
|
| 199 |
"Swipe the matrix sideways for more columns.</p>")
|
| 200 |
|
| 201 |
|
|
|
|
| 236 |
eig = c.get("signal_block_min_eig")
|
| 237 |
return (f"Symmetric (max |C − Cᵀ| {c['symmetric_max_abs']:.2g} fF), every off-diagonal negative"
|
| 238 |
+ (f", signal block positive definite (smallest eigenvalue {eig:.4g} fF)." if eig is not None else
|
| 239 |
+
". There are no self terms, so positive definiteness is not checked."))
|
| 240 |
|
| 241 |
|
| 242 |
def _offstack(res) -> str:
|
| 243 |
sub = res.get("substrate_route") or {}
|
| 244 |
e, t = res.get("eps_r"), res.get("thickness_um")
|
| 245 |
if sub.get("route") == A.FAST_ROUTE:
|
| 246 |
+
return (f"Substrate eps_r {e:g}, {t:g} µm. This model does not solve the physics prior at your stack. It rescales its "
|
| 247 |
+
f"training-stack prediction by (1 + eps_r) / (1 + 11.45) = {sub['eps_rescale_factor']:.4f} and does not model thickness. "
|
| 248 |
+
"Off the training stack we measured a median error of 6.4 % (MAE 1.7 fF, RMSE 2.4 fF), so use Accurate for other substrates.")
|
| 249 |
+
head = (f"Substrate eps_r {e:g}, {t:g} µm. The physics prior was solved at this stack, and the networks (trained on Si, eps_r "
|
| 250 |
+
"11.45, 350 µm) are unchanged.")
|
| 251 |
if not sub.get("tested", True):
|
| 252 |
+
return head + f" This is outside the tested range ({A.TESTED_RANGE}), so its error is unknown."
|
| 253 |
+
return head + f" This combination was tested. {A.CALIBRATED_SCORE}"
|
| 254 |
|
| 255 |
|
| 256 |
def status_html(res, expected: str | None = None) -> str:
|
registry.yaml
CHANGED
|
@@ -1389,6 +1389,10 @@ paper_arms:
|
|
| 1389 |
# layouts of one generated family, N 3-4, never seen by any component; RESULTS.md section 5). Numbers: layout-mean median relative error %
|
| 1390 |
# (MAE / RMSE fF) over mutual entries, 0.1 fF floor. Code path = the paper Space's (geomgnn.paper) through geomgnn.flagship.view.
|
| 1391 |
flagship_hub:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1392 |
space: shanto268/PlanarCapacitanceModel # the URL is kept; its earlier v3 tiers are archived (archive below)
|
| 1393 |
title: Planar Capacitance Model
|
| 1394 |
private: true # Spaces stay private (CLAUDE.md rule 11)
|
|
@@ -1427,7 +1431,7 @@ flagship_hub:
|
|
| 1427 |
|
| 1428 |
flagship_tiers:
|
| 1429 |
accurate:
|
| 1430 |
-
title: "Accurate (~1 s):
|
| 1431 |
paper_name: "Accurate"
|
| 1432 |
route: "Accurate"
|
| 1433 |
kind: gnn
|
|
@@ -1439,7 +1443,7 @@ flagship_tiers:
|
|
| 1439 |
- {name: acc_v2m_sf_s0, path: data_local/flagship_v4/hpc/runs/acc_v2m_sf_s0/model.pt, sha256: cc69c5818f5028c26177159b88239116520abbb290743d6a6c091657e8dbf1c5} # was acc_v2m_s0 56109a61 (half-space far field)
|
| 1440 |
- {name: acc_v2m_sf_s1, path: data_local/flagship_v4/hpc/runs/acc_v2m_sf_s1/model.pt, sha256: 2f88606dbec5c599550d088213a4c37af3b3ad5134ebad2e60519fb534553a57} # was acc_v2m_s1 ae9c4be5 (half-space far field)
|
| 1441 |
- {name: acc_v2m_sf_s2, path: data_local/flagship_v4/hpc/runs/acc_v2m_sf_s2/model.pt, sha256: d13bafc6b2eb7cadcd97a387d791c0210976db1a9d618f9acc1b614e3701daed} # was acc_v2m_s2 0841acc6 (half-space far field)
|
| 1442 |
-
summary: "Two thin-film method-of-moments solves
|
| 1443 |
own: # this release's own numbers; its networks saw every row scored here except B5 (data_local/farfield_adopt/insample.json, acc_v2m_sf ensemble)
|
| 1444 |
insample: {set: "in-sample, all 45,771 training layouts (TRAIN + VAL + the paper's test split; it was trained on them)", median_pct: 0.207, mae_ff: 0.0679, rmse_ff: 0.0770}
|
| 1445 |
reference:
|
|
@@ -1453,7 +1457,7 @@ flagship_tiers:
|
|
| 1453 |
time_space: "interdigital 0.47 s, xmon 0.91 s, 1-qubit lattice (N 15) 19.0 s, 16-conductor layout 9.9 s, 9-qubit lattice (N 67) 154 s (server time, one request, Docker build 2026-10-20; a repeated request is answered from the cache in ~0.01 s)"
|
| 1454 |
time_x86: "0.845 / 5.96 s in family, 1.75 / 18.1 s zero-shot (median / p90; x86 cluster, 2 CPUs); B5 0.99 s median (1.14 s on the 2026-10-20 re-run, Xeon E5-2640 v4)"
|
| 1455 |
balanced:
|
| 1456 |
-
title: "Balanced (~0.5 s): the same recipe on
|
| 1457 |
paper_name: "Balanced"
|
| 1458 |
route: "Balanced"
|
| 1459 |
kind: gnn
|
|
@@ -1465,7 +1469,7 @@ flagship_tiers:
|
|
| 1465 |
- {name: bal_v2m_sf_s0, path: data_local/flagship_v4/hpc/runs/bal_v2m_sf_s0/model.pt, sha256: aa742ab93b1e3ffcd86a753bda5cc4a68812acbe8140a6b0e311c11d1f36b4b2} # was bal_v2m_s0 50166723 (half-space far field)
|
| 1466 |
- {name: bal_v2m_sf_s1, path: data_local/flagship_v4/hpc/runs/bal_v2m_sf_s1/model.pt, sha256: 486466473eba61c090f4e3fa7988bf880fc183570c5d02bd78f4c1356691f926} # was bal_v2m_s1 5d1f0ffb (half-space far field)
|
| 1467 |
- {name: bal_v2m_sf_s2, path: data_local/flagship_v4/hpc/runs/bal_v2m_sf_s2/model.pt, sha256: 1b55ded04fd624585eeeccf2ab6e4a8e9354a9b96694131e1737dde43ad3ff58} # was bal_v2m_s2 dcd14c61 (half-space far field)
|
| 1468 |
-
summary: "The Accurate recipe on
|
| 1469 |
own: # data_local/farfield_adopt/insample.json, bal_v2m_sf ensemble
|
| 1470 |
insample: {set: "in-sample, all 45,771 training layouts (TRAIN + VAL + the paper's test split; it was trained on them)", median_pct: 0.300, mae_ff: 0.0872, rmse_ff: 0.0999}
|
| 1471 |
reference:
|
|
@@ -1476,7 +1480,7 @@ flagship_tiers:
|
|
| 1476 |
time_space: "interdigital 0.29 s, xmon 0.51 s, 1-qubit lattice (N 15) 7.7 s, 16-conductor layout 2.4 s, 9-qubit lattice (N 67) 54 s (server time, one request, Docker build 2026-10-20; a repeated request is answered from the cache in ~0.01 s)"
|
| 1477 |
time_x86: "0.490 / 2.31 s in family, 1.00 / 10.0 s zero-shot (median / p90; x86 cluster, 2 CPUs); B5 0.56 s median"
|
| 1478 |
fast:
|
| 1479 |
-
title: "Fast (~0.1 s): learned prior
|
| 1480 |
paper_name: "Fast"
|
| 1481 |
route: "Fast"
|
| 1482 |
kind: gnn
|
|
@@ -1490,8 +1494,8 @@ flagship_tiers:
|
|
| 1490 |
learned_prior:
|
| 1491 |
name: sall_all_s0 # surrogate seed 0 by declaration (PROTOCOL.md section 3, amendment A1)
|
| 1492 |
checkpoint: {name: sall_all_s0, path: data_local/flagship_v4/hpc/sur/sall_all_s0/model.pt, sha256: 132d6f389eda798d31bd5654a96e24cce18fa750134a9fb2a9725eafed339dac}
|
| 1493 |
-
summary: "
|
| 1494 |
-
warning: "Use Fast only for quick screening of the component families it was trained on (interdigital, paddle, concentric, star, multipad star, Xmon, TransmonPocket, shielded concentric
|
| 1495 |
own: # data_local/flagship_v4/scores/tables.json pooled.fast_sall_all_s0_ens (agents/flagship_v4/RESULTS.md section 2)
|
| 1496 |
insample: {set: "in-sample, all 45,771 training layouts (TRAIN + VAL + the paper's test split; it was trained on them)", median_pct: 0.671, mae_ff: 0.353, rmse_ff: 0.395}
|
| 1497 |
reference:
|
|
|
|
| 1389 |
# layouts of one generated family, N 3-4, never seen by any component; RESULTS.md section 5). Numbers: layout-mean median relative error %
|
| 1390 |
# (MAE / RMSE fF) over mutual entries, 0.1 fF floor. Code path = the paper Space's (geomgnn.paper) through geomgnn.flagship.view.
|
| 1391 |
flagship_hub:
|
| 1392 |
+
public_link: SQuADDS/planar-capacitance # static Space, printed in the paper; opens the demo top-level (deploy/spaces/SQuADDS-planar-capacitance); never rename
|
| 1393 |
+
deploy_20261114: # public-demo limits + short card (no paper model); Docker SYSTEM=spaces so HF OAuth works
|
| 1394 |
+
commit: 4d44ef6cd727d4bd905c579e1882b2a99ec47423
|
| 1395 |
+
live: deploy/tests/results/flagship_space_live_limits20261114.json # examples x tiers vs Mac <= 1.1e-3 rel; anon non-example refused; oauth_token call ran
|
| 1396 |
space: shanto268/PlanarCapacitanceModel # the URL is kept; its earlier v3 tiers are archived (archive below)
|
| 1397 |
title: Planar Capacitance Model
|
| 1398 |
private: true # Spaces stay private (CLAUDE.md rule 11)
|
|
|
|
| 1431 |
|
| 1432 |
flagship_tiers:
|
| 1433 |
accurate:
|
| 1434 |
+
title: "Accurate (~1 s): the physics prior from two coarse solves, extrapolated and corrected by the networks"
|
| 1435 |
paper_name: "Accurate"
|
| 1436 |
route: "Accurate"
|
| 1437 |
kind: gnn
|
|
|
|
| 1443 |
- {name: acc_v2m_sf_s0, path: data_local/flagship_v4/hpc/runs/acc_v2m_sf_s0/model.pt, sha256: cc69c5818f5028c26177159b88239116520abbb290743d6a6c091657e8dbf1c5} # was acc_v2m_s0 56109a61 (half-space far field)
|
| 1444 |
- {name: acc_v2m_sf_s1, path: data_local/flagship_v4/hpc/runs/acc_v2m_sf_s1/model.pt, sha256: 2f88606dbec5c599550d088213a4c37af3b3ad5134ebad2e60519fb534553a57} # was acc_v2m_s1 ae9c4be5 (half-space far field)
|
| 1445 |
- {name: acc_v2m_sf_s2, path: data_local/flagship_v4/hpc/runs/acc_v2m_sf_s2/model.pt, sha256: d13bafc6b2eb7cadcd97a387d791c0210976db1a9d618f9acc1b614e3701daed} # was acc_v2m_s2 0841acc6 (half-space far field)
|
| 1446 |
+
summary: "Two thin-film method-of-moments solves at two mesh sizes, extrapolated, then corrected entry by entry by a graph neural network (three seeds, 89,858 parameters each, with a bounded correction) and a learned closure for the self terms. The output is the complete Maxwell matrix. Trained on all 45,771 of our Q3D designs."
|
| 1447 |
own: # this release's own numbers; its networks saw every row scored here except B5 (data_local/farfield_adopt/insample.json, acc_v2m_sf ensemble)
|
| 1448 |
insample: {set: "in-sample, all 45,771 training layouts (TRAIN + VAL + the paper's test split; it was trained on them)", median_pct: 0.207, mae_ff: 0.0679, rmse_ff: 0.0770}
|
| 1449 |
reference:
|
|
|
|
| 1457 |
time_space: "interdigital 0.47 s, xmon 0.91 s, 1-qubit lattice (N 15) 19.0 s, 16-conductor layout 9.9 s, 9-qubit lattice (N 67) 154 s (server time, one request, Docker build 2026-10-20; a repeated request is answered from the cache in ~0.01 s)"
|
| 1458 |
time_x86: "0.845 / 5.96 s in family, 1.75 / 18.1 s zero-shot (median / p90; x86 cluster, 2 CPUs); B5 0.99 s median (1.14 s on the 2026-10-20 re-run, Xeon E5-2640 v4)"
|
| 1459 |
balanced:
|
| 1460 |
+
title: "Balanced (~0.5 s): the same recipe on two coarser solves"
|
| 1461 |
paper_name: "Balanced"
|
| 1462 |
route: "Balanced"
|
| 1463 |
kind: gnn
|
|
|
|
| 1469 |
- {name: bal_v2m_sf_s0, path: data_local/flagship_v4/hpc/runs/bal_v2m_sf_s0/model.pt, sha256: aa742ab93b1e3ffcd86a753bda5cc4a68812acbe8140a6b0e311c11d1f36b4b2} # was bal_v2m_s0 50166723 (half-space far field)
|
| 1470 |
- {name: bal_v2m_sf_s1, path: data_local/flagship_v4/hpc/runs/bal_v2m_sf_s1/model.pt, sha256: 486466473eba61c090f4e3fa7988bf880fc183570c5d02bd78f4c1356691f926} # was bal_v2m_s1 5d1f0ffb (half-space far field)
|
| 1471 |
- {name: bal_v2m_sf_s2, path: data_local/flagship_v4/hpc/runs/bal_v2m_sf_s2/model.pt, sha256: 1b55ded04fd624585eeeccf2ab6e4a8e9354a9b96694131e1737dde43ad3ff58} # was bal_v2m_s2 dcd14c61 (half-space far field)
|
| 1472 |
+
summary: "The Accurate recipe on two coarser meshes, about half the solve time, with networks retrained for that pair on all 45,771 of our Q3D designs. About 2x faster than Accurate at 1.5-1.7x its error."
|
| 1473 |
own: # data_local/farfield_adopt/insample.json, bal_v2m_sf ensemble
|
| 1474 |
insample: {set: "in-sample, all 45,771 training layouts (TRAIN + VAL + the paper's test split; it was trained on them)", median_pct: 0.300, mae_ff: 0.0872, rmse_ff: 0.0999}
|
| 1475 |
reference:
|
|
|
|
| 1480 |
time_space: "interdigital 0.29 s, xmon 0.51 s, 1-qubit lattice (N 15) 7.7 s, 16-conductor layout 2.4 s, 9-qubit lattice (N 67) 54 s (server time, one request, Docker build 2026-10-20; a repeated request is answered from the cache in ~0.01 s)"
|
| 1481 |
time_x86: "0.490 / 2.31 s in family, 1.00 / 10.0 s zero-shot (median / p90; x86 cluster, 2 CPUs); B5 0.56 s median"
|
| 1482 |
fast:
|
| 1483 |
+
title: "Fast (~0.1 s): a learned prior replaces the solves (trained component families only)"
|
| 1484 |
paper_name: "Fast"
|
| 1485 |
route: "Fast"
|
| 1486 |
kind: gnn
|
|
|
|
| 1494 |
learned_prior:
|
| 1495 |
name: sall_all_s0 # surrogate seed 0 by declaration (PROTOCOL.md section 3, amendment A1)
|
| 1496 |
checkpoint: {name: sall_all_s0, path: data_local/flagship_v4/hpc/sur/sall_all_s0/model.pt, sha256: 132d6f389eda798d31bd5654a96e24cce18fa750134a9fb2a9725eafed339dac}
|
| 1497 |
+
summary: "A learned prior (1.02M parameters) predicts the two physics solves from the geometry, and the networks correct it. There is no field solve, so the time is the geometric embedding. The learned prior was trained on the physics prior of every Q3D design plus 432,697 generated layouts solved by the prior alone, and the networks on all 45,771 of our Q3D designs."
|
| 1498 |
+
warning: "Use Fast only for quick screening of the component families it was trained on (interdigital, paddle, concentric, star, multipad star, Xmon, TransmonPocket, shielded concentric and the generated layouts). On new designs of a trained family it was worse than the physics alone, 3.175 % (MAE 0.583 / RMSE 0.824 fF) against 1.765 % (0.275 / 0.376 fF). In the paper it was also worse than the physics alone on a component family held out of its training, 3.11 % (0.533 / 0.633 fF) against 1.55 % (0.166 / 0.205 fF). Use Accurate for anything that matters."
|
| 1499 |
own: # data_local/flagship_v4/scores/tables.json pooled.fast_sall_all_s0_ens (agents/flagship_v4/RESULTS.md section 2)
|
| 1500 |
insample: {set: "in-sample, all 45,771 training layouts (TRAIN + VAL + the paper's test split; it was trained on them)", median_pct: 0.671, mae_ff: 0.353, rmse_ff: 0.395}
|
| 1501 |
reference:
|