Papers › QANet: Combining Local Convolution with Global Self-Attention for Reading Comprehension

QANet: Combining Local Convolution with Global Self-Attention for Reading Comprehension

23 Apr 2018ICLR 2018 1arXiv:1804.09541archive 2025-07-28

Adams Wei Yu, David Dohan, Minh-Thang Luong, Rui Zhao, Kai Chen, Mohammad Norouzi, Quoc V. Le

Current end-to-end machine reading and question answering (Q\&A) models are primarily based on recurrent neural networks (RNNs) with attention. Despite their success, these models are often slow for both training and inference due to the sequential nature of RNNs. We propose a new Q\&A architecture called QANet, which does not require recurrent networks: Its encoder consists exclusively of convolution and self-attention, where convolution models local interactions and self-attention models global interactions. On the SQuAD dataset, our model is 3x to 13x faster in training and 4x to 9x faster in inference, while achieving equivalent accuracy to recurrent models. The speed-up gain allows us to train the model with much more data. We hence combine our model with data generated by backtranslation from a neural machine translation model. On the SQuAD dataset, our single model, trained with augmented data, achieves 84.6 F1 score on the test set, which is significantly better than the best published F1 score of 81.8.

PaperPDFConference PDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="1804.09541")

Code

Syntology Ran 7 of 19 code samples harvested from 6 repositories linked to this paper; 12 have no recorded run. Of those that ran: 3 ran · honoured contract; 3 ran · our draft was wrong; 1 ran · fixture could not drive it.

By repository: community (archive-listed): 19 samples from 6 repositories, 7 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

15 repositories listed; official and paper-mentioned ones first.

BangLiu/QANet-PyTorch mentioned on GitHubpytorchMIT report
Francois-Aubet/EQuANt mentioned on GitHubtf report
TSLNIHAOGIT/QANet_keras_debug mentioned on GitHubtf report
Tao-Mind/QDD_Net mentioned on GitHubtfMIT report
ajoshi80/QANet mentioned on GitHubpytorch report
andy840314/QANet-pytorch- mentioned on GitHubpytorch report
benywon/ComQA mentioned on GitHubpytorchApache-2.0 report
ewrfcas/QANet_keras mentioned on GitHubtf report
lottens/QA-SQuAD mentioned on GitHubpytorch report
mirbostani/QA-KD-AL mentioned on GitHubpytorch report
ni9elf/QANet mentioned on GitHubtf report
shikhar1sharma/NLP-Resources mentioned on GitHub report
yuriak/PPDAI mentioned on GitHubtf report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

19 samples harvested; 7 ran; 3 honoured the contract we drafted; 12 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

3ran · honoured contract
3ran · our draft was wrong
1ran · fixture could not drive it
12unverified

Licence: 2 of the 19 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 6 repositories linked to this paper, official or community; each sample names its own and says which. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

PosEncoder andy840314/QANet-pytorch-/models.py community (archive-listed) ran · fixture could not drive it MIT (permissive) · 5c8c86edd3d3e783 · report
clones BangLiu/QANet-PyTorch/model/modules/attention.py community (archive-listed) ran · our draft was wrong MIT (permissive) · cf78c734df121970 · report
convert_idx Francois-Aubet/EQuANt/prepro.py community (archive-listed) ran · honoured contract no licence file found · pointer only · 2a6a9ea511d97648 · report
get_timing_signal mirbostani/QA-KD-AL/qa/model/qanet.py community (archive-listed) ran · honoured contract fingerprinted MIT (permissive) · f82361ad7330d575 · report
get_timing_signal andy840314/QANet-pytorch-/models.py community (archive-listed) ran · honoured contract fingerprinted MIT (permissive) · d2e8e18023f286ab · report
mask_logits mirbostani/QA-KD-AL/qa/model/qanet.py community (archive-listed) ran · our draft was wrong MIT (permissive) · 9dc49f46edd7a69d · report
mask_logits andy840314/QANet-pytorch-/models.py community (archive-listed) ran · our draft was wrong MIT (permissive) · dea46bb8718e5def · report
OpenAITransformer_loss BangLiu/QANet-PyTorch/trainer/loss.py community (archive-listed) unverified MIT (permissive) · 73f7bc81c21d46f4 · report
PosEncoder mirbostani/QA-KD-AL/qa/model/qanet.py community (archive-listed) unverified MIT (permissive) · ee4ade0d8bcf356a · report
add_dense_layer Tao-Mind/QDD_Net/models/layers.py community (archive-listed) unverified MIT (permissive) · edf10b1abda15159 · report
biGRUs Tao-Mind/QDD_Net/models/layers.py community (archive-listed) unverified MIT (permissive) · d6c2afca4b825f12 · report
convert_idx BangLiu/QANet-PyTorch/data_loader/SQuAD.py community (archive-listed) unverified MIT (permissive) · 23587f1e97b0e35d · report
crop_pad Tao-Mind/QDD_Net/pre_process.py community (archive-listed) unverified MIT (permissive) · 32abbed1f309ad9f · report
dot_attention Tao-Mind/QDD_Net/models/layers.py community (archive-listed) unverified MIT (permissive) · 96be8bbb7b022500 · report
filter_func BangLiu/QANet-PyTorch/data_loader/SQuAD.py community (archive-listed) unverified MIT (permissive) · c4d748327c33e6cc · report
get_ids Tao-Mind/QDD_Net/pre_process.py community (archive-listed) unverified MIT (permissive) · fc42ce0856c29480 · report
get_texts Tao-Mind/QDD_Net/pre_process.py community (archive-listed) unverified MIT (permissive) · fdbd06a820d2930d · report
highway annaorosz/my_qanet_implementation/QANet_keras.py community (archive-listed) unverified no licence file found · pointer only · 9549014140b95768 · report
my_loss BangLiu/QANet-PyTorch/trainer/loss.py community (archive-listed) unverified MIT (permissive) · cb4ce684e3929e65 · report

Tasks

Machine TranslationQuestion AnsweringReading ComprehensionTranslation

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Question Answering SQuAD1.1 QANet + data augmentation ×3 EM 76.2 #111 of 213 Archive leaderboard report
Question Answering SQuAD1.1 QANet + data augmentation ×3 F1 84.6 #111 of 213 Archive leaderboard report
Question Answering SQuAD1.1 dev QANet (data aug x3) EM 75.1 #27 of 55 Archive leaderboard report
Question Answering SQuAD1.1 dev QANet (data aug x3) F1 83.8 #27 of 55 Archive leaderboard report
Question Answering SQuAD1.1 dev QANet (data aug x2) EM 74.5 #28 of 55 Archive leaderboard report
Question Answering SQuAD1.1 dev QANet (data aug x2) F1 83.2 #28 of 55 Archive leaderboard report
Question Answering SQuAD1.1 dev QANet EM 73.6 #30 of 55 Archive leaderboard report
Question Answering SQuAD1.1 dev QANet F1 82.7 #30 of 55 Archive leaderboard report

Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.

Methods

Convolution

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections