---
library_name: transformers
pipeline_tag: text-generation
license: mit # Please verify license in repository
tags:
- unsloth
---

# Model Card for LocAgent - Qwen2.5-Coder-Instruct-32B

This model is a fine-tuned version of Qwen-2.5-Coder-Instruct-32B designed for code localization, as described in the paper [LocAgent: Graph-Guided LLM Agents for Code Localization](https://huggingface.co/papers/2503.09089). LocAgent leverages graph-based code representation to enhance the accuracy of identifying code sections relevant to natural language problem descriptions.


## Model Details

### Model Description

LocAgent uses a graph-based representation of codebases (files, classes, functions, and their dependencies) to enable efficient code localization.  This allows LLMs to reason across hierarchical structures and dependencies to identify relevant code sections for changes.

- **Developed by:** The Gerstein Lab
- **Model type:** Code LLM
- **Language(s) (NLP):** English (primarily, depending on the codebase)
- **License:** MIT (Please verify in repository LICENSE file)
- **Finetuned from model:** Qwen-2.5-Coder-Instruct-32B

### Model Sources

- **Repository:** [https://huggingface.co/czlll/Qwen2.5-Coder-32B-CL](https://huggingface.co/czlll/Qwen2.5-Coder-32B-CL)
- **Paper:** [https://huggingface.co/papers/2503.09089](https://huggingface.co/papers/2503.09089)
- **Code:** [https://github.com/gersteinlab/LocAgent](https://github.com/gersteinlab/LocAgent)


## Uses

### Direct Use

LocAgent can be used directly to identify relevant code sections within a codebase given a natural language description of the problem.  The model requires a graph representation of the codebase as input.

### Downstream Use

The fine-tuned LocAgent model can be integrated into IDEs or other software development tools to assist developers in code localization tasks.


## Bias, Risks, and Limitations

LocAgent's performance is dependent on the quality of the codebase's graph representation.  Inaccurate or incomplete graphs can lead to inaccurate localization.  The model's performance may also vary depending on the complexity and size of the codebase and the clarity of the natural language description.  Further, the model inherits biases present in the training data.

### Recommendations

Carefully construct the codebase graph representation.  Provide clear and concise natural language descriptions of the problem. Be aware of potential biases in the model's output.


## How to Get Started with the Model

The following code snippet demonstrates how to use the LocAgent model (replace placeholders with actual paths and adapt for specific model size):

```python
# Requires installation of necessary libraries (see Setup section in README)
from transformers import AutoTokenizer, AutoModelForCausalLM  # Assuming Transformers compatibility

model_id = "czlll/Qwen2.5-Coder-7B-CL" # Replace with the actual model ID, e.g., "czlll/Qwen2.5-Coder-32B-CL"

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id)

# ... (Code to load codebase graph and formulate prompt based on natural language description) ...

inputs = tokenizer(prompt, return_tensors="pt") # Replace 'prompt' with your formatted prompt
outputs = model.generate(**inputs)

# ... (Code to process model output and identify relevant code sections) ...
```

## Training Details

This section would be populated with details from the training procedure described in the paper and the Github README.  It would include information about the datasets, preprocessing steps, hyperparameters, and training infrastructure.



## Evaluation

### Testing Data, Factors & Metrics

This section would describe the evaluation datasets used (like Loc-Bench), factors considered (e.g., codebase size, problem complexity), and evaluation metrics (accuracy, Pass@10).

### Results

This section would detail the results obtained on the Loc-Bench benchmark, comparing LocAgent's performance with other state-of-the-art models (as described in the paper).


## Citation

**BibTeX:**

```bibtex
@article{chen2025locagent,
  title={LocAgent: Graph-Guided LLM Agents for Code Localization},
  author={Chen, Zhaoling and Tang, Xiangru and Deng, Gangda and Wu, Fang and Wu, Jialong and Jiang, Zhiwei and Prasanna, Viktor and Cohan, Arman and Wang, Xingyao},
  journal={arXiv preprint arXiv:2503.09089},
  year={2025}
}
```

**APA:**

Chen, Z., Tang, X., Deng, G., Wu, F., Wu, J., Jiang, Z., Prasanna, V., Cohan, A., & Wang, X. (2025). *LocAgent: Graph-Guided LLM Agents for Code Localization*. arXiv preprint arXiv:2503.09089.