The photonic lantern is engineered to losslessly convert between optical sources and modes by optimizing the converging waveguide structure using adaptive learning algorithms and optical simulations.