Skip to content

Commit

Permalink
perf: remove temperature scaling
Browse files Browse the repository at this point in the history
  • Loading branch information
zlalvani committed May 3, 2024
1 parent 90d280e commit 54957ba
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 22 deletions.
2 changes: 1 addition & 1 deletion apps/cli/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const command = program
)
.option(
"-p, --port <port>",
"port to run the IPC server on (default: 3000)",
"port to run the IPC server on",
(val) => parseInt(val),
3000,
)
Expand Down
12 changes: 2 additions & 10 deletions packages/bumpgen-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ const bumpgen = ({
const { graphService } = services;
return graphService.plan.nodes.nextPending(graph.plan) === undefined;
},
execute: async (graph: BumpgenGraph, temperature: number) => {
execute: async (graph: BumpgenGraph, temperature = 0.2) => {
const { llm, graphService, language } = services;
const { packageToUpgrade } = args;
const planNode = graphService.plan.nodes.nextPending(graph.plan);
Expand Down Expand Up @@ -453,15 +453,7 @@ const bumpgen = ({
type: "graph.plan.execute" as const,
status: "started" as const,
};
const iterationResult = await bumpgen.graph.plan.execute(
graph,
Math.min(
iteration > maxIterations / 2
? 0.2 * Math.exp(0.3 * (iteration - maxIterations / 2))
: 0.2,
2,
),
);
const iterationResult = await bumpgen.graph.plan.execute(graph);
if (!iterationResult) {
break;
}
Expand Down
15 changes: 4 additions & 11 deletions scripts/src/eval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import { exec } from "child_process";
import { existsSync, readFileSync } from "fs";
import { writeFile } from "fs/promises";
import { program } from "@commander-js/extra-typings";
import { injectGitService, makeBumpgen } from "@xeol/bumpgen-core";
import { z } from "zod";

import { injectGitService, makeBumpgen } from "@xeol/bumpgen-core";

export const PredictionSchema = z.object({
// the name of the model that generated the prediction
modelName: z.string(),
Expand Down Expand Up @@ -129,23 +130,15 @@ program
if (errors.length === 0) break;

const graph = bumpgen.graph.initialize(errors);
const temperature = Math.min(
iterations > maxIterations / 2
? 0.2 * Math.exp(0.15 * (iterations - maxIterations / 2))
: 0.2,
1,
);

console.log(
`ITERATION ${iterations} of ${maxIterations} with temperation ${temperature}`,
);

let iterationResult;

do {
iterationResult = await bumpgen.graph.plan.execute(
graph,
temperature,
);
iterationResult = await bumpgen.graph.plan.execute(graph);
if (!iterationResult) break;
} while (iterationResult);

Expand Down

0 comments on commit 54957ba

Please sign in to comment.