Instructions to use TWLab/femtosecond-laser-hydrogel-etching-model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- stable-baselines3
How to use TWLab/femtosecond-laser-hydrogel-etching-model with stable-baselines3:
from huggingface_sb3 import load_from_hub checkpoint = load_from_hub( repo_id="TWLab/femtosecond-laser-hydrogel-etching-model", filename="{MODEL FILENAME}.zip", ) - Notebooks
- Google Colab
- Kaggle
Femtosecond Laser Hydrogel Etching - RL-Optimized Model v2
🔬 Overview
An ML system combining a surrogate prediction model (XGBoost + Neural Network ensemble) with a Reinforcement Learning optimizer (SAC) for femtosecond laser hydrogel etching parameter optimization.
Focus materials: GelMA and HAMA (65% of 12,000 training samples)
Architecture
┌──────────────────────────────────────────────────────────────────┐
│ SAC RL Agent (Parameter Optimizer) - 100% Success Rate │
│ • Observes: current params + predicted geometry + target │
│ • Actions: parameter deltas (±15% of range per step) │
│ • Reward: improvement + proximity + goal bonus │
│ • Converges in ~4 steps to target geometry │
├──────────────────────────────────────────────────────────────────┤
│ XGBoost + NN Ensemble (Surrogate Environment) │
│ • XGBoost: 600 trees, depth 7, per-target │
│ • Neural Network: [128, 64, 32], BatchNorm, Dropout │
│ • Weighted ensemble: 60% XGB + 40% NN │
└──────────────────────────────────────────────────────────────────┘
Performance
Surrogate Model (Geometry Prediction)
| Target | R² | MAE |
|---|---|---|
| etch_depth_um | 0.9745 | 1.05 µm |
| etch_width_um | 0.9845 | 2.33 µm |
| surface_roughness_Sa_um | 0.8409 | 28.18 |
| aspect_ratio | 0.7074 | 0.49 |
| side_wall_angle_deg | 0.9326 | 4.03° |
RL Optimizer (SAC v2 - Depth + Width Focus)
| Metric | Value |
|---|---|
| Success rate | 100% |
| Avg relative error | 0.107 |
| Avg absolute error | 2.60 µm |
| Convergence speed | ~4 steps |
| Algorithm | SAC (γ=0.7, lr=1e-3) |
| Training timesteps | 20,000 |
Design Principles (from literature)
Based on published RL-for-laser research:
- SAC dominates PPO/TD3 for continuous laser control (TempoRL, arxiv:2304.12187)
- Delta actions (±15% of param range/step) for machine safety (arxiv:2503.00499)
- γ = 0.7 optimal for episodic manufacturing control (not 0.99)
- Potential-based reward shaping with improvement signal + proximity bonus
- Domain randomization: material + target randomized each episode
Supported Materials (18 variants)
GelMA (40% of data)
| Variant | Water Content | Threshold Fluence | Young's Modulus |
|---|---|---|---|
| GelMA 5% | 92% | 1.8 J/cm² | 3.5 kPa |
| GelMA 7% | 89% | 1.4 J/cm² | 8 kPa |
| GelMA 10% | 85% | 1.0 J/cm² | 18 kPa |
| GelMA 15% | 80% | 0.7 J/cm² | 45 kPa |
| GelMA 20% | 75% | 0.5 J/cm² | 90 kPa |
HAMA (25% of data)
| Variant | Water Content | Threshold Fluence | Young's Modulus |
|---|---|---|---|
| HAMA 1% | 96% | 2.5 J/cm² | 1.2 kPa |
| HAMA 2% | 94% | 2.0 J/cm² | 3.5 kPa |
| HAMA 3% | 92% | 1.6 J/cm² | 8 kPa |
| HAMA 5% | 88% | 1.2 J/cm² | 20 kPa |
GelMA-HAMA Composites (20% of data)
GelMA5+HAMA1, GelMA7+HAMA2, GelMA10+HAMA3, GelMA15+HAMA5
Other Materials (15% of data)
PEG, PEGDA, Collagen, Alginate, Silk fibroin
Input Features (21 total)
Laser Parameters (8)
power_mW, repetition_rate_kHz, scan_speed_mm_s, pulse_duration_fs,
wavelength_nm, num_passes, spot_diameter_um, focal_offset_um
Material Properties (9)
water_content, threshold_fluence_J_cm2, absorption_depth_nm,
incubation_coefficient, refractive_index, youngs_modulus_kPa,
degree_of_methacrylation, crosslink_density_mol_m3, two_photon_cross_section_GM
Derived Physics Features (4)
pulse_energy_uJ, peak_fluence_J_cm2, effective_pulses, overlap_percent
Usage
Predict etching geometry:
import xgboost as xgb, torch, joblib, numpy as np
# Load models
scaler_X = joblib.load("scaler_X.joblib")
scaler_y = joblib.load("scaler_y.joblib")
xgb_models = {t: xgb.XGBRegressor() for t in targets}
for t in targets: xgb_models[t].load_model(f"xgb_{t}.json")
# Predict
features = [200, 1000, 1.0, 200, 800, 5, 10, 0, ...] # 21 features
xgb_pred = np.array([xgb_models[t].predict([features])[0] for t in targets])
Optimize parameters with RL:
from stable_baselines3 import SAC
sac = SAC.load("sac_optimizer_v2")
# Set target: depth=10µm, width=20µm
# Agent finds optimal: power, rep_rate, speed, passes, spot_diameter
obs = env.reset(target=[10, 20])
for step in range(20):
action, _ = sac.predict(obs, deterministic=True)
obs, reward, done, _, info = env.step(action)
if done: break
# Optimized params available in env.params
Dataset
12,000 samples with physics-informed synthetic data grounded in:
- Beer-Lambert ablation model with two-photon absorption
- Gaussian beam width model
- Material-specific incubation effects
- Literature-validated parameter ranges
Available at: TWLAb/femtosecond-laser-hydrogel-etching-data
Scientific References
- Petit et al., "AI-Supported Prediction of Femtosecond Laser Micromachining Parameters", JLMN 2025
- "TempoRL: Laser Pulse Temporal Shape Optimization with DRL", arxiv:2304.12187
- Capuano et al., "Shaping Laser Pulses with RL", arxiv:2503.00499
- "Optimizing Operation Recipes with RL", arxiv:2511.16297
- Femtosecond laser induced densification within cell-laden hydrogels, Biofabrication 2019
- Femtosecond Laser Densification of Hydrogels, ACS Appl. Mater. Interfaces 2022
- Harnessing the potential of HAMA hydrogel, Bioactive Materials 2024
- Behbahani et al., "ML-driven laser machining of alumina ceramics", Physica Scripta 2023
Generated by ML Intern
This model repository was generated by ML Intern, an agent for machine learning research and development on the Hugging Face Hub.
- Try ML Intern: https://smolagents-ml-intern.hf.space
- Source code: https://github.com/huggingface/ml-intern
- Downloads last month
- 167