Skip to content

Commit b40c07c

Browse files
authored
remove sd (#15)
1 parent d273780 commit b40c07c

274 files changed

Lines changed: 110 additions & 858765 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

β€Ž.gitignoreβ€Ž

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,5 @@ __pycache__/
1313
/build
1414
log.*
1515

16-
# Java Files
17-
src/self_debug/lang/java/native/target
18-
1916
/.idea
2017
src/logs

β€ŽREADME.mdβ€Ž

Lines changed: 110 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,38 +37,135 @@
3737

3838
πŸš€ Repository for automated Java code migration research, part of the [MigrationBench](https://huggingface.co/collections/AmazonScience/migrationbench-68125452fc21a4564b92b6c3) project.
3939

40+
<!-- toc -->
4041

41-
## πŸ“¦ Packages
42+
- [1. Overview](#1-overview)
43+
- [2. MigrationBench Datasets](#2-migrationbench-datasets)
44+
- [3. Installation](#3-installation)
45+
* [3.1 Prerequisites](#31-prerequisites)
46+
* [3.2 Install Package](#32-install-package)
47+
- [4. Usage](#4-usage)
48+
* [4.1 Agent Types](#41-agent-types)
49+
* [4.2 Running Migration](#42-running-migration)
50+
* [4.3 Command Line Options](#43-command-line-options)
51+
- [5. Data](#5-data)
52+
- [6. Resources](#6-resources)
53+
- [7. Citation](#7-citation)
4254

43-
This repository contains **two** sub-packages to conduct Java code migration with LLMs:
55+
<!-- tocstop -->
4456

45-
### 1. πŸ€– [JavaMigrationAgent](./java_migration_agent)
57+
## 1. Overview
4658

47-
[**JavaMigrationAgent**](./java_migration_agent) is an LLM-based agent to automate Java 8 to Java 17 (21) migration,
48-
built on top of the [Strands Agents](https://strandsagents.com/latest/) framework.
59+
**JavaMigrationAgent** is a library for automated code migration from Java 8 to Java 17 (21) using LLM-based agents built on the [Strands Agents](https://strandsagents.com/latest/) framework.
4960

50-
- It supports multiple migration strategies including baseline, PE (prompt engineering), RAG, and a hybrid approach (More cost effective).
61+
It provides multiple agent strategies for migration:
62+
1. **Baseline**: Direct LLM-based migration
63+
1. **PE (Prompt Engineering)** (Baseline + PE): Baseline with enhanced prompts for dependency updates
64+
1. **RAG** (Baseline + PE + RAG): Uses retrieval-augmented generation for dependency version lookup
65+
1. **Hybrid** (Seed change, followed by baseline + PE): Pre-processes dependencies before LLM migration (More cost effective)
5166

52-
### 2. πŸ”§ [SDFeedback](./self_debug)
67+
The agent relies on the [MigrationBench](https://github.com/amazon-science/MigrationBench) package for evaluation.
5368

54-
[**SDFeedback**](./self_debug) runs code migration implementation with LLMs by providing self debugging feedback,
55-
motivated by the [Teaching Large Language Models to Self-Debug](https://arxiv.org/abs/2304.05128) paper.
69+
## 2. [πŸ€— MigrationBench](https://huggingface.co/collections/AmazonScience/migrationbench-68125452fc21a4564b92b6c3) Datasets
5670

57-
- It includes both single-job and batch processing capabilities with AWS EMRS support.
71+
| Index | Dataset | Size | Notes |
72+
|-------|-----------------------------------------------|-------|-----------------------------------------------------------------------------------------------------|
73+
| 1 | [πŸ€— AmazonScience/migration-bench-java-full](https://huggingface.co/datasets/AmazonScience/migration-bench-java-full) | 5,102 | Each repo has a test directory or at least one test case |
74+
| 2 | [πŸ€— AmazonScience/migration-bench-java-selected](https://huggingface.co/datasets/AmazonScience/migration-bench-java-selected) | 300 | A **subset** of migration-bench-java-full |
5875

76+
## 3. Installation
5977

60-
## πŸ“Š Data
78+
### 3.1 Prerequisites
79+
80+
Verify you have `java 17` and `maven 3.9.6` installed:
81+
82+
```bash
83+
# java
84+
$ java --version
85+
openjdk 17.0.15 2025-04-15 LTS
86+
OpenJDK Runtime Environment Corretto-17.0.15.6.1 (build 17.0.15+6-LTS)
87+
OpenJDK 64-Bit Server VM Corretto-17.0.15.6.1 (build 17.0.15+6-LTS, mixed mode, sharing)
88+
```
89+
90+
```bash
91+
# maven
92+
$ mvn --version
93+
Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)
94+
Maven home: /usr/local/bin/apache-maven-3.9.6
95+
Java version: 17.0.15, vendor: Amazon.com Inc., runtime: /usr/lib/jvm/java-17-amazon-corretto.x86_64
96+
```
97+
If you haven't done it yet, follow the instructions in [MigrationBench](https://github.com/amazon-science/MigrationBench) to install Maven.
98+
99+
### 3.2 Install Package
100+
101+
```bash
102+
# cd .../JavaMigration/
103+
104+
pip install -r requirements.txt -e .
105+
```
106+
107+
Or with uv:
108+
109+
```bash
110+
# cd .../JavaMigration/
111+
112+
uv pip install -e .
113+
```
114+
115+
## 4. Usage
116+
117+
See the full binary script at [src/java_migration_agent/main.py](https://github.com/amazon-science/JavaMigration/blob/main/src/java_migration_agent/main.py).
118+
119+
120+
### 4.1 Agent Types
121+
122+
| Agent Type | Description |
123+
|------------|-------------|
124+
| `baseline` | Direct LLM migration with `mvn clean verify` |
125+
| `pe` | Baseline with prompt engineering for dependency updates |
126+
| `rag` | Uses dependency version lookup tool for migration |
127+
| `hybrid` | Pre-processes pom.xml dependencies before LLM migration |
128+
129+
### 4.2 Running Migration
130+
131+
Run batch migration on the MigrationBench dataset:
132+
133+
```bash
134+
python -m java_migration_agent \
135+
--agent-type baseline \
136+
--exp-id exp-001 \
137+
--hf-dataset AmazonScience/migration-bench-java-selected \
138+
--model-id global.anthropic.claude-sonnet-4-5-20250929-v1:0 \
139+
--max-workers 8 \
140+
--output-dir ./migration_results
141+
```
142+
143+
### 4.3 Command Line Options
144+
145+
146+
| Flag | Type | Default | Description |
147+
|--------|------|---------|-------------|
148+
| `--agent-type` | `str` | (required) | Agent type: `baseline`, `pe`, `rag`, or `hybrid` |
149+
| `--exp-id` | `str` | (required) | Experiment identifier for organizing results |
150+
| `--hf-dataset` | `str` | `AmazonScience/migration-bench-java-selected` | HuggingFace dataset name |
151+
| `--model-id` | `str` | `global.anthropic.claude-sonnet-4-5-20250929-v1:0` | Bedrock model ID |
152+
| `--temperature` | `float` | `1.0` | Model temperature |
153+
| `--max-messages` | `int` | `80` | Maximum messages per conversation |
154+
| `--max-workers` | `int` | `8` | Maximum parallel workers |
155+
| `--output-dir` | `str` | `./migration_results` | Output directory for results |
156+
157+
## 5. πŸ“Š Data
61158

62159
Agent trajectories and execution results are stored in the `data/` folder.
63160

64-
## πŸ”— Resources
161+
## 6. πŸ”— Resources
65162

66163
1. πŸ€— [MigrationBench (Hugging Face)](https://huggingface.co/collections/AmazonScience/migrationbench-68125452fc21a4564b92b6c3)
67164
1. πŸ’» [MigrationBench (GitHub)](https://github.com/amazon-science/MigrationBench)
68165
1. πŸ“„ [arXiv Paper](https://arxiv.org/abs/2505.09569)
69166

70167

71-
## πŸ“š Citation
168+
## 7. πŸ“š Citation
72169

73170
```bibtex
74171
@misc{liu2025migrationbenchrepositorylevelcodemigration,
File renamed without changes.
File renamed without changes.

β€Žjava_migration_agent/README.mdβ€Ž

Lines changed: 0 additions & 167 deletions
This file was deleted.

0 commit comments

Comments
Β (0)