Abstract Legume technologies are widely promoted among smallholders in southern Africa, providing an opportunity for sustainable intensification. Farms and farming strategies of smallholders differ greatly within any given locality and determine the opportunities for uptake of technologies. We provide an ex-ante assessment of the impact of grain legumes on different types of farms and identify niches for grain legumes in Malawi. After creation of a farm typology, detailed farm characterisations were used to describe the farming system. The characterisations provided the basis for the construction of simplified, virtual farms on which possible scenarios for expanding and intensifying grain legume production were explored using the farm-scale simulation model NUANCES-FARMSIM. Observed yields and labour inputs suggested that maize provides more edible yield per unit area with a higher calorific value and greater labour use efficiency than groundnut and soybean. Crop yields simulated by the model partly confirmed these yield trends, but at farm level maize-dominated systems often produced less food than systems with more grain legumes. Improved management practices such as addition of P-based fertiliser to grain legumes and inoculation of soybean were crucial to increase biological nitrogen fixation and grain yields of legumes and maize, and created systems with increased area of legumes that were more productive than the current farms. Improved legume management was especially a necessity for low resource endowed farmers who, due to little past use of P-based fertiliser and organic inputs, have soils with a poorer P status than wealthier farmers. Economic analyses suggested that legume cultivation was considerably more profitable than continuous maize cropping. Highest potential net benefits were achieved with tobacco, but the required financial investment made tobacco cultivation riskier. Grain legumes have excellent potential as food and cash crops particularly for medium and high resource endowed farmers, a role that could grow in importance as legume markets further develop. For low resource endowed farmers, legumes can improve food self-sufficiency of households, but only if legumes can be managed with P fertiliser and inoculation in the case of soybean. Given that low resource endowed farmers tend to be risk averse and have few resources to invest, the ability of poorer farmers to adopt legume technologies could be limited.