Skip to content

Model Architecture ​

SoraSR uses a three-stage restoration topology: Shallow Feature Extraction, Deep Hybrid Residual-Attention Body, and Sub-Pixel Reconstruction. This separation preserves low-frequency color fidelity via a long skip connection while focusing network capacity on high-frequency edge and texture synthesis.

High-Level Data Flow ​

text
LR Input (B, 3, H, W)
  │
  ├─► Shallow Conv 3×3 ──────────────────────────┐ (Long Residual Skip)
  │         │                                    │
  │         ▼                                    │
  │   [ Stage 1..N: Hybrid Residual Group ]      │
  │     ├─ Local Multi-Scale Depthwise Block     │
  │     ├─ Shifted-Window Multi-Head Attention   │
  │     └─ Gated Feed-Forward Network (GFFN)     │
  │         │                                    │
  │         ▼                                    │
  │   Body Conv 3×3 ─────────── (+) ◄────────────┘
  │                              │
  │                              ▼
  │                 PixelShuffle Upsampler (×2 / ×4)
  │                              │
  │                              ▼
  └─────────────────────► SR Output (B, 3, sH, sW)

Shallow Feature Extraction ​

Given a low-resolution input tensor ILR∈RB×3×H×W, a single 3×3 convolution projects RGB values into the embedding dimension C:

F0=HSF(ILR)∈RB×C×H×W

Using an unnormalized linear projection at the entry prevents early clipping of subtle luminance gradients and stabilizes residual addition across deep stages.

Hybrid Residual-Attention Group (HRAG) ​

Pure convolutional backbones have limited receptive fields on repetitive architectural textures, whereas pure Vision Transformers incur quadratic attention overhead and struggle with sharp local sub-pixel alignment. Each HRAG block couples both mechanisms in parallel:

1. Local Multi-Scale Depthwise Branch ​

Splits channels into three groups processed by 3×3, 5×5, and dilated 3×3 (d=2) depthwise convolutions followed by a 1×1 channel mixer and Squeeze-and-Excitation recalibration. This branch captures fine edges and high-frequency aliasing patterns at minimal FLOP cost.

2. Windowed Self-Attention Branch ​

Partitions features into non-overlapping M×M windows (typically M=8 or M=16) and alternates regular and shifted window partitions across consecutive blocks:

Attn(Q,K,V)=Softmax(QK⊤dh+Brel)V

where Brel is a learnable 2D relative position bias table. Keeping window size fixed makes attention complexity linear in spatial resolution, O(HWM2C).

3. Gated Feed-Forward Network (GFFN) ​

Replaces the standard two-layer MLP with a depthwise-enhanced gating unit:

GFFN(X)=Wp(GELU(D1(W1X))⊙D2(W2X))

Elementwise gating suppresses noise amplification on smooth backgrounds such as sky or studio gradients.

Sub-Pixel Reconstruction Head ​

Rather than transposed convolutions (which introduce checkerboard artifacts), SoraSR uses progressive PixelShuffle upsampling. For 4× restoration, two consecutive 2× sub-pixel blocks (Conv3x3 -> PixelShuffle(2) -> LeakyReLU) expand spatial resolution cleanly before a final 3×3 RGB refinement layer.

Architectural Constraints for Export ​

To guarantee clean ONNX and TensorRT conversion:

  • Input dimensions are padded internally to multiples of window size M and cropped back after upsampling.
  • Relative position indices are precomputed as constant buffers for static exports or computed via pure tensor ops for dynamic shapes.
  • All normalization layers use LayerNorm with explicit epsilon (1e-5) and avoid custom fused CUDA ops during export mode.

Released under the Apache-2.0 License.