Metadata-Version: 2.4
Name: adadec
Version: 0.1.0
Summary: AdaDec is an uncertainty-guided adaptive decoding framework for large language model (LLM) code generation which enhances standard decoding with a selective pause-then-rerank mechanism triggered by model uncertainty.
Author-email: Arw-Wow <hekaifeng70@gmail.com>
License: MIT License
        
        Copyright (c) 2025 Arw-Wow
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/SYSUSELab/AdaDec
Requires-Python: >=3.9.18
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: scikit-learn
Requires-Dist: torch
Requires-Dist: pandas
Requires-Dist: transformers
Requires-Dist: numpy
Dynamic: license-file

# AdaDec: Adaptive Decoding for Code Generation

AdaDec is an adaptive decoding framework for LLM code generation. 
It selectively pauses decoding when uncertainty is high, reranks candidates, 
and improves accuracy with moderate overhead.


## Installation

```bash
pip install adadec
````


## Quick Start

```python
from adadec import prepare_adadec, generate_adadec
prepare_adadec(model, tokenizer, "train.jsonl", "out.parquet", "mymodel", "thresholds.json")
result = generate_adadec(model, tokenizer, ["def add(a, b):"], "mymodel")
```

Note that train.jsonl requires "task_id", "prompt", and "canonical_solution".

stop_words.json example:
```json
["\\n{4,}", "^\\S"]
```


## 📖 License

MIT License


## Links
* [Source Code](https://github.com/SYSUSELab/AdaDec)

