Data · dataset · 2025
Quantum-Enhanced Multi-Head Attention for Hybrid Classical-Quantum Neural Networks
Listed in Teesside University Research Data Repository
This code integrates quantum-inspired computations into a deep learning pipeline to classify images from the CIFAR-10 dataset.
Description
It combines traditional neural network layers with a quantum multi-head attention mechanism, leveraging the capabilities of both classical and quantum approaches. The model utilizes PyTorch for defining and training the network, while Qiskit and Qiskit Aer simulate quantum circuits for the quantum-inspired components.
The CIFAR-10 dataset is preprocessed using torchvision, with subsets created for efficient training and validation. The quantum multi-head attention mechanism is implemented as a custom PyTorch autograd function, QuantumMultiHeadAttentionFunction. This function defines the forward and backward passes, where data is encoded into quantum circuits and parameter updates are computed using finite-difference approximation.
Read the rest (3 more)
The function relies on Z-expectation values of qubits, simulated using Qiskit Aer's statevector simulator. These computations are encapsulated in the QuantumMultiHeadAttentionLayer, which integrates seamlessly with PyTorch's module structure. The core model, HybridAttentionCIFAR, consists of a combination of convolutional layers, a linear embedding layer, the quantum attention layer, and a fully connected output layer.
The convolutional layers extract features from input images, which are then transformed into embeddings compatible with the quantum attention layer. The quantum attention mechanism processes these embeddings, enhancing feature representation, and the final fully connected layer maps the processed embeddings to class logits for classification. The get_cifar_subset function prepares the CIFAR-10 data, creating small subsets for training and validation.
These subsets are batched using PyTorch's DataLoader. The train_cifar_qattn function orchestrates the training process, configuring the model, optimizer, and loss function. Over multiple epochs, it computes training and validation losses and accuracies, updating model parameters using the Adam optimizer.
Links
Where it is published
- DOI doi.org/10.17632/z5wcdpc45g.1 ↗
DOI / persistent id · from researchdata tees ac uk
Catalogue records · 1
- OAI-PMH record data.mendeley.com/oai?verb=GetRecord&metadataPrefix=oai_dc&identifier=oai%3Adata… ↗
metadata API · from researchdata tees ac uk
Topics
- From keywords
- Artificial intelligence · Computer Science & AI · Earth & Environmental Science · Engineering · Humanities · Life Sciences · Machine learning · Physics · Social Science
- Inferred from text
- Image 65%
Provenance · 1 source records, 15 field assertions
| Source | Key | Last seen | Raw |
|---|---|---|---|
| Teesside University Research Data Repository | oai:data.mendeley.com/z5wcdpc45g.1 | 9 d ago | JSON v1 |
| Field | Assertion | Extractor | Evidence |
|---|---|---|---|
| access_level | source · researchdata tees ac uk | connector:researchdata_tees_ac_uk@1.0.0 | |
| concepts[field].anzsrc:group:4602 | mapping · researchdata tees ac uk | vocabulary-mapper@1.0.0 | keywords['Artificial Intelligence'] |
| concepts[field].anzsrc:group:4611 | mapping · researchdata tees ac uk | vocabulary-mapper@1.0.0 | keywords['Machine Learning'] |
| concepts[field].local:field:computer-science-ai | mapping · researchdata tees ac uk | connector:researchdata_tees_ac_uk@1.0.0 | |
| concepts[field].local:field:earth-environmental | mapping · researchdata tees ac uk | connector:researchdata_tees_ac_uk@1.0.0 | |
| concepts[field].local:field:engineering | mapping · researchdata tees ac uk | connector:researchdata_tees_ac_uk@1.0.0 | |
| concepts[field].local:field:humanities | mapping · researchdata tees ac uk | connector:researchdata_tees_ac_uk@1.0.0 | |
| concepts[field].local:field:life-sciences | mapping · researchdata tees ac uk | connector:researchdata_tees_ac_uk@1.0.0 | |
| concepts[field].local:field:physics | mapping · researchdata tees ac uk | connector:researchdata_tees_ac_uk@1.0.0 | |
| concepts[field].local:field:social-science | mapping · researchdata tees ac uk | connector:researchdata_tees_ac_uk@1.0.0 | |
| concepts[modality].local:modality:image | enrichment · researchdata tees ac uk | keyword-concept-rules@1.0.0 | title+description (65%) |
| description | source · researchdata tees ac uk | connector:researchdata_tees_ac_uk@1.0.0 | /metadata/dc/description |
| license | source · researchdata tees ac uk | connector:researchdata_tees_ac_uk@1.0.0 | /metadata/dc/rights |
| publication_date | source · researchdata tees ac uk | connector:researchdata_tees_ac_uk@1.0.0 | |
| title | source · researchdata tees ac uk | connector:researchdata_tees_ac_uk@1.0.0 | /metadata/dc/title |