Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

🔐 Enhanced SecureDSC — Secure Deep Semantic Communication

Python 3.8+ PyTorch 2.0+

B.Tech Project — Extends the SecureDSC framework by Shi et al. (IEEE Communications Letters, March 2025) with physical-layer key generation and adaptive adversarial training.


Overview

This project implements and enhances a secure wireless semantic communication system where:

  • Alice (transmitter) sends text messages to Bob (receiver) over a noisy wireless channel
  • Eve (eavesdropper) intercepts the same channel symbols but cannot reconstruct the content
  • Security is achieved through adversarial training with an integrated encryption module

What's New (Our Enhancements)

# Enhancement Replaces Impact
1 CSI-Based Dynamic Key Generation Random session keys Eliminates key distribution bottleneck
2 Adaptive λ Scheduler Fixed λ = 6 Self-tuning adversarial loss, +5.2% Bob BLEU-1

Architecture

graph LR
    CSI["CSI Channel Estimates<br/>(h_A ≈ h_B by reciprocity)"] --> KG["CSI Key Generator<br/>★ Enhancement 1"]
    KG --> KEY["key_A / key_B"]
    A["m (Source Text)"] --> B["Semantic Encoder<br/>4× Transformer Layers"]
    B --> C["Encryptor<br/>(key_A from CSI)"]
    C --> D["Channel Encoder"]
    D --> E["AWGN Channel"]
    E --> F["Channel Decoder (Bob)"]
    F --> G["Decryptor<br/>(key_B from CSI)"]
    G --> H["Semantic Decoder<br/>4× Transformer Layers"]
    H --> I["m̂ (Reconstructed)"]
    E --> J["Channel Decoder (Eve)"]
    J --> K["Decryptor<br/>(random key — no CSI)"]
    K --> L["Semantic Decoder (Eve)"]
    L --> M["m̄ (Eve's attempt)"]
    SCHED["Adaptive λ Scheduler<br/>★ Enhancement 2"] -.-> LOSS["Joint Loss Computation"]
Loading

Results & Analysis

For a comprehensive breakdown of the training process, evaluation metrics (including BLEU scores and Key Agreement Rate), and a detailed comparison with the base paper, please refer to the Project Analysis & Comparison Document.


Project Structure

Enhanced-SecureDSC/
├── model.py                           # Full model architecture (472 lines)
│   ├── SemanticEncoder / Decoder      #   4× Transformer layers, d_model=128
│   ├── Encryptor / Decryptor          #   Key-conditioned encryption modules
│   ├── ChannelEncoder / Decoder       #   Dense JSCC layers
│   ├── CSIKeyGenerator                #   ★ MLP: ℂ^64 → {-1,+1}^64
│   ├── AdaptiveLambdaScheduler        #   ★ Bang-bang controller
│   └── SecureDSC                      #   End-to-end system class
├── train.py                           # 4-phase adversarial training loop
├── evaluate.py                        # BLEU scoring + key agreement evaluation
├── preTokenize.py                     # EuroParl pre-tokenization script
├── requirements.txt                   # Dependencies (PyTorch, Transformers)
├── eval_results.json                  # Final evaluation metrics
├── training_history.json              # Epoch-by-epoch training logs
└── project_analysis_and_comparison.md # Detailed technical analysis

Getting Started

Prerequisites

  • Python 3.8+
  • NVIDIA GPU with CUDA 12.1+ (recommended)

Installation

# Clone the repository
git clone https://github.com/krish-kedia/Enhanced-SecureDSC.git
cd Enhanced-SecureDSC

# Create and activate virtual environment
python -m venv venv
# Windows:
.\venv\Scripts\activate
# Linux/Mac:
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

Training

# Full training (150 epochs, ~1.96M sentences)
python train.py --epochs 150 --snr 12 --batch_size 512

# Quick test run
python train.py --epochs 5 --snr 12 --batch_size 64 --dataset_size 500

Evaluation

python evaluate.py --model_path securedsc_enhanced.pt --snr_range 0 3 6 9 12 15

Training Details

  • 4-phase alternating schedule: Semantic codec → Encryption/Decryption → Full joint (adversarial) → Eve independently
  • Optimizer: Adam (lr=2.5×10⁻⁴, β₁=0.9, β₂=0.98)
  • Dataset: EuroParl EN-FR (English side), seq_len=20, 90/10 train/test split
  • Tokenizer: BERT-base-uncased (30,522 vocab)
  • Gradient clipping: max_norm=1.0

Citation

If you use this work, please cite the base paper:

@article{shi2025secure,
  title     = {Secure Transmission in Wireless Semantic Communications With Adversarial Training},
  author    = {Shi, Jiting and Zhang, Qianyun and Zeng, Weihao and Qin, Zhijin},
  journal   = {IEEE Communications Letters},
  volume    = {29},
  number    = {3},
  pages     = {487--491},
  year      = {2025},
  publisher = {IEEE}
}

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages