Train error decreases consistently, but test error does not, even when test dataset is a subset of train dataset

My data comprise of 6 features coming from sensors. I am training an LSTM network on this data to predict three values.
During training, my training loss was consistently decreasing with each epoch, but test loss did not decrease much after couple of epochs.
This was the case when there was no overlap between training and test data. So I tried using subset of training data as test data.
But, still the same behavior, the test loss was still not decreasing.

Below is the code for LSTM model and trainer.

class LSTMModel(nn.Module):
    def __init__(self, in_dim=6, hidden_size=200, num_layers=1, output_size=3):
        super(LSTMModel, self).__init__()
        self.lstm_1 = nn.LSTM(in_dim, hidden_size, num_layers, batch_first=True) #, return_sequences=True)
        self.lstm_2 = nn.LSTM(hidden_size, hidden_size, num_layers, batch_first=True)
        self.lstm_3 = nn.LSTM(hidden_size, hidden_size, num_layers, batch_first=True)
        self.lstm_4 = nn.LSTM(hidden_size, hidden_size, num_layers, batch_first=True)
        self.fc = nn.Linear(hidden_size, output_size)

    def forward(self, x):
        x, _ = self.lstm_1(x)
        x, _ = self.lstm_2(x)
        x, _ = self.lstm_3(x)
        x, _ = self.lstm_4(x)
        output = self.fc(x[:, -1, :])
        return output
    
class SimpleModelTrainer:
    def __init__(self, model, train_dataset, test_dataset, batch_size=1024, epochs=100, lr=0.005): # window_size=200, do_windowing=True, patience=5, pad_testing_data = False

        self.model = model
        self.optimizer = AdamW(params=self.model.parameters(), lr=lr)

        self.lr = lr
        self.epochs = epochs
        # self.patience = patience
        self.batch_size = batch_size
        # self.do_windowing = do_windowing
        # self.window_size = window_size
        self.loss_fn = nn.L1Loss()
        # self.stop_early = False
        self.train_data = train_dataset
        self.test_data = test_dataset

    def train(self):
        self.train_dataloader = torch.utils.data.DataLoader(self.train_data, batch_size=self.batch_size, shuffle=True, generator=torch.Generator(device=device))
        self.test_dataloader = torch.utils.data.DataLoader(self.test_data, batch_size=self.batch_size, shuffle=True, generator=torch.Generator(device=device))
        total_samples = 0

        for epoch in tqdm(range(self.epochs), desc="epoch"):
            self.model.train()
            total_loss = 0
            
            for train_data in tqdm(self.train_dataloader, desc="train"):

                X = train_data[0]
                Y = train_data[1]

                if X.shape[0] != self.batch_size: continue # to avoid RuntimeError: shape '[16, 1, 256]' is invalid for input of size 3328

                total_samples += self.batch_size

                y_hat = self.model(X)

                loss = self.loss_fn(y_hat, Y)
                self.optimizer.zero_grad()
                loss.backward()
                self.optimizer.step()
                total_loss += loss.item()

            avg_train_loss = total_loss / total_samples
            val_loss = self.test(self.test_dataloader)
            print(f"Epoch {epoch} - Train loss:{avg_train_loss:.10f}, Val loss:{val_loss:.10f}")

    def test(self, dataloader):
        self.model.eval()
        with torch.no_grad():
            total_loss = 0
            total_samples = 0
            for test_data in tqdm(dataloader, desc="test"):
                X = test_data[0]
                Y = test_data[1]

                if X.shape[0] != self.batch_size: continue # to avoid RuntimeError: shape '[Y, 200, 6]' is invalid for input of size Z

                total_samples += self.batch_size 

                y_hat = self.model(X)

                loss = self.loss_fn(y_hat, Y)
                total_loss += loss.item()

            val_loss = total_loss/total_samples
            return val_loss

I tried this with randomly generated dummy dataset. It gave exactly the same behavior as above!
You can check it in this colab notebook.

As you can see in the notebook, the validation loss is stuck at 0.00048 since first epoch. But training loss consistently decreases with each epoch from 0.00048 to 0.000016 in 28 th epoch.
(Its still training while I am writing this question.) The test dataset is the subset of training dataset:

train_dataset = CustomDataset(windowed_input_data, windowed_target_data)
test_dataset = CustomDataset(windowed_input_data[:20000], windowed_target_data[:20000])

Hence, I believe I should get similar behavior with the validation loss and validation loss should also reach approx 0.00001. I guess I have done some stupid mistake with the code (wrong pytorch API call?) and my eyes are simply not ready to help me out. Can someone help me out please? Did I miss something conceptually?

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật