OPEN-SOURCE TOOLKIT

Unified Lithography Evaluation Framework

A modular Python toolkit bridging academic tensor-based optimization and industrial mask manufacturing. Standardized metrics, model-agnostic evaluation, and end-to-end OASIS workflow.

precision_manufacturing

Computational Lithography Pipeline

Architecture Layers

api

API Façade

An object-oriented entry point — Mask, LitheEngine, Report — re-exported at the package root for fab- and EDA-shaped callers who think in masks and engines, not tensors and registries. Frozen-dataclass Mask with suffix-sniffing constructors (from_oasis / from_pt / from_npy / from_gds); LitheEngine.optimize and .evaluate wrap the existing functional API with a teardown lifecycle. The functional API is unchanged.

from openlithohub import Mask, LitheEngine, Report
database

Data Layer

Unified dataset adapters for mask optimization (LithoBench .npy NeurIPS'23, LithoSim HuggingFace Parquet NeurIPS'25, GAN-OPC paired masks TCAD'20), hotspot detection (ICCAD'16 Problem C EUV), and real PDKs (ASAP7 standard cells, FreePDK45 + NanGate OCL, ORFS-routed RISC-V mock-alu with 2 µm / 5 µm tile cutting). All adapters yield consistent LithoSample records with nm-aware metadata.

from openlithohub.data import LithoBenchDataset, Asap7Dataset, FreePdk45Dataset, OrfsArtifactDataset
analytics

Benchmark Layer

EPE, PV Band, shot count, stochastic robustness metrics. MRC/DRC compliance as hard-fail gating.

model_training

Models Layer

Decorator-based registry on a minimal LithographyModel interface. Ships with rule-based OPC, LevelSet-ILT (with optional Hopkins forward), OpenILT (SimpleILT / MOSAIC L2+PVBand), and Neural-ILT (U-Net, with public v0.1 seed weights on HuggingFace).

account_tree

Workflow Layer

Tiling, contour extraction (manhattan & curvilinear), B-spline fitting, OASIS export.

terminal

CLI Layer

Seven Typer command groups: eval, optimize, leaderboard, simulate, synth, hackathon, export, with rich formatted output.

Evaluation Metrics

straighten

Edge Placement Error

Distance between predicted and target contour edges. Computed via Sobel-based edge extraction and nearest-point distance calculation.

Process Variation Band

Resist contour variation across dose/focus window. Measures robustness to manufacturing process fluctuations.

grid_view

Shot Count

Mask write time proxy for MBMW and VSB writers. Counts rectangular shots needed to reproduce the mask pattern.

Stochastic Robustness

Monte Carlo photon-noise + dose-jitter simulation for EUV. Detects bridge and break failures simultaneously via component labelling — a trial that bridges one pair and breaks another counts on both axes. A higher-fidelity Monte-Carlo failure path also runs against any registered simulator backend.

layers

EUV 3D-Mask Shadow Proxy

First-order shadowing proxy for EUV reflective masks. Anisotropic kernel parameterised by absorber thickness and chief-ray azimuth flags layouts at risk of large 3D errors without paying for a Maxwell solver.

hub

Simulator Hook API

Vendor-neutral BaseSimulator ABC. Hopkins reference adapter ships in-tree; Calibre nmOPC and Tachyon adapters are config-validated stubs ready for users with vendor toolchain access.

grid_on

Synthetic Layout Generator

PDK-aware synthetic layouts (FreePDK45, ASAP7) — SRAM cells, contact arrays, randomly routed metal — that pass MRC by construction. CLI batch export plus a DiffusionLayoutGenerator stub for the upcoming generative path.

memory

Real PDK Adapters

Industrial-grade layouts via three klayout-backed adapters: ASAP7 standard cells (BSD-3-Clause), FreePDK45 + NanGate Open Cell Library, and ORFS-routed RISC-V mock-alu cut into 2 µm / 5 µm AI-OPC inference tiles. Runs end-to-end through openlithohub eval run --dataset asap7|freepdk45|orfs.

Manufacturing Compliance

  • verified
    MRC — MASK RULE CHECK

    Minimum width and spacing rule check using morphological opening. Hard-fail gating ensures only compliant masks proceed.

  • rule
    DRC — DESIGN RULE CHECK

    Full design rule verification: minimum area, notch detection, width/spacing analysis. Catches geometry defects before tape-out.

  • precision_manufacturing
    PROCESS NODE CONFIGS

    DTCO-aware parameters for 3nm EUV, 5nm EUV, 7nm, and 45nm nodes. Auto-configures pixel size, wavelength, and MRC thresholds.

OPENLITHOHUB SDK
import torch
from openlithohub.benchmark.metrics import compute_epe, compute_pvband
from openlithohub.benchmark.compliance import check_mrc

# Load predicted and target masks
predicted = torch.load("predicted_mask.pt")
target = torch.load("target_mask.pt")

# Compute metrics
epe = compute_epe(predicted, target, pixel_size_nm=1.0)
pvb = compute_pvband(predicted, defocus_range_nm=20.0)
mrc = check_mrc(predicted, min_width_nm=40.0)

print(f"EPE: {epe['epe_mean_nm']:.2f} nm")
print(f"PV Band: {pvb['pvband_mean_nm']:.2f} nm")
print(f"MRC passed: {mrc.passed}")

End-to-End Pipeline

database
DATA LOADING

Dataset adapters normalize to LithoSample tensors.

model_training
MODEL PREDICT

LevelSet-ILT or Neural-ILT generates optimized mask.

fact_check
EVALUATE

Compute EPE, PV Band, MRC/DRC compliance.

output
OASIS EXPORT

Contour → B-spline → fab-ready .oas file.

DEVELOPER ERGONOMICS

From Tensor to Tape-Out, Without Friction

Helpers that close the gap between AI research workflows and real fab pipelines. Use them in a notebook, in CI, or alongside your sign-off deck.

picture_as_pdf

Paper-Ready Visualization

openlithohub.vis.plot_contours emits IEEE / SPIE column-width figures with a colorblind-safe palette, vector PDF defaults, and Type-42 fonts. One call, no rcParams archaeology.

plot_contours(target, predicted, save_path="fig.pdf", style="ieee")
grid_on

Hermetic Dummy Layouts

generate_dummy_layout produces deterministic, DRC-clean test patterns with only NumPy and PyTorch. CI runs without dataset downloads; Colab runs without `[workflow]` extras.

mask = generate_dummy_layout(size=256, seed=0)
precision_manufacturing

EDA Bridge Templates

Export an OASIS file and we'll emit a minimal Calibre .svrf deck and Synopsys IC Validator runset alongside it — load straight into your fab toolchain for a sanity DRC.

emit_bridge_bundle("mask.oas", BridgeRules(min_width_nm=40, min_spacing_nm=40))
rocket_launch

Three-Minute Colab Quickstart

Open notebooks/quickstart.ipynb in Colab and go from `pip install` to a paper-ready figure without any local setup.

!pip install 'openlithohub[jupyter]'
rule

Standard MRC Rule-Deck Schema (RFC 0003)

A single JSON / TOML format for MRC rules — min width, spacing, curvature radius, feature area, plus provenance. load_rule_deck() validates against the in-tree schema and adapts to the existing check_mrc / check_curvilinear_mrc functions.

deck = load_rule_deck("rules/freepdk45_metal1.json")
ios_share

Export to ONNX / TorchScript / TensorRT

The openlithohub export CLI ships any registered model out as ONNX (dynamo path, with a TorchScript fallback for non-torch.export-able models like NeuralILT). TensorRT-ready out of the box. Pass --verify to round-trip the artifact and assert it agrees with the PyTorch reference before shipping.

openlithohub export --model neural-ilt --format onnx --verify
tune

Process-Window-Aware ILT

LevelSetILTModel.predict(process_window=True) swaps nominal-only MSE for a 5-corner weighted loss across dose × defocus. The new workflow.process_window module ships ProcessWindowCorner, DEFAULT_PW_CORNERS, and pw_fidelity_loss — drop-in replacements for nominal MSE in any ILT loop. Defaults stay nominal: no API break.

model.predict(layout, process_window=True)
block

SRAF Non-Printing Penalty

sraf_print_penalty(aerial, sraf_mask, print_threshold=0.30, margin=0.05) is a differentiable squared-ReLU loss that punishes SRAF-region aerial intensity above the print floor. Catches "SRAF accidentally printed on wafer" inside the gradient loop, complementing the post-hoc MRC compliance gate.

from openlithohub.benchmark.metrics import sraf_print_penalty
science

Auto-Calibration with Adam

The new auto_calibration.ipynb notebook inverts a GaugeTable of measured CDs onto resist threshold + Gaussian σ in <30 s on CPU using torch.optim.Adam. No bespoke calibration code — same autograd graph the rest of OpenLithoHub already uses.

notebooks/auto_calibration.ipynb   pre-fit MAE 1.999 px → ~0 px
save

ILT Checkpointing & Resume

LevelSetILTModel.predict(checkpoint_dir=, save_freq=, resume_from=) periodically torch.saves the mask logit, Adam state, and best-loss tracker. Deterministic resume — pinned by a resume-vs-uninterrupted equality test. SLURM preemption or CUDA crash on a multi-thousand-iter run no longer wipes prior progress. Off by default, opt-in per call site.

model.predict(layout, checkpoint_dir="ckpt/", save_freq=100)
verified

Deterministic Mode + SRAF Min-Area Filter

--deterministic on openlithohub eval / optimize centralises the four torch backend flags (cudnn.deterministic, no benchmark, no tf32) needed for bit-reproducible scoring runs. --export-min-area drops sub-resolution SRAF polygons via shoelace area before OASIS insert, so fab-ready exports clear MRC without touching academic scoring (defaults to 0.0, Hackathon-safe).

openlithohub optimize run --deterministic --export-min-area 200
timeline

Curvilinear Polygon Decimation

Opt-in Ramer-Douglas-Peucker simplification on each sampled curvilinear polygon at OASIS export. vertex_tolerance_nm=0.0 (default) keeps bit-exact academic behaviour; positive values cut full-chip OASIS data volume — and the MBMW shot/byte budget — without measurable wafer-image change. Iterative anchored DP, no recursion-depth risk on long curves.

export_oasis_mbw(mask, "out.oas", vertex_tolerance_nm=0.5)
tune

Measured-Source & Zernike-Pupil I/O

The Hopkins/SOCS forward model now accepts measured source intensity maps and Zernike-coefficient pupil aberrations from common scanner formats — load_source_intensity, load_zernike_coefficients, zernike_phase_map are all re-exported on openlithohub.simulators. Drop in real scanner data instead of synthetic illuminations.

from openlithohub.simulators import load_source_intensity, zernike_phase_map