Summary
QWEDLocal.verify_logic() asks the configured model two things about the query: an answer, TRUE or FALSE, and a Z3 expression for the statement. It returns verified=True with confidence=1.0 whenever the satisfiability of that expression agrees with the answer.
Both come from the same model, and nothing checks that the expression states what the query asks. So a wrong answer is reported as verified whenever the model's two replies agree with each other. Bool('p') is satisfiable, so any query the model answers TRUE with it comes back verified=True. The verified result is also cached and served again.
Affected components
| Component | Location |
|---|---|
QWEDLocal.verify_logic |
qwed_sdk/qwed_local.py L967-1105: is_correct = is_satisfiable == llm_says_true, then VerificationResult(verified=is_correct, confidence=1.0 if is_correct else 0.0) |
| The local result cache | the same method stores a verified result (cache policy v1, 24 hours by default) and returns it for the same query without calling the model |
Root cause
- Self-consistency, not verification. The model supplies both the claim (TRUE or FALSE) and the formal statement it is checked against. Agreement between two outputs of one model is not evidence that either is right.
- Satisfiability is not truth. An expression is satisfiable when some assignment of its own free Booleans makes it true. A statement written with free propositions, such as
Bool('p')orBool('even'), is satisfiable whatever the query says. - The FALSE direction too. An unsatisfiable expression, such as
And(Bool('p'), Not(Bool('p'))), with the answer FALSE givesverified=True,value="FALSE", for a query whose answer is true. - Nothing ties the expression to the query. No check compares the expression with the question, and
QWEDLocalreturns no admission decision, soverifiedis the only signal a caller has.
Proof of concept (local, synthetic, inert payloads)
The model's two replies are replaced by fixed strings, so nothing is sent anywhere:
from qwed_sdk.qwed_local import QWEDLocal
local = QWEDLocal(base_url="http://localhost:11434/v1", model="llama3", cache=False)
replies = iter(["TRUE", "Bool('p')"])
local._call_llm = lambda prompt, system=None: next(replies) # the model's two replies
r = local.verify_logic("Is 2 + 2 equal to 5?")
print(r.verified, r.value, r.confidence) # True TRUE 1.0
Checked on main at da0de0d5 (9.1.0):
| Query | Model's answer | Model's expression | Result |
|---|---|---|---|
| Is 2 + 2 equal to 5? | TRUE | Bool('p') |
verified=True, value="TRUE", confidence=1.0 |
| Is every integer even? | TRUE | Bool('even') |
verified=True, value="TRUE", confidence=1.0 |
| Is 2 + 2 equal to 4? | FALSE | And(Bool('p'), Not(Bool('p'))) |
verified=True, value="FALSE", confidence=1.0 |
Impact
This affects the integrity of logic answers. An application or agent that acts on QWEDLocal.verify_logic(...).verified acts on whatever the model answered, as long as its two replies agree.
- Who can cause it: a query that steers the model (prompt injection), or a model that is simply wrong, gets
verified=Truewithconfidence=1.0. No credentials are needed. - The cache makes it last: with the cache on, which is the default, the verified answer is served again for the same query for 24 hours.
Affected versions
- From tag
v2.1.0(introduced in49213e4) through 10.0.0 (qwed_sdk/qwed_local.pyis unchanged from 9.1.0 to 10.0.0).
Patches
Fixed in 11.0.0. Upgrade with pip install -U "qwed>=11.0.0". QWEDLocal.verify_logic never returns verified. evidence["consistent"] and error say whether the model agreed with its own formula, and results cached as verified are not served. To verify a logic claim, write the variables and constraints and use LogicVerifier.
Workarounds
- Do not act on
QWEDLocal.verify_logic(...).verified. - To check a logic claim, write the variables and constraints yourself and use
LogicVerifier(verify_logic,prove_theorem). Its verdict is about the formula you wrote, not about a model's paraphrase of the question. - Construct
QWEDLocal(..., cache=False)so a result is not reused.
Advisory page: https://qwedai.tech/security/advisories/ghsa-8fwp-93x2-9fhw
