SBL-NET (Scalar Bilinear Linear Network)

A hybrid PyTorch neural network designed to highly accurately compute the scalar (dot) product of split sub-vectors without any data normalization (Z-score, etc.).

๐Ÿ”ฌ Architecture & Features

The main highlight of this model is the integration of a rare bilinear layer (nn.Bilinear) at the input stage, combined with classic fully connected layers (nn.Linear) and the SELU activation function.

  • The network accepts an input tensor of shape [batch, 4] and splits it into two vectors: A [batch, 2] and B [batch, 2].
  • The bilinear layer efficiently extracts cross-features between the vectors, allowing the model to reduce the error to an impressive 0.185%.

๐Ÿ“Š Training Results

  • Loss Function: Smooth L1 Loss
  • Optimizer: Adam (with StepLR scheduler)
  • Error Rate: ~0.185%
  • Extreme Test Case:
    • Input: [[-6.0, 70.0, 4.0, -196.0]]
    • Expected Mathematical Answer: -13744.0000
    • Actual Network Prediction: -13769.5225

๐Ÿงฎ Model Statistics

  • Total Parameters: 52,101
  • Trainable Parameters: 52,101
  • Non-trainable Parameters: 0
  • Model Size: ~208 KB (Weights in FP32)
  • Input Shape: [batch_size, 4]
  • Output Shape: [batch_size, 1]

๐Ÿ’ป How to Use

You can download the architecture file and the model weights directly from this repository:

import torch as t
import torch.nn as nn
import torch.optim as opt
from torch.utils.data import DataLoader, Dataset

class WebAISC(nn.Module):

    def __init__(self):
        super().__init__()
        self.bilinear = nn.Bilinear(in1_features=2, in2_features=2, out_features=250)

        self.x2 = nn.Linear(250, 100)
        self.x3 = nn.Linear(100, 250)
        self.x4 = nn.Linear(250, 1)
        self.selu = nn.SELU()

    def forward(self, x):
        a = x[:, 0:2]
        b = x[:, 2:4]

        x = self.selu(self.bilinear(a, b))

        x = self.selu(self.x2(x))
        x = self.selu(self.x3(x))
        x = self.x4(x)
        return x

model = WebAISC()

test_input = t.tensor([[-6.0, 70.0, 4.0, -196.0]], dtype=t.float32)
with t.no_grad():
    prediction = model(test_input)
    print(f"Model prediction: {prediction.item():.4f}")
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support