shanto268 commited on
Commit
95e723d
·
verified ·
1 Parent(s): f76c3bf

Planar Capacitance Model Space (QCap, QCap-Lite, QCap-Fast) from registry v2 (earlier contents: 906bc45ae05c)

Browse files
README.md CHANGED
@@ -7,19 +7,19 @@ sdk: docker
7
  app_port: 7860
8
  app_file: app.py
9
  pinned: false
10
- short_description: 'Maxwell capacitance of planar layouts: 3 tiers'
11
  hf_oauth: true
12
  ---
13
 
14
  # Planar Capacitance Model
15
 
16
- The model of our paper *A physics-corrected graph neural network for the capacitance matrix of any planar superconducting circuit layout*, trained on all 45,771 designs of our Q3D dataset, the test designs included. Upload a GDS layout and get the full Maxwell capacitance matrix of every conductor in it. Because the model has seen the test designs, it has no held-out score of its own. Its held-out accuracy, from the same model trained without the test designs, is in the paper.
17
 
18
  - **Paper page:** [lfl-lab.github.io/SQuADDS/ml-paper](https://lfl-lab.github.io/SQuADDS/ml-paper/), with the explainer videos and the [tutorials](https://lfl-lab.github.io/SQuADDS/ml-paper/#tutorials)
19
  - **Paper:** [lfl-lab.github.io/SQuADDS/ml-paper/paper](https://lfl-lab.github.io/SQuADDS/ml-paper/paper/)
20
  - **Code:** [github.com/LFL-Lab/SQuADDS](https://github.com/LFL-Lab/SQuADDS)
21
  - **Data:** [Q3D dataset](https://huggingface.co/datasets/SQuADDS/SQuADDS_PlanarCapacitance) and [synthetic dataset](https://huggingface.co/datasets/SQuADDS/SQuADDS_PlanarCapacitance-Synthetic), part of the [SQuADDS datasets](https://huggingface.co/collections/SQuADDS/squadds-datasets-6a65152b857f8efa5620880a)
22
- - **Models:** [flagship models](https://huggingface.co/SQuADDS/PlanarCapacitance-flagship), part of the [SQuADDS models](https://huggingface.co/collections/SQuADDS/squadds-models-6af8b7da67a22df62af374c6)
23
  - **API:** [SQuADDS ML inference API](https://huggingface.co/spaces/SQuADDS/squadds-ml-inference-api)
24
  - **Point of contact:** [Sadman Ahmed Shanto](mailto:shanto@usc.edu)
25
 
@@ -33,13 +33,13 @@ The model of our paper *A physics-corrected graph neural network for the capacit
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
 
44
  ## API
45
 
@@ -50,12 +50,12 @@ import os
50
  from gradio_client import Client, handle_file
51
 
52
  c = Client("shanto268/PlanarCapacitanceModel", oauth_token=os.environ["HF_TOKEN"]) # counts as you for the daily limit
53
- r = c.predict(handle_file("layout.gds"), "1/0", "1/10", 0, "Si (cryogenic, training)", 11.45, 350, "accurate",
54
  api_name="/predict_gds")
55
  print(r["names"], r["matrix_fF"], r["timing_s"]["total_s"])
56
  ```
57
 
58
- `model` is `accurate`, `balanced` or `fast`. When ground and conductors share a layer, pass the ground's piece numbers as the last argument (`ground_pieces`, for example `"1"` or `"1,4"`) if the automatic pick is wrong.
59
 
60
  ## Limits of this demo
61
 
 
7
  app_port: 7860
8
  app_file: app.py
9
  pinned: false
10
+ short_description: 'Maxwell capacitance of planar layouts: QCap models'
11
  hf_oauth: true
12
  ---
13
 
14
  # Planar Capacitance Model
15
 
16
+ The model of our paper *QCap: a physics-corrected graph neural network for the capacitance matrix of any planar superconducting device layout*, trained on all 45,771 designs of our Q3D dataset, the test designs included. Upload a GDS layout and get the full Maxwell capacitance matrix of every conductor in it. Because the model has seen the test designs, it has no held-out score of its own. Its held-out accuracy, from the same model trained without the test designs, is in the paper.
17
 
18
  - **Paper page:** [lfl-lab.github.io/SQuADDS/ml-paper](https://lfl-lab.github.io/SQuADDS/ml-paper/), with the explainer videos and the [tutorials](https://lfl-lab.github.io/SQuADDS/ml-paper/#tutorials)
19
  - **Paper:** [lfl-lab.github.io/SQuADDS/ml-paper/paper](https://lfl-lab.github.io/SQuADDS/ml-paper/paper/)
20
  - **Code:** [github.com/LFL-Lab/SQuADDS](https://github.com/LFL-Lab/SQuADDS)
21
  - **Data:** [Q3D dataset](https://huggingface.co/datasets/SQuADDS/SQuADDS_PlanarCapacitance) and [synthetic dataset](https://huggingface.co/datasets/SQuADDS/SQuADDS_PlanarCapacitance-Synthetic), part of the [SQuADDS datasets](https://huggingface.co/collections/SQuADDS/squadds-datasets-6a65152b857f8efa5620880a)
22
+ - **Models:** [QCap models](https://huggingface.co/SQuADDS/QCap) (QCap, QCap-Lite and QCap-Fast), part of the [SQuADDS models](https://huggingface.co/collections/SQuADDS/squadds-models-6af8b7da67a22df62af374c6)
23
  - **API:** [SQuADDS ML inference API](https://huggingface.co/spaces/SQuADDS/squadds-ml-inference-api)
24
  - **Point of contact:** [Sadman Ahmed Shanto](mailto:shanto@usc.edu)
25
 
 
33
 
34
  | model | how it works | error on 39 new layouts, % (MAE / RMSE, fF) | median time |
35
  |---|---|---|---|
36
+ | QCap (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
+ | QCap-Lite | the same recipe on two coarser solves | 2.044 (0.258 / 0.348) | 0.56 s |
38
+ | QCap-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
+ QCap-Fast is for quick screening of the component families it was trained on. Use QCap otherwise.
43
 
44
  ## API
45
 
 
50
  from gradio_client import Client, handle_file
51
 
52
  c = Client("shanto268/PlanarCapacitanceModel", oauth_token=os.environ["HF_TOKEN"]) # counts as you for the daily limit
53
+ r = c.predict(handle_file("layout.gds"), "1/0", "1/10", 0, "Si (cryogenic, training)", 11.45, 350, "QCap",
54
  api_name="/predict_gds")
55
  print(r["names"], r["matrix_fF"], r["timing_s"]["total_s"])
56
  ```
57
 
58
+ `model` is `QCap`, `QCap-Lite` or `QCap-Fast` (any case). When ground and conductors share a layer, pass the ground's piece numbers as the last argument (`ground_pieces`, for example `"1"` or `"1,4"`) if the automatic pick is wrong.
59
 
60
  ## Limits of this demo
61
 
app.py CHANGED
@@ -1,5 +1,5 @@
1
- """Flagship Space (deploy/GNN_SPACE.md "Flagship Space"): GDS -> full Maxwell capacitance matrix with three tiers (Accurate default,
2
- Balanced, Fast) retrained on all on-stack data, through geomgnn.flagship. Names, tiers and numbers come from registry.yaml
3
  (flagship_hub, flagship_tiers)."""
4
 
5
  import os
@@ -19,7 +19,7 @@ os.environ.setdefault("TLSQ_RESPONSE_CACHE", "64")
19
  os.environ.setdefault("TLSQ_RESPONSE_CACHE_MB", "1024")
20
  os.environ.setdefault("TLSQ_EMBED_CACHE", os.path.join(os.environ.get("TMPDIR", "/tmp"), "tlsq_embed_cache"))
21
  os.environ.setdefault("TLSQ_EMBED_CACHE_MB", "1024")
22
- os.environ.setdefault("TLSQ_PRIOR_LEVEL_CACHE_MB", "256") # solved prior levels (Accurate and Balanced share 1.5) and meshes (substrate changes)
23
  os.environ.pop("TLSQ_GNN_PRIOR_MODE", None) # every tier names its own solver mode (registry flagship_hub.prior_stacks)
24
 
25
  HERE = Path(__file__).resolve().parent
@@ -76,7 +76,7 @@ def _preload_background():
76
 
77
 
78
  def bake():
79
- """Image build (warm.py, after the import's preload): every example x tier into the response cache, pickled to BAKE."""
80
  return G.bake(ex, BAKE)
81
 
82
 
 
1
+ """Flagship Space (deploy/GNN_SPACE.md "Flagship Space"): GDS -> full Maxwell capacitance matrix with three models (QCap default,
2
+ QCap-Lite, QCap-Fast) retrained on all on-stack data, through geomgnn.flagship. Names, tiers and numbers come from registry.yaml
3
  (flagship_hub, flagship_tiers)."""
4
 
5
  import os
 
19
  os.environ.setdefault("TLSQ_RESPONSE_CACHE_MB", "1024")
20
  os.environ.setdefault("TLSQ_EMBED_CACHE", os.path.join(os.environ.get("TMPDIR", "/tmp"), "tlsq_embed_cache"))
21
  os.environ.setdefault("TLSQ_EMBED_CACHE_MB", "1024")
22
+ os.environ.setdefault("TLSQ_PRIOR_LEVEL_CACHE_MB", "256") # solved prior levels (QCap and QCap-Lite share 1.5) and meshes (substrate changes)
23
  os.environ.pop("TLSQ_GNN_PRIOR_MODE", None) # every tier names its own solver mode (registry flagship_hub.prior_stacks)
24
 
25
  HERE = Path(__file__).resolve().parent
 
76
 
77
 
78
  def bake():
79
+ """Image build (warm.py, after the import's preload): every example x model into the response cache, pickled to BAKE."""
80
  return G.bake(ex, BAKE)
81
 
82
 
geomgnn/api.py CHANGED
@@ -53,9 +53,9 @@ CALIBRATED_SCORE = ("On 15 held-out designs the mutual entries were within 0.21-
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
 
@@ -483,7 +483,7 @@ def physical_warning(chk: dict, C: np.ndarray) -> str | None:
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,
 
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 = ("QCap-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 QCap 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
 
 
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 QCap, 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
@@ -1,13 +1,13 @@
1
- """Gradio front end of the flagship Space (deploy/GNN_SPACE.md "Flagship Space"; registry flagship_hub, flagship_tiers): three tiers in
2
- one selector (Accurate default, Balanced, Fast), served through geomgnn.flagship (= the paper Space's code path). Endpoints and argument
3
  order as the GNN Space:
4
 
5
- /models () -> served tiers with their reference numbers
6
  /inspect (gds file) -> layer table, layer plot
7
  /prepare (gds, layers table, crop, margin_gaps, margin_um, select) -> preview, warnings, summary, simplified GDS
8
  /predict (gds, layers table, crop, margin_gaps, margin_um, select, substrate, custom_eps, thickness_um, model) -> matrix, CSV, JSON, report
9
  /predict_gds (gds, ground "1/0", conductor "1/10", margin_gaps, substrate, custom_eps, thickness_um, model, ground_pieces "") -> result dict;
10
- model = accurate (default) | balanced | fast; ground_pieces = e.g. "1,4" when ground and conductors share one layer
11
  (default "": detected automatically, see result warnings / layout info)
12
 
13
  Every endpoint and the UI share the demo's limits (geomgnn.access): anonymous visitors run the bundled examples only, a signed-in user
@@ -54,11 +54,19 @@ def served(reg=None) -> list[str]:
54
  return sorted(ks, key=lambda k: ORDER.index(k) if k in ORDER else len(ORDER))
55
 
56
 
 
 
 
 
 
57
  def resolve(reg, model) -> str:
58
- m = str(model or reg["flagship_hub"]["default_arm"]).strip().lower()
59
- if m not in served(reg):
60
- raise ValueError(f"Model {model!r} is not available here. Choose one of {served(reg)}.")
61
- return m
 
 
 
62
 
63
 
64
  def tiers_md(reg) -> str:
@@ -91,7 +99,7 @@ def check_thickness(thickness_um) -> float:
91
 
92
  def settings(reg, name, substrate, thickness_um) -> tuple:
93
  """The response-cache settings of a request (with the prepared layout, the cache key)."""
94
- return ("flagship", name, str(substrate), float(thickness_um), reg["version"])
95
 
96
 
97
  def _predict(lay, model, substrate, thickness_um, w=None, own=False):
@@ -216,7 +224,7 @@ def _api_layout(f, ground_layers="1/0", conductor_layers="1/10", margin_gaps=0.0
216
 
217
 
218
  def api_predict_gds(f, ground_layers="1/0", conductor_layers="1/10", margin_gaps=0.0, substrate=SI,
219
- custom_eps=11.45, thickness_um=350.0, model="accurate", ground_pieces="", profile: gr.OAuthProfile | None = None,
220
  oauth_token: gr.OAuthToken | None = None, request: gr.Request = None):
221
  t = time.perf_counter()
222
  lay, res = _served(AC.who(profile, request, oauth_token), f, lambda: _api_layout(f, ground_layers, conductor_layers, margin_gaps,
@@ -228,7 +236,7 @@ def api_predict_gds(f, ground_layers="1/0", conductor_layers="1/10", margin_gaps
228
 
229
 
230
  def bake(examples_dir, path) -> dict:
231
- """Image build: every bundled example x tier on the training stack, through /predict_gds and the UI Predict path (an example click),
232
  into the response cache, pickled to path. Both paths prepare the same layout, so they share one entry per example and tier."""
233
  from . import respcache
234
  reg = load_registry()
@@ -236,9 +244,9 @@ def bake(examples_dir, path) -> dict:
236
  for f in sorted(Path(examples_dir).glob("*.gds")):
237
  table = inspect_fn(str(f))[0]
238
  gstate = GU.check_fn(str(f), table)[4]
239
- for tier in served(reg):
240
- api_predict_gds(str(f), model=tier)
241
- predict_fn(str(f), table, False, 0, None, "", SI, 11.45, 350, tier, gstate)
242
  out = {"entries": respcache.dump(path), "s": round(time.perf_counter() - t, 1)}
243
  print("bake " + json.dumps(out), flush=True)
244
  return out
@@ -260,7 +268,7 @@ def load_bake(path, examples_dir) -> dict:
260
  lay = _api_layout(str(Path(examples_dir) / "interdigital.gds"))
261
  old = baked.get(respcache.key(lay, *settings(reg, tier, SI, 350.0)), (None,))[0]
262
  if old is None or not _same(old, FS.predict(lay, tier, reg, substrate=SI, thickness_um=350.0)):
263
- out = {"bake": "dropped", "reason": f"interdigital / {tier} differs from the baked result", "s": time.perf_counter() - t}
264
  break
265
  else:
266
  out = {"bake": "loaded", "entries": len(items), "cache_entries": respcache.put_many(items), "s": time.perf_counter() - t}
@@ -274,14 +282,15 @@ def models_fn():
274
  out = []
275
  for k in served(reg):
276
  t = FS.tiers(reg)[k]
277
- out.append({"id": k, "title": t["title"], "summary": t.get("summary"), "warning": t.get("warning"),
278
  "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"),
279
  "stack": t.get("stack"), "levels_ppg": [float(p) for p in t.get("ppg") or []], "default": k == h["default_arm"],
280
  "max_conductors": int(h["max_conductors"]), "limits": limits()})
281
  from . import paper as PA
282
  return out + [{"geomgnn_version": __version__, "tlsq_infer_version": TLSQ_VERSION, "registry_version": reg["version"],
283
  "training_layouts": h.get("training_layouts"),
284
- "startup": dict(PA.STARTUP), "packages": packages()}]
 
285
 
286
 
287
  def packages() -> dict:
@@ -316,7 +325,7 @@ PRIVACY_MD = ("We process uploaded layouts in memory and keep them there only wh
316
  VIEWS = ["Layers", "Nets"]
317
  EXAMPLE_NAMES = {"interdigital.gds": "interdigital capacitor", "lattice_1q.gds": "one-qubit grid", "lattice_5q.gds": "five-qubit grid",
318
  "shielded_concentric.gds": "shielded concentric", "transmon_pocket.gds": "TransmonPocket", "xmon.gds": "Xmon"}
319
- EXAMPLE_NOTES = {"lattice_1q.gds": "≈20 s on Accurate", "lattice_5q.gds": "≈20 s on Accurate"}
320
  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), "
321
  "`conductor` for metal islands (each connected body is one net, C1, C2, …), `ground+conductor` when both are on one layer "
322
  "(we then find the ground) and `ignore` for markers, junctions and labels. By default 1/0 is ground and 1/10 is conductor.")
@@ -325,7 +334,7 @@ LAYER_HELP = ("Set the role of each layer by picking it from the list or clickin
325
  def about_md(reg) -> str:
326
  h = reg["flagship_hub"]
327
 
328
- 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.
329
 
330
 
331
 
@@ -336,12 +345,12 @@ You can also call the demo from Python with gradio_client. "Use via API" at the
336
  ```python
337
  from gradio_client import Client, handle_file
338
  c = Client("{h['space']}", token=HF_TOKEN, oauth_token=HF_TOKEN) # token while the Space is private, oauth_token signs you in (your own layouts)
339
- r = c.predict(handle_file("layout.gds"), "1/0", "1/10", 0, "Si (cryogenic, training)", 11.45, 350, "{h['default_arm']}",
340
  api_name="/predict_gds")
341
  r["names"], r["matrix_fF"]
342
  ```
343
 
344
- 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).
345
 
346
  {PRIVACY_MD}
347
 
@@ -501,8 +510,8 @@ def stack_note(reg, substrate, custom_eps, thickness) -> str:
501
  if on:
502
  return ""
503
  return UI.callout("warn", "Off the training stack (Si, eps_r 11.45, 350 µm)", [
504
- f"Accurate and Balanced solve the physics prior at your stack, and the networks correct it unchanged. We tested this on "
505
- f"{A.TESTED_RANGE}. Fast only rescales its prediction, and it tells you so."])
506
 
507
 
508
  def _api(fn, n_out):
@@ -514,11 +523,11 @@ def build_app(title: str, examples_dir=None):
514
  reg = load_registry()
515
  subs = list(reg.substrates()) + [CUSTOM]
516
  ms = served(reg)
517
- default = reg["flagship_hub"]["default_arm"]
518
  ex = sorted(Path(examples_dir).glob("*.gds")) if examples_dir and Path(examples_dir).exists() else []
519
  AC.register_examples(ex)
520
  usage_stats()
521
- label = {"accurate": "Accurate (≈1 s, default)", "balanced": "Balanced (≈0.5 s)", "fast": "Fast (≈0.1 s, trained families only)"}
522
  with UI.blocks(title, delete_cache=(60, PURGE_AGE_S)) as demo:
523
  gr.HTML(UI.header(reg["flagship_hub"]["title"], LEDE), container=False, padding=False, elem_classes="tl-flush")
524
  with gr.Row():
@@ -558,7 +567,7 @@ def build_app(title: str, examples_dir=None):
558
  gparts = GU.build()
559
  gst = gparts[0]
560
  with gr.Row(equal_height=False):
561
- model = gr.Radio([(label.get(k, k), k) for k in ms], value=default, label="Model", interactive=True, elem_id="tl-tier",
562
  scale=3, min_width=300)
563
  substrate = gr.Dropdown(subs, value=subs[0], label="Substrate", scale=2, min_width=220)
564
  custom_eps = gr.Number(value=11.45, label="eps_r", visible=False, scale=1, min_width=110)
@@ -567,8 +576,8 @@ def build_app(title: str, examples_dir=None):
567
  with gr.Accordion("Models and their accuracy", open=False):
568
  gr.Markdown(tiers_md(reg))
569
  if "fast" in ms:
570
- gr.Markdown("Use Fast only for quick screening of the component families it was trained on. On new designs it did "
571
- "worse than the physics alone (see the table above), so use Accurate for anything that matters.")
572
  pred_btn = gr.Button("Predict", variant="primary")
573
  status = gr.HTML(elem_classes="tl-flush")
574
  with gr.Column(visible=False) as result_box, gr.Row():
@@ -591,6 +600,7 @@ def build_app(title: str, examples_dir=None):
591
  a_c = gr.Textbox("1/10")
592
  a_m = gr.Number(0)
593
  a_gp = gr.Textbox("")
 
594
  a_out = gr.JSON()
595
  a_btn = gr.Button("api")
596
  m_btn = gr.Button("models")
@@ -605,9 +615,10 @@ def build_app(title: str, examples_dir=None):
605
  prepared_gds = gr.File()
606
  pins = [gds, layers, crop, margin, margin_um, select, substrate, custom_eps, thickness, model, gst]
607
  pouts = [mat, csv_f, json_f, report, res_state]
 
608
  vin = [view, vst, gds, layers, crop, margin, margin_um, select, gst]
609
  vout = [img, svg_btn, view_msg, vst]
610
- ui_predict = functools.wraps(predict_fn)(UI.predict_ui(predict_fn, lambda r: expected(reg, r["tier"]), note=True))
611
  ui_predict.__name__ = "predict_fn_ui"
612
  uouts = pouts + [status, result_box, mat_note]
613
  light = dict(concurrency_id="light", concurrency_limit=1) # previews and file handling: never queued behind a solve
@@ -630,9 +641,9 @@ def build_app(title: str, examples_dir=None):
630
  for ev in (crop.change, margin.change, margin_um.change, select.change):
631
  ev(preview_fn, vin, [view] + vout, trigger_mode="always_last", **hidden)
632
  pred_btn.click(ui_predict, pins, uouts, api_visibility="private", **solve)
633
- p_btn.click(_api(predict_fn, 5), pins, pouts, api_name="predict", **solve)
634
  UI.mark_stale(res_state, status, mat, report, [gds.change, model.change, substrate.change, custom_eps.change, thickness.change,
635
  select.change, crop.change, margin.change, margin_um.change, edit.then])
636
- a_btn.click(_api(api_predict_gds, 1), [gds, a_g, a_c, a_m, substrate, custom_eps, thickness, model, a_gp], a_out, api_name="predict_gds", **solve)
637
  m_btn.click(models_fn, None, m_out, api_name="models", **light)
638
  return demo
 
1
+ """Gradio front end of the flagship Space (deploy/GNN_SPACE.md "Flagship Space"; registry flagship_hub, flagship_tiers): three models in
2
+ one selector (QCap default, QCap-Lite, QCap-Fast), served through geomgnn.flagship (= the paper Space's code path). Endpoints and argument
3
  order as the GNN Space:
4
 
5
+ /models () -> served models with their reference numbers
6
  /inspect (gds file) -> layer table, layer plot
7
  /prepare (gds, layers table, crop, margin_gaps, margin_um, select) -> preview, warnings, summary, simplified GDS
8
  /predict (gds, layers table, crop, margin_gaps, margin_um, select, substrate, custom_eps, thickness_um, model) -> matrix, CSV, JSON, report
9
  /predict_gds (gds, ground "1/0", conductor "1/10", margin_gaps, substrate, custom_eps, thickness_um, model, ground_pieces "") -> result dict;
10
+ model = QCap (default) | QCap-Lite | QCap-Fast (any case, "-" or "_"); ground_pieces = e.g. "1,4" when ground and conductors share one layer
11
  (default "": detected automatically, see result warnings / layout info)
12
 
13
  Every endpoint and the UI share the demo's limits (geomgnn.access): anonymous visitors run the bundled examples only, a signed-in user
 
54
  return sorted(ks, key=lambda k: ORDER.index(k) if k in ORDER else len(ORDER))
55
 
56
 
57
+ def names(reg) -> list[str]:
58
+ """The served models' names (QCap, QCap-Lite, QCap-Fast), default first."""
59
+ return [FS.name(reg, k) for k in served(reg)]
60
+
61
+
62
  def resolve(reg, model) -> str:
63
+ """Tier key of a model name (QCap / QCap-Lite / QCap-Fast, any case; empty = the default)."""
64
+ if not str(model or "").strip():
65
+ return reg["flagship_hub"]["default_arm"]
66
+ k = FS.key(reg, model)
67
+ if k not in served(reg):
68
+ raise ValueError(f"Model {model!r} is not available here. Choose one of {', '.join(names(reg))}.")
69
+ return k
70
 
71
 
72
  def tiers_md(reg) -> str:
 
99
 
100
  def settings(reg, name, substrate, thickness_um) -> tuple:
101
  """The response-cache settings of a request (with the prepared layout, the cache key)."""
102
+ return ("qcap", FS.name(reg, name), str(substrate), float(thickness_um), reg["version"])
103
 
104
 
105
  def _predict(lay, model, substrate, thickness_um, w=None, own=False):
 
224
 
225
 
226
  def api_predict_gds(f, ground_layers="1/0", conductor_layers="1/10", margin_gaps=0.0, substrate=SI,
227
+ custom_eps=11.45, thickness_um=350.0, model="QCap", ground_pieces="", profile: gr.OAuthProfile | None = None,
228
  oauth_token: gr.OAuthToken | None = None, request: gr.Request = None):
229
  t = time.perf_counter()
230
  lay, res = _served(AC.who(profile, request, oauth_token), f, lambda: _api_layout(f, ground_layers, conductor_layers, margin_gaps,
 
236
 
237
 
238
  def bake(examples_dir, path) -> dict:
239
+ """Image build: every bundled example x model on the training stack, through /predict_gds and the UI Predict path (an example click),
240
  into the response cache, pickled to path. Both paths prepare the same layout, so they share one entry per example and tier."""
241
  from . import respcache
242
  reg = load_registry()
 
244
  for f in sorted(Path(examples_dir).glob("*.gds")):
245
  table = inspect_fn(str(f))[0]
246
  gstate = GU.check_fn(str(f), table)[4]
247
+ for m in names(reg):
248
+ api_predict_gds(str(f), model=m)
249
+ predict_fn(str(f), table, False, 0, None, "", SI, 11.45, 350, m, gstate)
250
  out = {"entries": respcache.dump(path), "s": round(time.perf_counter() - t, 1)}
251
  print("bake " + json.dumps(out), flush=True)
252
  return out
 
268
  lay = _api_layout(str(Path(examples_dir) / "interdigital.gds"))
269
  old = baked.get(respcache.key(lay, *settings(reg, tier, SI, 350.0)), (None,))[0]
270
  if old is None or not _same(old, FS.predict(lay, tier, reg, substrate=SI, thickness_um=350.0)):
271
+ out = {"bake": "dropped", "reason": f"interdigital / {FS.name(reg, tier)} differs from the baked result", "s": time.perf_counter() - t}
272
  break
273
  else:
274
  out = {"bake": "loaded", "entries": len(items), "cache_entries": respcache.put_many(items), "s": time.perf_counter() - t}
 
282
  out = []
283
  for k in served(reg):
284
  t = FS.tiers(reg)[k]
285
+ out.append({"id": t["paper_name"], "title": t["title"], "summary": t.get("summary"), "warning": t.get("warning"),
286
  "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"),
287
  "stack": t.get("stack"), "levels_ppg": [float(p) for p in t.get("ppg") or []], "default": k == h["default_arm"],
288
  "max_conductors": int(h["max_conductors"]), "limits": limits()})
289
  from . import paper as PA
290
  return out + [{"geomgnn_version": __version__, "tlsq_infer_version": TLSQ_VERSION, "registry_version": reg["version"],
291
  "training_layouts": h.get("training_layouts"),
292
+ "startup": dict(PA.STARTUP, **({"default": FS.name(reg, PA.STARTUP["default"])} if PA.STARTUP.get("default") in FS.tiers(reg) else {})),
293
+ "packages": packages()}]
294
 
295
 
296
  def packages() -> dict:
 
325
  VIEWS = ["Layers", "Nets"]
326
  EXAMPLE_NAMES = {"interdigital.gds": "interdigital capacitor", "lattice_1q.gds": "one-qubit grid", "lattice_5q.gds": "five-qubit grid",
327
  "shielded_concentric.gds": "shielded concentric", "transmon_pocket.gds": "TransmonPocket", "xmon.gds": "Xmon"}
328
+ EXAMPLE_NOTES = {"lattice_1q.gds": "≈20 s on QCap", "lattice_5q.gds": "≈20 s on QCap"}
329
  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), "
330
  "`conductor` for metal islands (each connected body is one net, C1, C2, …), `ground+conductor` when both are on one layer "
331
  "(we then find the ground) and `ignore` for markers, junctions and labels. By default 1/0 is ground and 1/10 is conductor.")
 
334
  def about_md(reg) -> str:
335
  h = reg["flagship_hub"]
336
 
337
+ 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 (QCap-Fast learns it instead) and corrects it with networks trained on Q3D simulations. This is a private preview while the paper is in preparation.
338
 
339
 
340
 
 
345
  ```python
346
  from gradio_client import Client, handle_file
347
  c = Client("{h['space']}", token=HF_TOKEN, oauth_token=HF_TOKEN) # token while the Space is private, oauth_token signs you in (your own layouts)
348
+ r = c.predict(handle_file("layout.gds"), "1/0", "1/10", 0, "Si (cryogenic, training)", 11.45, 350, "{FS.name(reg, h['default_arm'])}",
349
  api_name="/predict_gds")
350
  r["names"], r["matrix_fF"]
351
  ```
352
 
353
+ 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(names(reg))}, in any case) and the ground pieces ("" picks them automatically when ground and conductors share a layer).
354
 
355
  {PRIVACY_MD}
356
 
 
510
  if on:
511
  return ""
512
  return UI.callout("warn", "Off the training stack (Si, eps_r 11.45, 350 µm)", [
513
+ f"QCap and QCap-Lite solve the physics prior at your stack, and the networks correct it unchanged. We tested this on "
514
+ f"{A.TESTED_RANGE}. QCap-Fast only rescales its prediction, and it tells you so."])
515
 
516
 
517
  def _api(fn, n_out):
 
523
  reg = load_registry()
524
  subs = list(reg.substrates()) + [CUSTOM]
525
  ms = served(reg)
526
+ default = FS.name(reg, reg["flagship_hub"]["default_arm"])
527
  ex = sorted(Path(examples_dir).glob("*.gds")) if examples_dir and Path(examples_dir).exists() else []
528
  AC.register_examples(ex)
529
  usage_stats()
530
+ label = {"accurate": "QCap (≈1 s, default)", "balanced": "QCap-Lite (≈0.5 s)", "fast": "QCap-Fast (≈0.1 s, trained families only)"}
531
  with UI.blocks(title, delete_cache=(60, PURGE_AGE_S)) as demo:
532
  gr.HTML(UI.header(reg["flagship_hub"]["title"], LEDE), container=False, padding=False, elem_classes="tl-flush")
533
  with gr.Row():
 
567
  gparts = GU.build()
568
  gst = gparts[0]
569
  with gr.Row(equal_height=False):
570
+ model = gr.Radio([(label.get(k, FS.name(reg, k)), FS.name(reg, k)) for k in ms], value=default, label="Model", interactive=True, elem_id="tl-tier",
571
  scale=3, min_width=300)
572
  substrate = gr.Dropdown(subs, value=subs[0], label="Substrate", scale=2, min_width=220)
573
  custom_eps = gr.Number(value=11.45, label="eps_r", visible=False, scale=1, min_width=110)
 
576
  with gr.Accordion("Models and their accuracy", open=False):
577
  gr.Markdown(tiers_md(reg))
578
  if "fast" in ms:
579
+ gr.Markdown("Use QCap-Fast only for quick screening of the component families it was trained on. On new designs it did "
580
+ "worse than the physics alone (see the table above), so use QCap for anything that matters.")
581
  pred_btn = gr.Button("Predict", variant="primary")
582
  status = gr.HTML(elem_classes="tl-flush")
583
  with gr.Column(visible=False) as result_box, gr.Row():
 
600
  a_c = gr.Textbox("1/10")
601
  a_m = gr.Number(0)
602
  a_gp = gr.Textbox("")
603
+ a_model = gr.Textbox(default) # API model argument: any case of QCap / QCap-Lite / QCap-Fast (a Radio takes exact choices only)
604
  a_out = gr.JSON()
605
  a_btn = gr.Button("api")
606
  m_btn = gr.Button("models")
 
615
  prepared_gds = gr.File()
616
  pins = [gds, layers, crop, margin, margin_um, select, substrate, custom_eps, thickness, model, gst]
617
  pouts = [mat, csv_f, json_f, report, res_state]
618
+ api_pins = [a_model if x is model else x for x in pins]
619
  vin = [view, vst, gds, layers, crop, margin, margin_um, select, gst]
620
  vout = [img, svg_btn, view_msg, vst]
621
+ ui_predict = functools.wraps(predict_fn)(UI.predict_ui(predict_fn, lambda r: expected(reg, FS.key(reg, r["tier"])), note=True))
622
  ui_predict.__name__ = "predict_fn_ui"
623
  uouts = pouts + [status, result_box, mat_note]
624
  light = dict(concurrency_id="light", concurrency_limit=1) # previews and file handling: never queued behind a solve
 
641
  for ev in (crop.change, margin.change, margin_um.change, select.change):
642
  ev(preview_fn, vin, [view] + vout, trigger_mode="always_last", **hidden)
643
  pred_btn.click(ui_predict, pins, uouts, api_visibility="private", **solve)
644
+ p_btn.click(_api(predict_fn, 5), api_pins, pouts, api_name="predict", **solve)
645
  UI.mark_stale(res_state, status, mat, report, [gds.change, model.change, substrate.change, custom_eps.change, thickness.change,
646
  select.change, crop.change, margin.change, margin_um.change, edit.then])
647
+ a_btn.click(_api(api_predict_gds, 1), [gds, a_g, a_c, a_m, substrate, custom_eps, thickness, a_model, a_gp], a_out, api_name="predict_gds", **solve)
648
  m_btn.click(models_fn, None, m_out, api_name="models", **light)
649
  return demo
geomgnn/flagship.py CHANGED
@@ -1,5 +1,9 @@
1
  """Flagship Space tiers (deploy/registry.yaml: flagship_hub, flagship_tiers; deploy/GNN_SPACE.md "Flagship Space").
2
 
 
 
 
 
3
  The tiers run through the paper Space's code path (geomgnn.paper: scene -> embedding -> priors under the tier's prior stack, or the
4
  learned prior surrogate -> networks), unchanged. `view(reg)` is the registry seen with paper_arms / paper_hub replaced by
5
  flagship_tiers / flagship_hub, so every geomgnn.paper function serves the tiers as arms.
@@ -29,13 +33,35 @@ def served(reg) -> list[str]:
29
  return [k for k in PA.live(v) if PA.available(k, v)]
30
 
31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  def predict(prepared, tier, reg, **kw) -> dict:
33
- """Full N x N Maxwell matrix (fF; ground row/column 0) of a prepared layout with a flagship tier (geomgnn.paper.predict)."""
 
34
  v = view(reg)
 
35
  res = PA.predict(prepared, tier, v, **kw)
36
  t = v["paper_arms"][tier]
37
  res.pop("paper", None)
38
- res.update(tier=tier, tier_title=t["title"], reference=t.get("reference") or {}, own=t.get("own") or {}, b5=t.get("b5"), b5_physics=t.get("b5_physics"))
 
 
39
  return res
40
 
41
 
 
1
  """Flagship Space tiers (deploy/registry.yaml: flagship_hub, flagship_tiers; deploy/GNN_SPACE.md "Flagship Space").
2
 
3
+ The tiers are the models QCap (default), QCap-Lite and QCap-Fast (registry paper_name; handoff/squadds_integration/RENAME_QCAP.md).
4
+ Their registry keys (accurate, balanced, fast) stay internal: model folders, checkpoints and the paper code path use them; every
5
+ result, label and API argument uses the model names (case-insensitive, "-" and "_" interchangeable).
6
+
7
  The tiers run through the paper Space's code path (geomgnn.paper: scene -> embedding -> priors under the tier's prior stack, or the
8
  learned prior surrogate -> networks), unchanged. `view(reg)` is the registry seen with paper_arms / paper_hub replaced by
9
  flagship_tiers / flagship_hub, so every geomgnn.paper function serves the tiers as arms.
 
33
  return [k for k in PA.live(v) if PA.available(k, v)]
34
 
35
 
36
+ def name(reg, tier) -> str:
37
+ """Model name (QCap, QCap-Lite, QCap-Fast) of a tier key."""
38
+ return tiers(reg)[tier]["paper_name"]
39
+
40
+
41
+ def _norm(s) -> str:
42
+ return str(s).strip().lower().replace("_", "-")
43
+
44
+
45
+ def key(reg, model) -> str:
46
+ """Tier key of a model name (case-insensitive, "-" and "_" interchangeable); ValueError naming the models otherwise."""
47
+ ts = tiers(reg)
48
+ k = next((k for k in ts if _norm(ts[k]["paper_name"]) == _norm(model)), None)
49
+ if k is None:
50
+ raise ValueError(f"Unknown model {model!r}. Choose one of {', '.join(ts[k]['paper_name'] for k in served(reg))}.")
51
+ return k
52
+
53
+
54
  def predict(prepared, tier, reg, **kw) -> dict:
55
+ """Full N x N Maxwell matrix (fF; ground row/column 0) of a prepared layout with a flagship tier (geomgnn.paper.predict).
56
+ tier: a tier key or a model name; the result names the model (model, arm, tier = QCap / QCap-Lite / QCap-Fast)."""
57
  v = view(reg)
58
+ tier = tier if tier in v["paper_arms"] else key(reg, tier)
59
  res = PA.predict(prepared, tier, v, **kw)
60
  t = v["paper_arms"][tier]
61
  res.pop("paper", None)
62
+ n = t["paper_name"]
63
+ res.update(model=n, arm=n, tier=n, tier_title=t["title"], reference=t.get("reference") or {}, own=t.get("own") or {}, b5=t.get("b5"),
64
+ b5_physics=t.get("b5_physics"))
65
  return res
66
 
67
 
geomgnn/ui.py CHANGED
@@ -246,7 +246,7 @@ def _offstack(res) -> str:
246
  if sub.get("route") == A.FAST_ROUTE:
247
  return (f"Substrate eps_r {e:g}, {t:g} µm. This model does not solve the physics prior at your stack. It rescales its "
248
  f"training-stack prediction by (1 + eps_r) / (1 + 11.45) = {sub['eps_rescale_factor']:.4f} and does not model thickness. "
249
- "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.")
250
  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 "
251
  "11.45, 350 µm) are unchanged.")
252
  if not sub.get("tested", True):
 
246
  if sub.get("route") == A.FAST_ROUTE:
247
  return (f"Substrate eps_r {e:g}, {t:g} µm. This model does not solve the physics prior at your stack. It rescales its "
248
  f"training-stack prediction by (1 + eps_r) / (1 + 11.45) = {sub['eps_rescale_factor']:.4f} and does not model thickness. "
249
+ "Off the training stack we measured a median error of 6.4 % (MAE 1.7 fF, RMSE 2.4 fF), so use QCap for other substrates.")
250
  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 "
251
  "11.45, 350 µm) are unchanged.")
252
  if not sub.get("tested", True):
models/accurate/info.json CHANGED
@@ -1,5 +1,6 @@
1
  {
2
  "name": "accurate",
 
3
  "kind": "gnn",
4
  "checkpoints": [
5
  "acc_v2m_sf_s0.pt",
 
1
  {
2
  "name": "accurate",
3
+ "model": "QCap",
4
  "kind": "gnn",
5
  "checkpoints": [
6
  "acc_v2m_sf_s0.pt",
models/balanced/info.json CHANGED
@@ -1,5 +1,6 @@
1
  {
2
  "name": "balanced",
 
3
  "kind": "gnn",
4
  "checkpoints": [
5
  "bal_v2m_sf_s0.pt",
 
1
  {
2
  "name": "balanced",
3
+ "model": "QCap-Lite",
4
  "kind": "gnn",
5
  "checkpoints": [
6
  "bal_v2m_sf_s0.pt",
models/fast/info.json CHANGED
@@ -1,5 +1,6 @@
1
  {
2
  "name": "fast",
 
3
  "kind": "gnn",
4
  "checkpoints": [
5
  "acc_v1_s0.pt",
 
1
  {
2
  "name": "fast",
3
+ "model": "QCap-Fast",
4
  "kind": "gnn",
5
  "checkpoints": [
6
  "acc_v1_s0.pt",
registry.yaml CHANGED
@@ -1393,6 +1393,15 @@ flagship_hub:
1393
  deploy_20261114: # public-demo limits + short card (no paper model); Docker SYSTEM=spaces so HF OAuth works
1394
  commit: 142609ed7021861aea2be8ee5f51594b70e5918b # + text in the author's voice, Fast in the selector, Model not Tier, footer (was 4d44ef6)
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)
@@ -1408,6 +1417,16 @@ flagship_hub:
1408
  SQuADDS/SQuADDS_PlanarCapacitance-heldout: c538385b3e8d48f4183b68d00e376a06762b0705
1409
  SQuADDS/PlanarCapacitance-flagship: a89f30850b638da1f693042b7d7cf14f20b19098 # + balanced/bal_v2m_sf_s{0,1,2}.pt (same sha256 as the Space) and SHA256SUMS
1410
  not_pushed: [SQuADDS/PlanarCapacitance-paper, shanto268/PlanarCapacitanceModel] # drafts in handoff/hf_cards/; author 2026-11-14: these stay private
 
 
 
 
 
 
 
 
 
 
1411
  training_layouts: 45771
1412
  archive:
1413
  space: shanto268/PlanarCapacitanceModel
@@ -1431,9 +1450,9 @@ flagship_hub:
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
1438
  arm: full_gnn
1439
  embedding: {far_k: 64, d_far_um: 100.0} # agents/embedspeed Part A (PROTOCOL.md amendment 2): far-sample decimation F64 of the pair vectors, the fastest arm tying the exact embedding on validation 4,608 and the 1q / 5q / 9q lattices; the paper Space keeps the exact embedding
@@ -1457,9 +1476,9 @@ flagship_tiers:
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
1464
  arm: full_gnn
1465
  embedding: {far_k: 64, d_far_um: 100.0} # agents/embedspeed Part A (PROTOCOL.md amendment 2): far-sample decimation F64 of the pair vectors, the fastest arm tying the exact embedding on validation 4,608 and the 1q / 5q / 9q lattices; the paper Space keeps the exact embedding
@@ -1469,7 +1488,7 @@ flagship_tiers:
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,9 +1499,9 @@ flagship_tiers:
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
1487
  arm: full_gnn
1488
  embedding: {far_k: 64, d_far_um: 100.0} # agents/embedspeed Part A (PROTOCOL.md amendment 2): far-sample decimation F64 of the pair vectors, the fastest arm tying the exact embedding on validation 4,608 and the 1q / 5q / 9q lattices; the paper Space keeps the exact embedding
@@ -1495,7 +1514,7 @@ flagship_tiers:
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:
@@ -1507,16 +1526,16 @@ flagship_tiers:
1507
  heldout_family_physics: {median_pct: 1.554, mae_ff: 0.166, rmse_ff: 0.205}
1508
  val_same_surrogate: {median_pct: 0.722, mae_ff: 0.387, rmse_ff: 0.436, note: "this release's surrogate recipe trained without the validation layouts (P6 SUR-ALL) + the paper's TRAIN-only networks, held out (agents/surcov_p6/RESULTS_P6.md)"}
1509
  b5: {median_pct: 3.175, mae_ff: 0.583, rmse_ff: 0.824}
1510
- b5_physics: {name: "physics alone C^R = R(1.5, 3) (worse than the physics: Fast is behind it here)", median_pct: 1.765, mae_ff: 0.275, rmse_ff: 0.376}
1511
  time_space: "interdigital 0.036 s, xmon 0.11 s, 1-qubit lattice (N 15) 0.82 s, 16-conductor layout 0.49 s, 9-qubit lattice (N 67) 3.9 s (server time, one request, Docker build 2026-10-20; a repeated request is answered from the cache in ~0.01 s)"
1512
  time_x86: "0.091 / 0.274 s in family, 0.30 / 2.45 s zero-shot (median / p90; x86 cluster, 2 CPUs); B5 0.24 s median"
1513
 
1514
  squadds_ml_api: # unified SQuADDS ML inference API (handoff/squadds_ml_api/DESIGN.md, source deploy/squadds_ml_api/, build.py)
1515
  space: SQuADDS/squadds-ml-inference-api # free cpu-basic (created 2026-04-10, before HF's org paywall; a rebuild stays free, checked 2026-11-14)
1516
- deployed: 2026-11-14
1517
- commit: a97aa742 # API 2 + /llms.txt, squadds 04ebd59 (release; no paper model in the vendored package), 11/11 legacy oracle cases live
1518
- previous: 55ce00a61ff492d159df14359457550a8d154d51 # API 2, squadds 53ec2b11
1519
  rollback: legacy-olivia # tag on 01966faaa06432d425e06895f616db40e6cb858d (Olivia's single-model API); README-only test commit 7c985614
1520
- models: {transmon_cross_hamiltonian_inverse: public, planar_capacitance_flagship: hidden, planar_capacitance_fast: hidden}
1521
  collections: {models: SQuADDS/squadds-models-6af8b7da67a22df62af374c6, datasets: SQuADDS/squadds-datasets-6a65152b857f8efa5620880a}
1522
  gating: gated = HF token of a SQuADDS org member; needs Space secret HF_TOKEN (org read token) before the capacitance models go gated
 
1393
  deploy_20261114: # public-demo limits + short card (no paper model); Docker SYSTEM=spaces so HF OAuth works
1394
  commit: 142609ed7021861aea2be8ee5f51594b70e5918b # + text in the author's voice, Fast in the selector, Model not Tier, footer (was 4d44ef6)
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
+ deploy_20261115: # speed (phases A/B), outputs unchanged: concurrency groups, 2 threads, thickness floor 1 um, pinned deps (torch 2.14.1), background preload, slim bundle checkpoints, baked example results, prior-level cache
1397
+ commit: f76c3bf6cfcd7c499049d7cc3d3ef0258d65a3e1
1398
+ rollback: {commit: 142609ed7021861aea2be8ee5f51594b70e5918b, local_copy: data_local/hf_archive/PlanarCapacitanceModel_142609ed} # 102 files
1399
+ prior_level_cache_mb: 256 # TLSQ_PRIOR_LEVEL_CACHE_MB, set in the Space app.py
1400
+ bake: "18 entries (6 examples x 3 tiers), warm.py bake step 62.9 s, peak RSS 2328 MB; loaded at start (interdigital recomputes bit for bit)"
1401
+ gate: deploy/tests/results/flagship_space_gate_speed_20261115.json # + demo limits 11/11, examples 9/9, crop 8/8, substrate 3/3, flagship 6/6
1402
+ live: deploy/tests/results/flagship_space_live_speed_20261115.json # signed in (oauth_token): 12/12, examples bitwise = 2026-11-14 live, vs Mac <= 1.1e-3 rel (8.9e-3 fF)
1403
+ offstack: deploy/tests/results/flagship_space_live_offstack_speed_20261115.json # bitwise = 2026-11-06 live
1404
+ coldstart: {before: deploy/tests/results/flagship_space_coldstart_before_speed_20261115.json, after: deploy/tests/results/flagship_space_coldstart_speed_20261115.json}
1405
  space: shanto268/PlanarCapacitanceModel # the URL is kept; its earlier v3 tiers are archived (archive below)
1406
  title: Planar Capacitance Model
1407
  private: true # Spaces stay private (CLAUDE.md rule 11)
 
1417
  SQuADDS/SQuADDS_PlanarCapacitance-heldout: c538385b3e8d48f4183b68d00e376a06762b0705
1418
  SQuADDS/PlanarCapacitance-flagship: a89f30850b638da1f693042b7d7cf14f20b19098 # + balanced/bal_v2m_sf_s{0,1,2}.pt (same sha256 as the Space) and SHA256SUMS
1419
  not_pushed: [SQuADDS/PlanarCapacitance-paper, shanto268/PlanarCapacitanceModel] # drafts in handoff/hf_cards/; author 2026-11-14: these stay private
1420
+ model_repo: # rename 2026-11-16 (handoff/squadds_integration/RENAME_QCAP.md): flagship -> QCap; tier keys below stay internal
1421
+ id: SQuADDS/QCap # was SQuADDS/PlanarCapacitance-flagship (old URL redirects)
1422
+ folders_revision: 6dd46d33cd58788222dbf5478ca3550f2888f179 # accurate/ -> qcap/, balanced/ -> qcap-lite/, fast/ -> qcap-fast/; weights and sha256 unchanged
1423
+ folders: {accurate: qcap/, balanced: qcap-lite/, fast: qcap-fast/}
1424
+ names: {accurate: QCap, balanced: QCap-Lite, fast: QCap-Fast} # = flagship_tiers.*.paper_name; API ids qcap / qcap-fast (squadds_ml_api)
1425
+ hf_cards_20261116: # README-only, QCap names (handoff/hf_cards/QCap.md, _links.md, _tiers.md); private repos stay private
1426
+ SQuADDS/QCap: 25bdbb19ea3a17b2e86b08baea7b320e2d06d3a0
1427
+ SQuADDS/SQuADDS_PlanarCapacitance: e85ca683991bd3368f8c40d128ae2e7861760dbd
1428
+ SQuADDS/SQuADDS_PlanarCapacitance-Synthetic: d0058e32c863eee28a2060e87203c58527882320
1429
+ SQuADDS/README: 007e7d48481eb78894d4f1a0beb2e54764325c4e # org card Space (public)
1430
  training_layouts: 45771
1431
  archive:
1432
  space: shanto268/PlanarCapacitanceModel
 
1450
 
1451
  flagship_tiers:
1452
  accurate:
1453
+ title: "QCap (~1 s): the physics prior from two coarse solves, extrapolated and corrected by the networks"
1454
+ paper_name: "QCap" # display name = the API name (case-insensitive; handoff/squadds_integration/RENAME_QCAP.md)
1455
+ route: "QCap"
1456
  kind: gnn
1457
  arm: full_gnn
1458
  embedding: {far_k: 64, d_far_um: 100.0} # agents/embedspeed Part A (PROTOCOL.md amendment 2): far-sample decimation F64 of the pair vectors, the fastest arm tying the exact embedding on validation 4,608 and the 1q / 5q / 9q lattices; the paper Space keeps the exact embedding
 
1476
  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)"
1477
  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)"
1478
  balanced:
1479
+ title: "QCap-Lite (~0.5 s): the same recipe on two coarser solves"
1480
+ paper_name: "QCap-Lite"
1481
+ route: "QCap-Lite"
1482
  kind: gnn
1483
  arm: full_gnn
1484
  embedding: {far_k: 64, d_far_um: 100.0} # agents/embedspeed Part A (PROTOCOL.md amendment 2): far-sample decimation F64 of the pair vectors, the fastest arm tying the exact embedding on validation 4,608 and the 1q / 5q / 9q lattices; the paper Space keeps the exact embedding
 
1488
  - {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)
1489
  - {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)
1490
  - {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)
1491
+ summary: "The QCap 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 QCap at 1.5-1.7x its error."
1492
  own: # data_local/farfield_adopt/insample.json, bal_v2m_sf ensemble
1493
  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}
1494
  reference:
 
1499
  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)"
1500
  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"
1501
  fast:
1502
+ title: "QCap-Fast (~0.1 s): a learned prior replaces the solves (trained component families only)"
1503
+ paper_name: "QCap-Fast"
1504
+ route: "QCap-Fast"
1505
  kind: gnn
1506
  arm: full_gnn
1507
  embedding: {far_k: 64, d_far_um: 100.0} # agents/embedspeed Part A (PROTOCOL.md amendment 2): far-sample decimation F64 of the pair vectors, the fastest arm tying the exact embedding on validation 4,608 and the 1q / 5q / 9q lattices; the paper Space keeps the exact embedding
 
1514
  name: sall_all_s0 # surrogate seed 0 by declaration (PROTOCOL.md section 3, amendment A1)
1515
  checkpoint: {name: sall_all_s0, path: data_local/flagship_v4/hpc/sur/sall_all_s0/model.pt, sha256: 132d6f389eda798d31bd5654a96e24cce18fa750134a9fb2a9725eafed339dac}
1516
  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."
1517
+ warning: "Use QCap-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 QCap for anything that matters."
1518
  own: # data_local/flagship_v4/scores/tables.json pooled.fast_sall_all_s0_ens (agents/flagship_v4/RESULTS.md section 2)
1519
  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}
1520
  reference:
 
1526
  heldout_family_physics: {median_pct: 1.554, mae_ff: 0.166, rmse_ff: 0.205}
1527
  val_same_surrogate: {median_pct: 0.722, mae_ff: 0.387, rmse_ff: 0.436, note: "this release's surrogate recipe trained without the validation layouts (P6 SUR-ALL) + the paper's TRAIN-only networks, held out (agents/surcov_p6/RESULTS_P6.md)"}
1528
  b5: {median_pct: 3.175, mae_ff: 0.583, rmse_ff: 0.824}
1529
+ b5_physics: {name: "physics alone C^R = R(1.5, 3) (worse than the physics: QCap-Fast is behind it here)", median_pct: 1.765, mae_ff: 0.275, rmse_ff: 0.376}
1530
  time_space: "interdigital 0.036 s, xmon 0.11 s, 1-qubit lattice (N 15) 0.82 s, 16-conductor layout 0.49 s, 9-qubit lattice (N 67) 3.9 s (server time, one request, Docker build 2026-10-20; a repeated request is answered from the cache in ~0.01 s)"
1531
  time_x86: "0.091 / 0.274 s in family, 0.30 / 2.45 s zero-shot (median / p90; x86 cluster, 2 CPUs); B5 0.24 s median"
1532
 
1533
  squadds_ml_api: # unified SQuADDS ML inference API (handoff/squadds_ml_api/DESIGN.md, source deploy/squadds_ml_api/, build.py)
1534
  space: SQuADDS/squadds-ml-inference-api # free cpu-basic (created 2026-04-10, before HF's org paywall; a rebuild stays free, checked 2026-11-14)
1535
+ deployed: 2026-11-15
1536
+ commit: 8a0986e534f64165d2bbfe849412b05814f2f358 # squadds ec4414d (lean/fast prior, bitwise), thread env 2 + torch threads, check_thickness; warm.py uses physics_prior (0dc991fe failed to build on the old name); 56/56 local, 11/11 legacy oracle live, capacitance models 404
1537
+ previous: a4f1ca1bfd6f0087baa0ab493d3ae04438671321 # 2026-11-14 deploy (a97aa742 + later commits), squadds 04ebd59
1538
  rollback: legacy-olivia # tag on 01966faaa06432d425e06895f616db40e6cb858d (Olivia's single-model API); README-only test commit 7c985614
1539
+ models: {transmon_cross_hamiltonian_inverse: public, qcap: hidden, qcap-fast: hidden} # ids renamed 2026-11-16 (were planar_capacitance_flagship / _fast)
1540
  collections: {models: SQuADDS/squadds-models-6af8b7da67a22df62af374c6, datasets: SQuADDS/squadds-datasets-6a65152b857f8efa5620880a}
1541
  gating: gated = HF token of a SQuADDS org member; needs Space secret HF_TOKEN (org read token) before the capacitance models go gated