AI Glossary / Statistics and probability / Advanced

Weighted model counting

Definition

Weighted model counting is the task of summing the weights of all truth assignments that satisfy a logical formula. In a common literal-weighted form, each variable's true and false literals have nonnegative weights, and an assignment's weight is the product of its selected literal weights. Ordinary model counting is the special case in which every assignment has weight one. Here model means a satisfying logical interpretation, not a trained machine-learning model in a portfolio.

What it means

A logical formula specifies which possible worlds satisfy constraints. Weights describe how much each world contributes. Summing over valid worlds connects logical reasoning with probabilistic inference, because suitable encodings can represent probabilities, evidence and queries. A weighted count is not automatically a probability: weights may be unnormalized, and a normalizing constant may be required. The formula and weight construction together determine the meaning of the result.

How it works

Define a finite set of Boolean variables, a formula and a weight for each literal. For every complete assignment satisfying the formula, multiply the weights of the literals made true and add those products. Efficient algorithms avoid explicit enumeration by exploiting decomposition, caching, logical structure or compiled representations. To obtain a conditional probability under a valid encoding, divide the weighted count for constraints plus evidence plus query by the weighted count for constraints plus evidence, provided the denominator is positive. Encodings with auxiliary variables must preserve the intended weighted sum rather than duplicating contributions accidentally.

Three practical examples

Example 1: A probabilistic reasoning system computes a query probability subject to logical constraints. Example 2: A reliability model sums the weights of component states in which a system operates. Example 3: A discrete probabilistic program is compiled into a representation supporting weighted counting. These uses depend on correct encoding. Literal factorization does not mean every substantive variable in the represented model must be independent; constraints and auxiliary constructions can encode dependencies.

Think of it this way

Think of a list of possible worlds, each carrying a ticket weight. A logical rule admits some worlds and excludes others. Weighted model counting adds the tickets of the admitted worlds rather than merely counting how many worlds remain. To express a probability within the admitted collection, compare the relevant ticket total with the collection's overall ticket total.

Worked example

Let A and B be independent Boolean variables with true probabilities 0.30 and 0.40, and false weights 0.70 and 0.60. Consider the formula A OR B. Three assignments satisfy it: A true/B false has weight 0.30 times 0.60 = 0.18; A false/B true has weight 0.70 times 0.40 = 0.28; both true has weight 0.30 times 0.40 = 0.12. The weighted count is 0.58, matching one minus the excluded both-false probability 0.42. The ordinary model count is three. To compute P(A given A OR B), the numerator is 0.18 + 0.12 = 0.30 and the denominator is 0.58, giving 15/29, approximately 0.51724. The independence and normalized literal weights are explicit assumptions of this small example.

Illustrative case study

In this fictional case study, Pine Logic builds a decision-support prototype combining uncertain facts with business rules. Developers translate the model into Boolean constraints and weights, then check small instances by enumerating every assignment. They discover that an auxiliary-variable encoding can count some original worlds more than once unless its semantics are handled correctly. After repairing the encoding, they compare query probabilities with direct calculations and document when normalization is required.

Common misconceptions and mistakes

Common mistakes include confusing logical models with trained predictive models, adding literal weights within an assignment instead of multiplying them, and forgetting to normalize a conditional probability. Another mistake is assuming satisfiability alone answers a counting question. A formula can be satisfiable while having many or few weighted models. Exact weighted counting can be computationally difficult, and a compact logical description does not guarantee a small compiled representation. Approximate methods require their own error and confidence guarantees.

Business use

Businesses using rule-based probabilistic systems should validate both the logical constraints and the numerical weights. Test small cases with known answers, inspect impossible or zero-weight evidence and preserve the meaning of auxiliary variables. Compare computational requirements with the size and structure of the real problem. If an approximate counter is used, report its approximation settings and limitations. A mathematically exact count is exact for the encoded model; it does not establish that the encoded assumptions accurately describe the business environment.

People also ask

Does model mean a trained neural network here?

No; it means a satisfying truth assignment.

Is ordinary counting a special case?

Yes, with unit assignment weights.

Is every weighted count a probability?

No.

Can conditional probabilities be ratios of weighted counts?

Yes, under an appropriate encoding and positive denominator.

Does a satisfiability solver alone return the weighted count?

Not generally.

Check your understanding

How many assignments satisfy A OR B?

Answer: Three.

What is their total weight in the example?

Answer: 0.58.

What is P(A given A OR B)?

Answer: 15/29, approximately 0.51724.

Why does the excluded world have weight 0.42?

Answer: Both false literals occur, giving 0.70 times 0.60 under the stated independent weighting.

Related terms

  • weighted counting asks for their total weight

Learn next

Learn next how branching and decomposition compute weighted counts without listing every world. Compare exact counting with approximate counting and examine how probabilistic networks are encoded. Then study why auxiliary variables, deterministic constraints and normalization must be handled carefully to preserve intended probabilities.

More in Statistics and probability

  • Wald - Wolfowitz runs test - The Wald-Wolfowitz runs test examines whether the ordering of a binary sequence is consistent with randomness, commonly conditional on the numbers of each...
  • Weibull distribution - The Weibull distribution is a flexible continuous distribution for nonnegative quantities, widely used for time-to-event and reliability models.
  • Weighted average - A weighted average combines values while giving each a specified relative influence.
  • Welch's t-test - Welch's t-test compares two population means using independent samples without assuming that the population variances are equal.
  • Western Electric rules - Western Electric rules are a set of pattern checks used with statistical process control charts to flag possible changes in a process.
  • Whipple's index - Whipple's index is a demographic measure of concentration in reported ages ending in selected digits, conventionally zero and five.

Sources

Sources: Vibhav Gogate and Pedro Domingos, Probabilistic Theorem Proving, https://homes.cs.washington.edu/~pedrod/papers/cacm16.pdf; Chakraborty and colleagues, From Weighted to Unweighted Model Counting, https://www.cs.toronto.edu/~meel/Papers/ijcai15.pdf. These primary papers describe weighted counting and probabilistic inference. The two-variable example is original and exhaustively checked; the decision-support case is fictional.

Previous: Weighted majority algorithm (machine learning) Next: Weighted sum

  • Home
  • Daily AI Updates
  • Blog
  • AIFBL Academy
  • AI Glossary
  • Products and Tools
  • Store
  • Free CFO AI Prompt Pack
  • About Shihan Sheriff
  • Privacy Policy
  • Terms of Use
  • Refund Policy
  • Cookie Policy
  • Earnings Disclaimer