OSCR

Supernetwork-based efficient mapping of deep learning applications to mixed-precision hardware using model adaptation.

Code ↔ Paper

2 matches between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

The 2 matches
  1. [1] § Methods › Comparison setup ↔ MPS/mps/supernet.py, lines 22 to 113 · score 0.51 · digital weight, Mixed Precision, PyTorch, AIHWKit, inference, INT8 · Report a mismatch
  2. [2] § Methods › MixeD-precision Supernetwork Training › Rank-preserving fine-tuning ↔ MPS/train_mps.py, lines 196 to 299 · score 0.51 · fine tune, fairness, phase, loss, ranks, supernetwork · Report a mismatch

Paper

Loaded from Europe PMC by your browser; OSCR does not store it: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

Python · 196 lines · 6.4 KB · Apache-2.0 · 1 match

  1. from __future__ import annotations
  2. from dataclasses import dataclass
  3. from typing import Dict, List, Optional, Tuple
  4. import torch
  5. import torch.nn as nn
  6. import torch.nn.functional as F
  7. from .aihwkit_backend import AnalogConfig, make_inference_rpu_config, analog_conv2d_from_digital, analog_linear_from_digital, maybe_move_analog_to_cuda
  8. from .ops_qat import make_qat_conv2d, make_qat_linear, SkipOp
  9. @dataclass
  10. class ChoiceConfig:
  11. enable_fp16: bool = True
  12. enable_int8: bool = True
  13. enable_analog: bool = True
  14. enable_skip: bool = True
  15. class MixedPrecisionChoice(nn.Module):
  16. def __init__(
  17. self,
  18. name: str,
  19. base: nn.Module,
  20. is_conv: bool,
  21. in_shape: Tuple[int, ...],
  22. out_shape: Tuple[int, ...],
  23. choice_cfg: ChoiceConfig,
  24. analog_cfg: AnalogConfig,
  25. device: str,
  26. ):
  27. super().__init__()
  28. self.name = name
  29. self.is_conv = is_conv
  30. self.in_shape = in_shape
  31. self.out_shape = out_shape
  32. self.choice_cfg = choice_cfg
  33. self.analog_cfg = analog_cfg
  34. self.device = device
  35. self.ops = nn.ModuleDict()
  36. # fp16 path = base module (executed under autocast by training loop)
  37. if choice_cfg.enable_fp16:
  38. self.ops["fp16"] = base
  39. # int8 path = QAT-prepared module (still float weights during training)
  40. if choice_cfg.enable_int8:
  41. self.ops["int8"] = make_qat_conv2d(base) if is_conv else make_qat_linear(base)
  42. # analog path = AIHWKIT analog module (weights copied from base)
  43. if choice_cfg.enable_analog:
  44. rpu = make_inference_rpu_config(analog_cfg)
  45. a = analog_conv2d_from_digital(base, rpu) if is_conv else analog_linear_from_digital(base, rpu)
  46. # Copy trained digital weights into analog weights container
  47. # AIHWKIT uses analog tiles; set_weights is the supported way.
  48. with torch.no_grad():
  49. w = base.weight.detach().cpu().numpy()
  50. b = None if (getattr(base, "bias", None) is None) else base.bias.detach().cpu().numpy()
  51. a.set_weights(w, b)
  52. a = maybe_move_analog_to_cuda(a, want_cuda=("cuda" in device))
  53. self.ops["analog"] = a
  54. if choice_cfg.enable_skip:
  55. self.ops["skip"] = SkipOp(in_shape, out_shape, is_conv=is_conv)
  56. self.op_names = list(self.ops.keys())
  57. self.alpha = nn.Parameter(torch.zeros(len(self.op_names), dtype=torch.float32))
  58. self.sampled_op: Optional[str] = None
  59. self.use_gumbel: bool = False
  60. self.gumbel_tau: float = 1.0
  61. def set_sampled_op(self, op: Optional[str]) -> None:
  62. self.sampled_op = op
  63. def set_gumbel(self, enabled: bool, tau: float) -> None:
  64. self.use_gumbel = enabled
  65. self.gumbel_tau = tau
  66. def softmax_probs(self) -> torch.Tensor:
  67. return torch.softmax(self.alpha, dim=0)
  68. def argmax_op(self) -> str:
  69. return self.op_names[int(torch.argmax(self.alpha).item())]
  70. def set_analog_out_noise(self, out_noise: float) -> None:
  71. # Progressive noise scaling: update rpu_config forward noise if possible
  72. if "analog" in self.ops:
  73. analog = self.ops["analog"]
  74. if hasattr(analog, "rpu_config") and hasattr(analog.rpu_config, "forward"):
  75. if hasattr(analog.rpu_config.forward, "out_noise"):
  76. analog.rpu_config.forward.out_noise = float(out_noise)
  77. def forward(self, x: torch.Tensor) -> torch.Tensor:
  78. if self.sampled_op is not None:
  79. return self.ops[self.sampled_op](x)
  80. if self.use_gumbel:
  81. w = F.gumbel_softmax(self.alpha, tau=self.gumbel_tau, hard=False, dim=0)
  82. out = 0.0
  83. for i, k in enumerate(self.op_names):
  84. out = out + w[i] * self.ops[k](x)
  85. return out
  86. w = self.softmax_probs()
  87. out = 0.0
  88. for i, k in enumerate(self.op_names):
  89. out = out + w[i] * self.ops[k](x)
  90. return out
  91. class SuperNet(nn.Module):
  92. def __init__(self, model: nn.Module, choices: List[MixedPrecisionChoice]):
  93. super().__init__()
  94. self.model = model
  95. self.choices = nn.ModuleList(choices)
  96. def named_choices(self):
  97. return [(c.name, c) for c in self.choices]
  98. def set_all_sampled(self, mapping: Optional[Dict[str, str]]) -> None:
  99. for c in self.choices:
  100. c.set_sampled_op(None if mapping is None else mapping.get(c.name, None))
  101. def set_gumbel_all(self, enabled: bool, tau: float) -> None:
  102. for c in self.choices:
  103. c.set_gumbel(enabled, tau)
  104. def extract_mapping(self) -> Dict[str, str]:
  105. return {c.name: c.argmax_op() for c in self.choices}
  106. def forward(self, x: torch.Tensor) -> torch.Tensor:
  107. return self.model(x)
  108. def _infer_shapes(model: nn.Module, input_shape=(1, 3, 32, 32)):
  109. shapes = {}
  110. hooks = []
  111. def register(name, mod):
  112. def hook(m, inp, out):
  113. x = inp[0]
  114. shapes[name] = (tuple(x.shape[1:]), tuple(out.shape[1:]))
  115. return hook
  116. for name, m in model.named_modules():
  117. if isinstance(m, (nn.Conv2d, nn.Linear)):
  118. hooks.append(m.register_forward_hook(register(name, m)))
  119. model.eval()
  120. with torch.no_grad():
  121. model(torch.zeros(*input_shape))
  122. for h in hooks:
  123. h.remove()
  124. return shapes
  125. def convert_to_supernet(
  126. model: nn.Module,
  127. choice_cfg: ChoiceConfig,
  128. analog_cfg: AnalogConfig,
  129. device: str,
  130. input_shape=(1, 3, 32, 32),
  131. ) -> SuperNet:
  132. shapes = _infer_shapes(model, input_shape=input_shape)
  133. choices: List[MixedPrecisionChoice] = []
  134. for name, m in list(model.named_modules()):
  135. if isinstance(m, (nn.Conv2d, nn.Linear)):
  136. parent = model
  137. parts = name.split(".")
  138. for p in parts[:-1]:
  139. parent = getattr(parent, p)
  140. leaf = parts[-1]
  141. in_shape, out_shape = shapes[name]
  142. is_conv = isinstance(m, nn.Conv2d)
  143. wrapped = MixedPrecisionChoice(
  144. name=name,
  145. base=m,
  146. is_conv=is_conv,
  147. in_shape=in_shape,
  148. out_shape=out_shape,
  149. choice_cfg=choice_cfg,
  150. analog_cfg=analog_cfg,
  151. device=device,
  152. )
  153. setattr(parent, leaf, wrapped)
  154. choices.append(wrapped)
  155. return SuperNet(model=model, choices=choices)

supernet.py at commit 25261a1, under Apache-2.0 · at the source

Overview

  1. IBM Research Europe, Rüschlikon, Switzerland
  2. IBM T. J. Watson Research Center, Yorktown Heights, NY USA
  3. IBM Research—Almaden, San Jose, CA USA
Institutions: IBM Research - Zurich (Switzerland); IBM (United States) (United States); IBM Research - Thomas J. Watson Research Center (United States); IBM Research - Almaden (United States)
Journal: Nature communications, volume 17, issue 1, article 4501
Dates: received 4 March 2025; accepted 12 March 2026; published online 27 March 2026
Type: Research article · Language: English
License: CC BY-NC-ND
Identifiers: DOI 10.1038/s41467-026-71071-1 · PMID 41896236 · PMCID PMC13187305 · OpenAlex W7141738699
Open access: gold, a free copy (OpenAlex)
Status: code verified (how the code is found and verified)
Methods: Machine learning
Keywords: Computer science, Computational science
Topic: Advanced Neural Network Applications (Computer Vision and Pattern Recognition, Computer Science), according to OpenAlex
Citations: not cited yet (Europe PMC); 29 references in the paper

Abstract

The abstract is not reproduced here: the paper's license (CC BY-NC-ND) does not allow it. Read it in the paper, at the publisher or on Europe PMC.

Repository

Its files are read in the Code ↔ Paper reader above, with 2 matches between paragraphs and lines of code.

ibm/analog-nas

License: Apache-2.0
State: the link answers, verified on 30 September 2026
Evidence: files inventoried
Commit: 25261a145f0d09998fc2ff0154571a513137d998, 4 March 2026
Languages: Python (61), JavaScript (13), Jupyter (2), Shell (1)
Size: 195 files, 77 scripts
Software Heritage: archived
Found in: “Code availability”
Holds: README, license file, environment (analognas/environment.yml, analognas/requirements.txt, analognas/setup.py, analognasbench/setup.py, MPS/requirements.txt), tests, documentation, 2 notebooks
Not found: CITATION.cff, continuous integration
Tools: NumPy (20 files), PyTorch (15 files), scikit-learn (5 files), pandas (4 files), SciPy (2 files), XGBoost (2 files), Matplotlib (1 file)
Availability: 1 check, the latest on 30 September 2026: the link answers
  • 30 September 2026: the link answers
79 files

Code availability statement

The paper has a code availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:

Read it in the paper: doi.org/10.1038/s41467-026-71071-1.

Tracing map

Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.

What the map holds:

  • 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 77 scripts, each with its path and the digest of its content;
  • 2 matches between paragraphs of the paper and lines of the code (method lexical-v1);
  • neither the text of the paper nor the code itself.

Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.

Data

No dataset and no data link were found in the paper.

Code and data availability statement

The paper has a code and data availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:

Read it in the paper: doi.org/10.1038/s41467-026-71071-1.

Versions

The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.

Version 1, 30 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 11 authors, 2 keywords, 6 references.

Cite

This paper

Benmeziane, H., Lammie, C., Boybat, I., Rasch, M., Le Gallo, M., Vasilopoulos, A., Tsai, H., Burr, G. W., Narayanan, V., El Maghraoui, K., & Sebastian, A. (2026). Supernetwork-based efficient mapping of deep learning applications to mixed-precision hardware using model adaptation. Nature communications, 17(1), 4501. https://doi.org/10.1038/s41467-026-71071-1

BibTeX

@article{benmeziane2026supernetwork,
author = {Benmeziane, Hadjer and Lammie, Corey and Boybat, Irem and Rasch, Malte and Le Gallo, Manuel and Vasilopoulos, Athanasios and Tsai, Hsinyu and Burr, Geoffrey W and Narayanan, Vijay and El Maghraoui, Kaoutar and Sebastian, Abu},
title = {{Supernetwork-based efficient mapping of deep learning applications to mixed-precision hardware using model adaptation}},
journal = {Nature communications},
year = {2026},
month = mar,
volume = {17},
number = {1},
pages = {4501},
publisher = {Nature Publishing Group},
issn = {2041-1723},
doi = {10.1038/s41467-026-71071-1},
url = {https://doi.org/10.1038/s41467-026-71071-1},
pmid = {41896236},
pmcid = {PMC13187305}
}

RIS

TY - JOUR
AU - Benmeziane, Hadjer
AU - Lammie, Corey
AU - Boybat, Irem
AU - Rasch, Malte
AU - Le Gallo, Manuel
AU - Vasilopoulos, Athanasios
AU - Tsai, Hsinyu
AU - Burr, Geoffrey W
AU - Narayanan, Vijay
AU - El Maghraoui, Kaoutar
AU - Sebastian, Abu
TI - Supernetwork-based efficient mapping of deep learning applications to mixed-precision hardware using model adaptation
T2 - Nature communications
J2 - Nat Commun
PY - 2026
DA - 2026/03/27
VL - 17
IS - 1
SP - 4501
SN - 2041-1723
PB - Nature Publishing Group
DO - 10.1038/s41467-026-71071-1
UR - https://doi.org/10.1038/s41467-026-71071-1
LA - en
ER -

CSL-JSON

{
"id": "10.1038/s41467-026-71071-1",
"type": "article-journal",
"title": "Supernetwork-based efficient mapping of deep learning applications to mixed-precision hardware using model adaptation",
"container-title": "Nature communications",
"author": [
{
"family": "Benmeziane",
"given": "Hadjer"
},
{
"family": "Lammie",
"given": "Corey"
},
{
"family": "Boybat",
"given": "Irem"
},
{
"family": "Rasch",
"given": "Malte"
},
{
"family": "Le Gallo",
"given": "Manuel"
},
{
"family": "Vasilopoulos",
"given": "Athanasios"
},
{
"family": "Tsai",
"given": "Hsinyu"
},
{
"family": "Burr",
"given": "Geoffrey W"
},
{
"family": "Narayanan",
"given": "Vijay"
},
{
"family": "El Maghraoui",
"given": "Kaoutar"
},
{
"family": "Sebastian",
"given": "Abu"
}
],
"container-title-short": "Nat Commun",
"volume": "17",
"issue": "1",
"page": "4501",
"DOI": "10.1038/s41467-026-71071-1",
"PMID": "41896236",
"PMCID": "PMC13187305",
"ISSN": "2041-1723",
"publisher": "Nature Publishing Group",
"URL": "https://doi.org/10.1038/s41467-026-71071-1",
"language": "en",
"issued": {
"date-parts": [
[
2026,
3,
27
]
]
}
}

The tracing map gets a citation of its own once an author has validated it and it has a DOI.

Similar papers

The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.

[1] doi:10.1038/s41467-026-75783-2 [code]
Broadband encoding and high-speed probabilistic bit generation with integrated microwave neurons.
Journal: Nature communications
In common: PyTorch, scikit-learn, pandas, 3 other tools, 1 reference
[2] doi:10.3389/frai.2025.1662984 [code]
Search-optimized quantization in biomedical ontology alignment.
Journal: Frontiers in artificial intelligence
In common: PyTorch, scikit-learn, pandas, 2 other tools, 1 reference
[3] doi:10.1038/s41467-026-73669-x [code]
Homeostatic dendritic neuron based on co-integrated volatile and non-volatile memristors for neuromorphic processing.
Journal: Nature communications
In common: PyTorch, scikit-learn, SciPy, 2 other tools, 1 reference
[4] doi:10.1038/s41467-026-72900-z [code]
Resistive memory-based neural differential equation solver for score-based diffusion model.
Journal: Nature communications
In common: PyTorch, pandas, SciPy, 2 other tools, 1 reference
[5] doi:10.1038/s41467-026-68905-3 [code]
Homogeneous integration of two-dimensional material-based optoelectronic neurons and ferroelectric synapses for neuromorphic vision.
Journal: Nature communications
In common: PyTorch, pandas, SciPy, 2 other tools, 1 reference
[6] doi:10.1038/s41467-024-55220-y [code]
Quantum-limited stochastic optical neural networks operating at a few quanta per activation.
Journal: Nature communications
In common: PyTorch, pandas, Matplotlib, 1 other tool, 1 reference
[7] doi:10.1126/sciadv.adr7571 [code]
Continuous-time digital twin with analog memristive neural ordinary differential equation solver.
Journal: Science advances
In common: PyTorch, SciPy, Matplotlib, 1 other tool, 1 reference
[8] doi:10.1038/s44172-025-00437-y [code]
Super-Turing synaptic resistor circuits for intelligent morphing wing.
Journal: Communications engineering
In common: scikit-learn, SciPy, Matplotlib, 1 other tool, 1 reference
[9] doi:10.1038/s41467-026-68858-7 [code]
Bioinspired spiking architecture enables energy constrained touch encoding.
Journal: Nature communications
In common: SciPy, Matplotlib, NumPy, 1 reference
[10] doi:10.1126/sciadv.adr2082 [code]
HfZrO-based synaptic resistor circuit for a Super-Turing intelligent system.
Journal: Science advances
In common: NumPy, 1 reference

Contribute

The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.

Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.

Add the badge to the code's README

OSCR: the badge of this paper

If you are an author or a maintainer of this paper's code, you can add this badge. It says what OSCR knows of the paper (its code, its validated tracing map) and links the code to this page. Paste one of these snippets under the README's title. Keep the two marks around it, so that the badge can be replaced in place and is never added twice. OSCR changes nothing in your repository.

Markdown
<!-- oscr-badge:start -->
[![OSCR](https://openscicode.org/badge/doi/10.1038/s41467-026-71071-1.svg)](https://openscicode.org/badge/doi/10.1038/s41467-026-71071-1)
<!-- oscr-badge:end -->
reStructuredText
.. oscr-badge:start

.. image:: https://openscicode.org/badge/doi/10.1038/s41467-026-71071-1.svg
   :target: https://openscicode.org/badge/doi/10.1038/s41467-026-71071-1
   :alt: OSCR

.. oscr-badge:end
HTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1038/s41467-026-71071-1"><img src="https://openscicode.org/badge/doi/10.1038/s41467-026-71071-1.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->

On GitHub, open the README, choose Edit (the pencil), paste the snippet under the title, then "Commit changes".

If you choose to, you can have the badge kept up to date for you, with oscr badge --write from the command line or with the GitHub Action in your repository's workflows. Every other form and option (a card, AsciiDoc, LaTeX, shields.io) is on the badge page.

Request its removal

To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).

Discussion, reproductions, activity

Discussion: code errors and mismatches between the code and the paper about this paper and its code, from readers and its authors, beside the paper and its tracing map.

Report a mismatch between the code and the paper · Report a code error (signed in)

Reproductions: reports from readers who ran the authors' code and did not get the paper's result, what they ran, with which environment, commit and data.

Report a reproduction failure (signed in)

Versions of its code: the releases of its code tied to a version of this paper (the preprint, the accepted manuscript, the version of record…), each with the tracing map versioned with it.

Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.