Write clean, bug-free Python/PyTorch code for a research model.
Implement research_model(sequences, mask, weight, bias). Each sequence has shape [length, features], and mask marks valid tokens with 1 or padding with 0. Compute the masked mean feature vector for every batch item, then apply the affine transformation weight @ pooled + bias, where weight has shape [outputs, features]. Return a nested Python list of floats.
def research_model(sequences, mask, weight, bias):