High-fidelity neural speech reconstruction through an efficient acoustic-linguistic dual-pathway framework.
The 2 matches
- [1] § Materials and methods › Linguistic feature adaptor training and ablation test ↔ codes/models.py, lines 14–100 · score 0.75 · positional encoding, decoder layers, encoder layers, heads, linear, token
- [2] § Materials and methods › Linguistic feature adaptor training and ablation test ↔ codes/codes/reconstruction.py, lines 138–179 · score 0.52 · weight decay, L2, Adam, optimizer, model, trained
Paper
Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
Python · 133 lines · 5.2 KB · GPL-3.0 · 1 match
- class PositionalEncoding(nn.Module):
- def __init__(self, d_model, max_len=5000):
- super().__init__()
- pe = torch.zeros(max_len, d_model)
- position = torch.arange(0, max_len, dtype=torch.float).unsqueeze(1)
- div_term = torch.exp(torch.arange(0, d_model, 2).float() * (-math.log(10000.0) / d_model))
- pe[:, 0::2] = torch.sin(position * div_term)
- pe[:, 1::2] = torch.cos(position * div_term)
- self.register_buffer('pe', pe.unsqueeze(0))
- def forward(self, x):
- return x + self.pe[:, :x.size(1)]
- class Seq2SeqTransformer(nn.Module):
- def __init__(self, input_dim=42, output_dim=1024, d_model=256, nhead=8,
- num_encoder_layers=3, num_decoder_layers=3, dim_feedforward=1024):
- super().__init__()
- self.d_model = d_model
- self.output_dim = output_dim
- self.encoder_embed = nn.Linear(input_dim, d_model)
- self.decoder_embed = nn.Linear(output_dim, d_model)
- self.pos_encoder = PositionalEncoding(d_model)
- self.pos_decoder = PositionalEncoding(d_model)
- self.transformer = nn.Transformer(
- d_model=d_model,
- nhead=nhead,
- num_encoder_layers=num_encoder_layers,
- num_decoder_layers=num_decoder_layers,
- dim_feedforward=dim_feedforward,
- batch_first=True,
- )
- self.fc_out = nn.Linear(d_model, output_dim)
- # Enhanced length prediction head
- self.length_head = nn.Sequential(
- nn.Linear(d_model, d_model),
- nn.SiLU(),
- nn.Linear(d_model, d_model),
- nn.SiLU(),
- nn.Linear(d_model, 1)
- )
- def generate_square_subsequent_mask(self, sz):
- return torch.triu(torch.full((sz, sz), float('-inf')), diagonal=1)
- def forward(self, src, tgt=None, max_len=50, is_inference=False):
- #print('src.shape',src.shape)
- src = self.encoder_embed(src) * math.sqrt(self.d_model)
- src = self.pos_encoder(src)
- #print('src.shape',src.shape)
- if is_inference:
- return self._inference_forward(src, max_len)
- tgt = self.decoder_embed(tgt) * math.sqrt(self.d_model)
- tgt = self.pos_decoder(tgt)
- sz = tgt.size(1)
- tgt_mask = self.generate_square_subsequent_mask(sz).to(tgt.device)
- output = self.transformer(src=src, tgt=tgt, tgt_mask=tgt_mask)
- output_tokens = self.fc_out(output)
- # Predict length from mean of encoder output
- output_length = F.softplus(self.length_head(src.mean(dim=1)))
- return {
- 'tokens': output_tokens,
- 'length': output_length.squeeze(-1)
- }
- def _inference_forward(self, src, max_len):
- memory = self.transformer.encoder(src)
- batch_size = src.size(0)
- # Predict sequence length first
- #length_embed = self.length_head(memory.mean(dim=1))
- length_embed = self.length_head(src.mean(dim=1))
- pred_length = int(F.softplus(length_embed).round().item())
- pred_length = min(max(1, pred_length), max_len) # Clamp to valid range
- # Generate sequence based on predicted length
- tgt = torch.zeros(batch_size, 1, self.output_dim).to(src.device)
- output_tokens = []
- for _ in range(pred_length):
- tgt_embed = self.decoder_embed(tgt) * math.sqrt(self.d_model)
- tgt_embed = self.pos_decoder(tgt_embed)
- output = self.transformer.decoder(
- tgt_embed,
- memory,
- tgt_mask=self.generate_square_subsequent_mask(tgt.size(1)).to(src.device)
- )
- next_token = self.fc_out(output[:, -1:, :])
- output_tokens.append(next_token)
- tgt = torch.cat([tgt, next_token], dim=1)
- output_tokens = torch.cat(output_tokens, dim=1)
- return output_tokens, pred_length
- class DynamicSequenceLoss(nn.Module):
- def __init__(self, token_weight=1, length_weight=1):
- super().__init__()
- self.token_weight = token_weight
- self.length_weight = length_weight
- self.token_loss = nn.KLDivLoss(reduction='batchmean')
- self.length_loss = nn.HuberLoss()
- def forward(self, preds, targets):
- # 对预测值取log_softmax(KL散度要求)
- pred_log_probs = F.log_softmax(preds['tokens'], dim=-1)
- # 确保目标是有效的概率分布
- target_probs = F.softmax(targets['tokens'], dim=-1)
- # Token-level KL散度损失
- token_loss = self.token_loss(
- pred_log_probs, # 输入需要是log probabilities
- target_probs # 目标需要是probabilities
- )
- # Length prediction loss (保持不变)
- length_loss = self.length_loss(
- preds['length'],
- targets['length']
- )
- total_loss = (self.token_weight * token_loss +
- self.length_weight * length_loss)
- return {
- 'total': total_loss,
- 'token': token_loss,
- 'length': length_loss
- }
models.py at commit 0c19bbc, under GPL-3.0 · at the source
Overview
- School of Biomedical Engineering, ShanghaiTech University Shanghai China
- State Key Laboratory of Advanced Medical Materials and Devices, ShanghaiTech University Shanghai China
- Department of Electronic Engineering, Tsinghua University Beijing China
- Shanghai Artificial Intelligence Laboratory Shanghai China
- Department of Neurological Surgery, University of California, San Francisco San Francisco United States
- Shanghai Clinical Research and Trial Center Shanghai China
- Lin Gang Laboratory Shanghai China
Abstract
Reconstructing speech from neural recordings is crucial for understanding human speech coding and developing brain-computer interfaces (BCIs). However, existing methods trade off acoustic richness (pitch, prosody) for linguistic intelligibility (words, phonemes). To overcome this limitation, we propose a dual-path framework to concurrently decode acoustic and linguistic representations. The acoustic pathway uses a long-short term memory (LSTM) decoder and a high-fidelity generative adversarial network (HiFi-GAN) to reconstruct spectrotemporal features. The linguistic pathway employs a transformer adaptor and text-to-speech (TTS) generator for word tokens. These two pathways merge via voice cloning to combine both acoustic and linguistic validity. Using only 20 min of electrocorticography (ECoG) data per human subject, our approach achieves highly intelligible synthesized speech (mean opinion score = 4.0/
Reproduced under the paper's license (CC BY), from the paper cited above.
Repository
Its files are read in the Code ↔ Paper reader above, with 2 matches between paragraphs and lines of code.
CCTN-BCI/Neural2Speech2
0c19bbc4e393ac76f565ac2059d66bdb6850a777, 16 May 2026Availability: 1 check, the latest on 30 September 2026: the link answers
- 30 September 2026: the link answers
17 files
- codes/
codes/ , Python, 191 linesDataset_fin_multi.py - codes/
codes/ , Python, 48 linesconfigs/ SAE.py - codes/
codes/ , Python, 1 linehydra_configs/ pytorch_lightning/ __init__.py - codes/
codes/ , Python, 47 lineshydra_configs/ pytorch_lightning/ callbacks.py - codes/
codes/ , Python, 1 linehydra_configs/ pytorch_lightning/ metrics/ __init__.py - codes/
codes/ , Python, 49 lineshydra_configs/ pytorch_lightning/ metrics/ classification.py - codes/
codes/ , Python, 49 lineshydra_configs/ pytorch_lightning/ metrics/ regression.py - codes/
codes/ , Python, 70 lineshydra_configs/ pytorch_lightning/ trainer.py - codes/
codes/ , Python, 164 linesmodel_lstm_and_SAE.py - codes/
codes/ , Python, 369 lines, 1 matchreconstruction.py - codes/
codes/ , Python, 98 linestrain_SAE.py - codes/
data_preprocess.py , Python, 107 lines - codes/
models.py , Python, 133 lines, 1 match - codes/
train_LLM.py , Python, 77 lines - codes/
training_funcs.py , Python, 58 lines - LICENSE, License, 674 lines
- README.md, Text, 15 lines
The paper's code and data availability statement is in the Data section.
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;
- 15 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.
Data availability
The data that support the findings of this study are available on request from the lead contact. The data are not publicly available because they could compromise research participant privacy and consent. All original code and preprocessed anonymized data to replicate the main findings of this study can be found at https://
Reproduced under the paper's license (CC BY), from the paper cited above.
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, pages, dates, 5 authors, 7 keywords, 8 MeSH terms, 4 funders, 37 references.
Cite
This paper
Li, J., Guo, C., Zhang, C., Chang, E. F., & Li, Y. (2026). High-fidelity neural speech reconstruction through an efficient acoustic-linguistic dual-pathway framework. eLife, 14, RP109400. https://
BibTeX
@article{li2026high,
author = {Li, Jiawei and Guo, Chunxu and Zhang, Chao and Chang, Edward F and Li, Yuanning},
title = {{High-fidelity neural speech reconstruction through an efficient acoustic-linguistic dual-pathway framework}},
journal = {eLife},
year = {2026},
month = mar,
volume = {14},
pages = {RP109400},
publisher = {eLife Sciences Publications, Ltd},
issn = {2050-084X},
doi = {10.7554/
url = {https://
pmid = {41784218},
pmcid = {PMC12962650}
}
RIS
TY - JOUR
AU - Li, Jiawei
AU - Guo, Chunxu
AU - Zhang, Chao
AU - Chang, Edward F
AU - Li, Yuanning
TI - High-fidelity neural speech reconstruction through an efficient acoustic-linguistic dual-pathway framework
T2 - eLife
J2 - Elife
PY - 2026
DA - 2026/
VL - 14
SP - RP109400
SN - 2050-084X
PB - eLife Sciences Publications, Ltd
DO - 10.7554/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.7554/
"type": "article-journal",
"title": "High-fidelity neural speech reconstruction through an efficient acoustic-linguistic dual-pathway framework",
"container-title": "eLife",
"author": [
{
"family": "Li",
"given": "Jiawei"
},
{
"family": "Guo",
"given": "Chunxu"
},
{
"family": "Zhang",
"given": "Chao"
},
{
"family": "Chang",
"given": "Edward F"
},
{
"family": "Li",
"given": "Yuanning"
}
],
"container-title-short":
"volume": "14",
"page": "RP109400",
"DOI": "10.7554/
"PMID": "41784218",
"PMCID": "PMC12962650",
"ISSN": "2050-084X",
"publisher": "eLife Sciences Publications, Ltd",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
3,
5
]
]
}
}
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/s41586-026-10691-5 [code]
- Mapping the neuronal building blocks of human language with language models.Journal: NatureIn common: SciPy, Matplotlib, NumPy, cognitive, 8 references
- [2] doi:10.1038/s41467-026-75455-1 [code]
- Shared latent representations of speech production for cross-patient speech decoding.Journal: Nature communicationsIn common: PyTorch Lightning, PyTorch, SciPy, 2 other tools, intracranial EEG (iEEG / ECoG / SEEG), cognitive, 4 references
- [3] doi:10.1162/imag.a.1227 [code]
- Large language models reveal the neural tracking of linguistic context in attended and unattended multi-talker speech.Journal: Imaging neuroscience (Cambridge, Mass.)In common: Hugging Face Transformers, PyTorch, SciPy, 2 other tools, intracranial EEG (iEEG / ECoG / SEEG), cognitive, 4 references
- [4] doi:10.1038/s41597-026-07248-6 [code]
- A large-scale fMRI dataset for vision-language semantic association.Journal: Scientific dataIn common: PyTorch, SciPy, Matplotlib, 1 other tool, 5 references
- [5] doi:10.1038/s41467-026-71284-4 [code]
- Encoding of speech modes and loudness in ventral precentral gyrus.Journal: Nature communicationsIn common: SciPy, Matplotlib, NumPy, cognitive, 5 references
- [6] doi:10.1162/nol.a.244 [code]
- A Novel Approach to Map the Causal Impact of Brain Stimulation on Semantic Processing With Language Models.Journal: Neurobiology of language (Cambridge, Mass.)In common: Hugging Face Transformers, PyTorch, SciPy, 2 other tools, 4 references
- [7] doi:10.7554/elife.106543 [code]
- Stimulus dependencies-rather than next-word prediction-can explain pre-onset brain encoding in naturalistic listening designs.Journal: eLifeIn common: Hugging Face Transformers, PyTorch, SciPy, 2 other tools, cognitive, 3 references
- [8] doi:10.1038/s41593-026-02258-4 [code]
- Laminar organization of cellular microcircuits modulating human interictal epileptiform discharges.Journal: Nature neuroscienceIn common: SciPy, Matplotlib, NumPy, 2 references, author Edward F Chang
- [9] doi:10.1038/s41467-026-72253-7 [code]
- Spurious alignment between large language models and brains can emerge from non-robust methods and overlooked confounds.Journal: Nature communicationsIn common: Hugging Face Transformers, PyTorch, SciPy, 2 other tools, 3 references
- [10] doi:10.1038/s41467-026-73947-8 [code]
- Frontal cortex organization supporting audiovisual processing during naturalistic viewing.Journal: Nature communicationsIn common: PyTorch, SciPy, Matplotlib, 1 other tool, intracranial EEG (iEEG / ECoG / SEEG), cognitive, 3 references
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.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 1 repository of the authors' code, each at its verified commit and with its license, 15 scripts, and 2 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:f34924a4b548cb3d…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[, paste the snippet at the top, then “Commit changes…” and, to review it first, “Create a new branch and start a pull request”. You open the pull request; OSCR asks for no permission.
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: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.
Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
