Downloads · 30 days
11
9% of all-time downloads
l-lyubenov/qwen-invariants-v1-1-q4km
qwen-invariants-v1-1-q4km is a machine learning model from l-lyubenov. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for llama.cpp. The card lists the license as apache-2.0.
A Qwen 3 8B model fine-tuned for detecting invariants in Solidity smart contracts.
Downloads · 30 days
11
9% of all-time downloads
All-time downloads
117
Public
Repo size
5 GB
Likes
2
Public
Click a slice to open those files.
.gguf5 GB · 100%
From the Hugging Face model README
A Qwen 3 8B model fine-tuned for detecting invariants in Solidity smart contracts.
This model is a fine-tuned version of Qwen/Qwen3-8B, optimized to identify and analyze invariants in Solidity code. It can run on GPUs with less than 12GB of VRAM thanks to 4-bit quantization.
| Quantization | Minimum VRAM | File Size |
|---|---|---|
| Q4_K_M (this model) | ~6-8 GB | 4.7 GB |
Tested to run on consumer GPUs (e.g., RTX 3060, RTX 4070).
Analyze the function(s) below and return the held invariants.
For each invariant, provide:
- Description: What the invariant ensures
- Expression: The format expression (use Solidity-like syntax)
- Criticality: high, medium, or low
Return invariants in a clear, structured format.
```solidity
// Place target function source code here
function example() public {
// ...
}
// Place inner function source code here (if analyzing cross-contract invariants)
function innerFunction() internal {
// ...
}
## Example Input
Analyze the function(s) below and return the held invariants. For each invariant, provide:
Return invariants in a clear, structured format.
function addGoo(uint256 gooAmount) external {
// Burn goo being added to gobbler.
goo.burnForGobblers(msg.sender, gooAmount);
// Increase msg.sender's virtual goo balance.
updateUserGooBalance(msg.sender, gooAmount, GooBalanceUpdateType.INCREASE);
}
function updateUserGooBalance(
address user,
uint256 gooAmount,
GooBalanceUpdateType updateType
) internal {
// Will revert due to underflow if we're decreasing by more than the user's current balance.
// Don't need to do checked addition in the increase case, but we do it anyway for convenience.
uint256 updatedBalance = updateType == GooBalanceUpdateType.INCREASE
? gooBalance(user) + gooAmount
: gooBalance(user) - gooAmount;
// Snapshot the user's new goo balance with the current timestamp.
getUserData[user].lastBalance = uint128(updatedBalance);
getUserData[user].lastTimestamp = uint64(block.timestamp);
emit GooBalanceUpdated(user, updatedBalance);
}
function gooBalance(address user) public view returns (uint256) {
// Compute the user's virtual goo balance using LibGOO.
// prettier-ignore
return LibGOO.computeGOOBalance(
getUserData[user].emissionMultiple,
getUserData[user].lastBalance,
uint256(toDaysWadUnsafe(block.timestamp - getUserData[user].lastTimestamp))
);
}
function gooBalance(address user) public view returns (uint256) {
// Compute the user's virtual goo balance using LibGOO.
// prettier-ignore
return LibGOO.computeGOOBalance(
getUserData[user].emissionMultiple,
getUserData[user].lastBalance,
uint256(toDaysWadUnsafe(block.timestamp - getUserData[user].lastTimestamp))
);
}
Result:
| Parameter | Value |
|---|---|
| Temperature | 0.8 |
| Top P | 0.8 |
| Repeat Penalty | 1.1 |
| Context Window | 8192 |
| Quantization | Minimum VRAM |
|---|---|
| Q4_K_M (this model) | ~6-8 GB |
If you use this model, please cite:
@model{qwen-solidity-invariants,
title = {Qwen-Solidity-Invariants},
author = {l-lyubenov},
url = {https://huggingface.co/l-lyubenov/qwen-invariants}
}