We study local multiplicities associated to the so-called generalized Shalika models. By establishing a local trace formula for these kind of models, we are able to prove a multiplicity formula for discrete series. As a result, we can show that these multiplicities are constant over every discrete Vogan L-packet and that they are related to local exterior square L-functions.Let A ′ be another degree n central simple algebra over F . Set G ′ := GL 2 (A ′ ) and define subgroups H ′ 0 , N ′ , H ′ := H ′ 0 ⋉ N ′ analogous to the subgroups H 0 , N and H of G. We also define similarly characters characters ξ ′ , ω ⊗ ξ ′ of N ′ , H ′ respectively and for all irreducible admissible representation π ′ of G ′ , we setThe main result of this paper is the following theorem which says that these multiplicities are constant over every discrete Vogan L-packet.Theorem 1.2. Let π (resp. π ′ ) be a discrete series of G (resp. G ′ ). Assume that π and π ′ correspond to each other under the local Jacquet-Langlands correspondence (see [9]). Then m(π, ω) = m(π ′ , ω).Assume one moment that ω1 (the trivial character) and set for simplicity m(π) := m(π, 1). Then, by work of Kewat [23], Kewat-Ragunathan [24], Jiang-Nien-Qin [20] and the multiplicity one theorem of Jacquet-Rallis [22], in the particular case where A = M n (F ) we know that for all discrete series π we have m(π) = 1 if and only if L(s, π, ∧ 2 ) (the Artin exterior square L-function) has a pole at s = 0 (i.e. the Langlands parameter of π is symplectic) and m(π) = 0 otherwise. Actually, to our knowledge, a full proof of this result has not appeared in the literature and thus for completeness we provide the necessary complementary arguments in Section 6.1. Together with Theorem 1.2 this immediately implies Theorem 1.3. For all discrete series representation π of G, we have m(π) = 1 if and only if the local exterior square L-function L(s, π, ∧ 2 ) has a pole at s = 0 and m(π) = 0 otherwise.We will prove Theorem 1.2 in Section 6.1. The key ingredient of our proof is a certain integral formula computing the multiplicity m(π, ω) that we now state. Recall that following Harish-Chandra, any irreducible representation π has a well-defined character Θ π which is a locally integrable function on G locally constant on the regular semi-simple locus. Moreover, Harish-Chandra has completely described the possible singularities of Θ π near singular semisimple elements leading to certain local expansions of the character near such point. Using these, we can define a certain regularization x → c π (x) of Θ π at all semi-simple point by taking the average of the 'leading coefficients' of these local expansions (see Section 2.2 for details, actually for the groups considered in this paper there is always at most one such leading coefficient). Given this, our multiplicity formula can be stated as follows (see Proposition 3.3) Theorem 1.4. For all essentially square-integrable representation π of G with central character χ = ω n (seen as a character of A G = F × ), we have m(π, ω) = T ∈T ell (H ...