@@ -50,7 +50,6 @@ async def main():
5050 config = Config ()
5151 config .max_iterations = args .iterations
5252
53- # Use more powerful models from the 3 family for this complex task
5453 config .llm .primary_model = "gemini-2.0-flash-lite"
5554 config .llm .secondary_model = "gemini-2.0-flash"
5655 config .llm .api_base = "https://generativelanguage.googleapis.com/v1beta/openai/"
@@ -59,12 +58,10 @@ async def main():
5958 config .diff_based_evolution = True
6059 config .allow_full_rewrites = False
6160
62- # Increase context and max tokens for detailed tensor decomposition work
63- config .llm .max_context_tokens = 16000
64- config .llm .max_tokens = 8000
65-
66- # Higher temperature for more creative solutions
67- config .llm .temperature = 0.9
61+ # Configure system for complex code evolution
62+ config .llm .max_tokens = 4000 # Reduced to encourage more focused responses
63+ config .max_code_length = 15000 # Increased to handle our complex code
64+ config .llm .temperature = 0.7 # Slightly reduced for more focused responses
6865
6966 # Set database to use rank_quality as the primary metric for comparing programs
7067 config .database .feature_dimensions = ["rank_quality" , "correctness" , "time_efficiency" ]
@@ -86,61 +83,49 @@ async def main():
8683of the corresponding 3D tensor. Each term in the decomposition corresponds to a scalar multiplication in
8784the algorithm, so minimizing the rank directly leads to faster matrix multiplication.
8885
89- You should focus on:
90- 1. Improving the optimization process to find lower-rank decompositions
91- 2. Adding techniques like regularization, noise injection, and scheduling
92- 3. Modifying the loss function to better guide the optimization
93- 4. Enhancing numerical stability for complex-valued operations
94- 5. Finding ways to ensure solutions have simple (integer or half-integer) coefficients
95- 6. Properly handling real vs. complex-valued decompositions
86+ Your focus should be on targeted, specific improvements to the tensor decomposition optimization process.
87+ Make small, focused changes rather than rewriting large sections. Key areas to consider include:
88+
89+ 1. Loss function improvements (regularization terms that encourage specific properties)
90+ 2. Adding noise injection or annealing schedules to avoid local minima
91+ 3. Improving initialization strategies for better convergence
92+ 4. Numerical stability enhancements for complex-valued operations
93+ 5. Techniques to encourage integer or half-integer coefficients
9694
9795The best algorithms from the literature for various matrix sizes include:
9896- 2x2 matrices: Strassen's algorithm (7 multiplications)
9997- 3x3 matrices: Laderman's algorithm (23 multiplications)
10098- 4x4 matrices: Recursive Strassen (49 multiplications, improved to 48 with complex values)
10199
102- For matrices with dimensions other than powers of 2, custom algorithms with fewer multiplications
103- than the naive approach are possible but require sophisticated optimization techniques.
104-
105- When proposing changes, focus on the algorithm's mathematical and optimization aspects, not on
106- micro-optimizations of the code. Significant improvements usually come from changing the approach
107- to finding the decomposition rather than the implementation details.
100+ Focus on making 1-3 specific, high-impact changes rather than comprehensive rewrites.
108101"""
109102
110- # User message template for tensor decomposition optimization
103+ # User message template for tensor decomposition optimization (shortened for compatibility)
111104 user_template = """
112- I'm working on optimizing tensor decomposition for discovering efficient matrix multiplication algorithms,
113- as described in the AlphaEvolve paper. Below is the current implementation and its performance.
114-
115- This is the implementation we're trying to improve:
105+ Improve the tensor decomposition algorithm below with 1-3 specific changes.
116106
107+ CURRENT CODE:
117108{current_program}
118109
119- The current program achieves these metrics :
110+ METRICS :
120111{metrics}
121112
122- Areas that need improvement :
113+ FOCUS AREAS :
123114{improvement_areas}
124115
125- Evolution history:
126- {evolution_history}
127-
128- Please suggest improvements to make the tensor decomposition algorithm find lower-rank decompositions or
129- converge faster to valid solutions. Focus on:
130- - Optimization techniques (loss functions, regularization, schedules)
131- - Initialization strategies for better convergence
132- - Methods to encourage sparse, structured, or low-integer coefficient solutions
133- - Numerical stability improvements
134-
135- Provide specific code changes using SEARCH/REPLACE blocks as follows:
116+ Make targeted changes using this format:
136117
137118<<<<<<< SEARCH
138- // code to be replaced
119+ // exact code to match (keep short)
139120=======
140- // new improved code
121+ // improved code
141122>>>>>>> REPLACE
142123
143- Your changes should be well-reasoned and backed by mathematical intuition.
124+ RULES:
125+ 1. Each SEARCH block must exactly match existing code
126+ 2. Focus on 1-3 specific changes only
127+ 3. Explain each change briefly
128+ 4. Avoid large rewrites
144129"""
145130
146131 # Add the templates to OpenEvolve's template manager
0 commit comments