{"slug": "modular-reintroducing-maxs-module", "title": "Modular: Reintroducing MAX’s Module", "summary": "Modular rebuilt MAX's Module API on a new Eager execution layer, letting developers run models like Gemma 4 without paying graph compilation costs on every unit test or debug log, the company said in a November 19, 2026 engineering post by Kathy Wu and Alister Burt. The redesigned Module drops the super().__init__() call and uses plain Tensors instead of nn.Parameter, making it familiar to anyone who has written a PyTorch model, while the built-in compile method preserves MAX's production inference path. Modular said the change targets faster iteration during development without sacrificing the cross-architecture Mojo kernels and graph compilation that underpin MAX's performance.", "body_md": "Inference Products\n\nShared Endpoints\n\nAccess frontier models via an API\n\nDedicated Endpoints\n\nReserved GPUs. Pay per minute.\n\nCustom Models\n\nYour models. Our optimized stack.\n\nDeployment Options\n\nOur Cloud\n\nFully managed, pay by usage\n\nYour Cloud\n\nRun in your VPC. Keep your data.\n\nPricing\n\nFlexible plans for any use case\n\nSolutions\n\nText to audio\n\nImage generation\n\nCode generation\n\nVideo generation\n\nAgentic\n\nCase studies\n\nModel Library\n\nOpen source models. Deploy in seconds.\n\nDeepSeek V4.1 Flash 1017\n\nFLUX.2 Klein 4B\n\nGLM 5.3 Flash\n\nMiniMax M3.1 Flash\n\nMiniMax M3\n\nGLM 5.3\n\nYour own model\n\nView all models\n\nDay 0 access toopen frontier models.\n\nDedicated support foryour own model.\n\nLLM Inference Handbook\n\nLearn how inference works\n\nMAX\n\nLLM Book\n\nBuild a modern LLM from scratch\n\nPricing\n\nFlexible plans for any use case\n\nMojo\n\nQuest\n\nLearn Mojo with guided challenges\n\nMojo\n\nGPU Puzzles\n\nHands-on GPU code in Mojo\n\nMAX\n\nGenAI native modeling & serving\n\nMojo\n\nThe systems language for the AI era\n\nModular Alliance Program\n\nLLVM, but for AI\n\nSelf-Hosted\n\nRun MAX & Mojo on your hardware\n\nAgent Skills\n\nOur official skills for coding agents\n\nCommunity\n\nBuild the future of AI together\n\nModular Cloud\n\nDeploy GenAI models, our cloud or yours\n\nMAX\n\nGenAI native modeling & serving\n\nMojo\n\nThe systems language for the AI era\n\nAbout\n\nBuild AI for anyone, anywhere\n\nCareers\n\n👋 We’re currently hiring!\n\nCulture\n\nWhat we believe\n\nContact Us\n\nRequest a demo\n\nNovember 19, 2026\n\nKathy Wu\n\nAlister Burt\n\nEngineering\n\nMAX is built for production inference at maximum speed. We recently redesigned our Module API to help developers build fast models even faster. Module is a standard building block in machine learning frameworks, and this post explains how and why we rebuilt this API, diving into a few key aspects:\n\nModule\n\nModule\n\nModule\n\nModule\n\nModule\n\nModular has focused on production inference with state-of-the-art performance. MAX's advantage is its compilation stack: cross-architecture, optimized Mojo kernels, plus graph compilation and execution that aggressively fuse kernels and plan memory.\n\nThe legacy Module was built directly on our graph stack. The graph-forward approach delivered excellent performance, but the developer experience left room for improvement. We closed the gap by introducing a new Eager layer on top of the graph stack, then rebuilding Module on top of it.\n\nModule\n\nModule\n\nIf you've written a PyTorch model, the new Module should feel familiar. Here is the same layer in MAX and in PyTorch:\n\nModule\n\n``` python\n# MAX\nfrom max.nn import Module\nfrom max.tensor import Tensor\n\nclass MyLayer(Module):\n    def __init__(self, in_dim, out_dim):\n        self.weight = Tensor.zeros([out_dim, in_dim])\n        self.bias = Tensor.zeros([out_dim])\n\n    def forward(self, x):\n        return x @ self.weight.T + self.bias\npython\n# PyTorch\nimport torch\nfrom torch import nn\n\nclass MyLayer(nn.Module):\n    def __init__(self, in_dim, out_dim):\n        super().__init__()\n        self.weight = nn.Parameter(torch.zeros(out_dim, in_dim))\n        self.bias = nn.Parameter(torch.zeros(out_dim))\n\n    def forward(self, x):\n        return x @ self.weight.T + self.bias\n```\n\nThe differences are intentional simplifications of the design: no super().__init__() call, and plain Tensors instead of nn.Parameter.\n\nsuper().__init__()\n\nTensor\n\nnn.Parameter\n\nAgents have fundamentally changed the development cycle. While model performance remains critical for production workloads, enabling fast iteration during development is arguably more important than ever. Paying a compilation cost on every unit test and debug log is painful.\n\nEager execution avoids expensive graph compilation and instead starts computing results immediately. When you first run Gemma 4 using the new Module your first token appears much more quickly.\n\nModule\n\nDebugging models also gets a lot faster!\n\nModule\n\nThe redesigned Module still serves our primary use case, production inference. The built-in compile method traces the model and compiles it as a graph, which lets MAX optimize the computation using knowledge about the whole model. Our graph compiler performs:\n\nModule\n\ncompile\n\nModule directly supports both eager and compiled execution, so model authors get the best of both worlds:\n\nModule\n\n```\nmodel = DeepSeekV3(config)\n\n# Option 1: Call eagerly\nmodel.load_state_dict(state_dict)\nmodel(inputs)\n\n# Option 2: Compile, then call\ncompiled = model.compile(*input_types, weights=state_dict)\ncompiled(inputs)\n```\n\nThe redesign was a chance to rethink how we write distributed models. The framework's role is to structure the scaling of a computation from a single GPU to many.\n\nThere is no single right way to do that. Many parallelism strategies exist because GPUs differ in compute and memory limits, models differ in layers and dimensions, and inputs differ in shape. Here are several ways to distribute a model:\n\nLower-level abstractions in MAX can now express data parallelism, pipeline parallelism, or tensor parallelism. A Tensor is still a logical N-D array, but it can now live on more than one device. Operations on distributed tensors behave according to specific sharding rules.\n\nTensor\n\nA future post will dive deeper into the specifics of our distributed computation support. For now, see below how a row parallel linear layer is implemented:\n\nA Module is now a Tree, a new API in MAX inspired by JAX’s Pytrees. Trees are made of Modules and Tensors which simplifies two things:\n\nModule\n\nTree\n\nTree\n\nModule\n\nTensor\n\nModule.parameters\n\nModule.descendants\n\nModule\n\nTensor\n\nModule.trace\n\nModule.compile\n\ntree.map\n\nTensor\n\nThese APIs also indirectly help with serialization: tree flatten produces both the flattened leaves and a TreeDef object that stores the tree structure.\n\nflatten\n\nTreeDef\n\nAs an example, we use Tree.map to quantize only the expert layers in a mixture-of-experts model.\n\nTree.map\n\nWe also removed abstractions and boilerplate that were no longer needed.\n\nNo symbolic Weight class. Weight existed to track and create weights in the graph. Now you use Tensor directly in a Module.\n\nWeight\n\nWeight\n\nTensor\n\nModule\n\nDefault dtype and device. The layer at the top of this post defines neither. A default dtype and device context manager means a model that uses one device or dtype everywhere doesn't need to pass them to every layer. You can still set them per layer when needed.\n\ndtype\n\ndevice\n\ndtype\n\ndevice\n\nBuilt-in compile. Graph construction boilerplate is gone. Every Module now has a compile method, covered in the production inference section above.\n\ncompile\n\nModule\n\ncompile\n\nThe legacy Module implementation now lives in max.nn.legacy and will be removed in Q1 2027, so now is a good time to migrate your existing models. We’re also restructuring max.nn around the new max.tensor and max.functional libraries.\n\nModule\n\nmax.nn.legacy\n\nmax.nn\n\nmax.tensor\n\nmax.functional libraries.\n\nThe best place to get started is the Model Bringup Workflow tutorial, which walks through building a model end to end with the new APIs.\n\nLooking ahead, 2027 brings quantization, training, and multi-node support. Next in this series is a framework overview showing where MAX fits in the ML framework landscape, followed by posts on eager execution, distributed tensors, serialization, and more.\n\nModular and Qualcomm: Same code, new silicon\n\nAugust 18, 2026\n\nWhy LLM Inference Needs a New Kind of Router - Part 3\n\nJune 5, 2026\n\nThree trends from MLSys 2026\n\nMay 29, 2026\n\nBuild the future of AI with Modular\n\nSign up today\n\nSignup to our Cloud Platform today to get started easily.\n\nBrowse open models\n\nBrowse our model catalog, or deploy your own custom model\n\nGet all our latest news, announcements and updates delivered directly to your inbox. Unsubscribe at anytime.\n\n⚠️ This form requires JavaScript to function. Please enable JavaScript in your browser to continue.\n\nYour data is handled in accordance with Modular's Privacy Policy.\n\nThanks for signing up to our newsletter! 🚀\n\nThank you,\n\nModular Sales Team", "url": "https://wpnews.pro/news/modular-reintroducing-maxs-module", "canonical_source": "https://www.modular.com/blog/reintroducing-max-module", "published_at": "2026-11-19 00:00:00+00:00", "updated_at": "2026-11-19 19:13:05.368603+00:00", "lang": "en", "topics": ["artificial-intelligence", "machine-learning", "ai-infrastructure", "developer-tools", "ai-tools"], "entities": ["Modular", "MAX", "Mojo", "Kathy Wu", "Alister Burt", "PyTorch", "Gemma 4"], "also_reported_by": [], "takeaway": "Rebuilding MAX's Module on an Eager layer skips graph compilation so the first token of a model like Gemma 4 appears sooner and unit tests and debug runs no longer incur compile cost, while the built-in compile method retains the production path.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/modular-reintroducing-maxs-module", "markdown": "https://wpnews.pro/news/modular-reintroducing-maxs-module.md", "text": "https://wpnews.pro/news/modular-reintroducing-maxs-module.txt", "jsonld": "https://wpnews.pro/news/modular-reintroducing-maxs-module.jsonld"}}