Posts

Showing posts with the label MOE

Mixture Of Experts Architecture with PyTorch & ONNX Pt. 1: The Model | ML Engineering & MLOps

Image
  Hi All Mixture of Experts is a ML technique where multiple expert networks ( learners ) are used to divide a problem space into homogeneous regions. MoE represents a form of ensemble learning. They were also called committee machines.   Both the experts and the weighting function are trained by minimizing some loss function, generally via gradient descent . There is much freedom in choosing the precise form of experts , the weighting function, and the loss function.   This model uses BERT's transformer architecture as the base (BERT LARGE around 350M params), and implements a Mixture of Experts architecture with 8 experts by default.    The model.py source  and architecture detailed below. The full PyTorch, ONNX MoE application source code can be found here .       1. Expert Network ( ` Expert ` class)  class Expert(nn.Module): """A single expert network (feed-forward network)""" def __init__(self, input_d...