Features · Neural networks

Neural networks in BESSER.

Model and generate neural networks within the same BESSER low-code workflow. Define your architecture, validate it, and generate runnable PyTorch or TensorFlow code at the click of a button.

Visual NN editor

The BESSER Web Modeling Editor supports the NN diagram type directly in the browser. Layers, tensor operations, datasets and the training configuration can all be dragged and dropped onto the canvas. Code for PyTorch and TensorFlow can then be generated directly from the editor.

  • No installation needed
  • Drag and drop layers, tensor operations, datasets and configuration
  • Generate code directly from the editor
Read the docs
editor.besser-pearl.org — CIFAR-10 CNN
BESSER NN editor — CIFAR-10 CNN

From model to complete code

When Training and Test Dataset are specified in the NN model, the generators produce the full training and evaluation code alongside the network architecture. This covers dataset preparation and preprocessing, loss function and optimizer setup, the training loop, model evaluation and model saving.

  • Dataset preparation and preprocessing
  • Loss function, optimizer setup and training loop
  • Model evaluation and saving
Read the docs
generated/pytorch/model.py
# Define the network architecture
class NeuralNetwork(nn.Module):
    def __init__(self):
        super().__init__()
        self.l1 = nn.Conv2d(in_channels=3, out_channels=32, kernel_size=(3, 3), stride=(1, 1), padding=0)
        self.actv_func_relu = nn.ReLU()
        self.l2 = nn.MaxPool2d(kernel_size=(2, 2), stride=(2, 2), padding=0)
        self.l3 = nn.Conv2d(in_channels=32, out_channels=64, kernel_size=(3, 3), stride=(1, 1), padding=0)
        self.l4 = nn.MaxPool2d(kernel_size=(2, 2), stride=(2, 2), padding=0)
        self.l5 = nn.Conv2d(in_channels=64, out_channels=64, kernel_size=(3, 3), stride=(1, 1), padding=0)
        self.l6 = nn.Flatten(start_dim=1, end_dim=-1)
        self.l7 = nn.Linear(in_features=1024, out_features=64)
        self.l8 = nn.Linear(in_features=64, out_features=10)


    def forward(self, x):
        x = self.l1(x)
        x = self.actv_func_relu(x)
        x = self.l2(x)
        x = self.l3(x)
        x = self.actv_func_relu(x)
        x = self.l4(x)
        x = self.l5(x)
        x = self.actv_func_relu(x)
        x = self.l6(x)
        x = self.l7(x)
        x = self.actv_func_relu(x)
        x = self.l8(x)
        return x

# … plus dataset prep, the training loop, evaluation & model saving
More capabilities

And the rest of the toolkit.

Walkthrough

Watch it end to end

Model a CIFAR-10 CNN on the canvas, then generate the PyTorch or TensorFlow training code — in one short take.

editor.besser-pearl.org — model → generate

Framework-agnostic metamodel

The B-UML NN metamodel represents neural network architectures independently of any specific implementation framework. Both sequential and non-sequential network structures are supported, making it adaptable across a wide range of neural network development contexts.

  • Abstract representation of NN architectures
  • Supports sequential and non-sequential NN structures
  • Framework-independent
Read the docs

Rich layer catalog

The metamodel supports a wide range of layer types, from convolutional and pooling layers to recurrent, normalization and utility layers. Each layer type comes with its own set of parameters to fully define its behavior.

  • Convolutional: Conv1D, Conv2D, Conv3D and PoolingLayer
  • Recurrent: SimpleRNNLayer, LSTMLayer and GRULayer
  • Utility: FlattenLayer, EmbeddingLayer and DropoutLayer, etc.
Read the docs

Tensor operations

Tensor operations are treated as full modules within the network, positioned and ordered alongside layers. They take the outputs of one or more layers and pass the result to the next module in the data flow.

  • Apply operations on layer outputs
  • Reshape and reorder tensor dimensions
  • Build complex, non-sequential data flows
Read the docs

2 frameworks, 4 architectural styles

The PyTorch and TensorFlow generators each support two architectural styles: subclassing and sequential. The same B-UML model is used to generate code for any combination of framework and architectural style.

  • PyTorch: Subclassing and Sequential
  • TensorFlow: Subclassing and Sequential
  • Same B-UML model used across all combinations
Read the docs

Built-in validation

The NN model includes a built-in validation mechanism that checks the model against a comprehensive set of rules and reports any errors and warnings. The Web Modeling Editor also provides the same checks through its Validate action.

  • Layer and module naming correctness
  • Sub-network cycle detection
  • Numerical bounds and dataset configuration warnings

Neural network code migration

The B-UML NN metamodel serves as a framework-independent intermediate representation that enables automatic migration between PyTorch and TensorFlow. Both sequential and subclassing architectures are supported in both directions.

  • Migrate from PyTorch to TensorFlow and vice versa
  • Support sequential and subclassing architectures
  • Fully automated
Learn more