The invention provides a compound of formula (I): or its stereoisomer, tautomer or pharmaceutically acceptable salt, wherein all variables are defined herein. These compounds are selective factor Xia inhibitors or double inhibitors of fxia and plasma kallikrein. The invention also relates to pharmaceutical compositions containing these compounds and methods of using them to treat thromboembolic and / or inflammatory disorders.本發明提供式(I)化合物:或其立體異構體、互變異構體或藥學上可接受的鹽,其中所有變量皆如本文中所定義。這些化合物爲選擇性因子XIa抑制劑或FXIa和血漿激肽釋放酶的雙重抑制劑。本發明還涉及包含這些化合物的藥物組合物及使用它們治療血栓栓塞性和/或炎性病症的方法。