maxlen = np.max(pairs, axis=(0, 1))
dims = np.append(maxlen[::-1][:-1].cumprod()[::-1], 1)
pairs1D = np.dot(pairs.reshape(-1, 3), dims)
positions1D = np.dot(positions, dims)
mask_idx = ~np.in1d(pairs1D, positions1D).reshape(-1, 2).all(1)
out = pairs[mask_idx]
Efficient Python implementation of numpy array comparisons