Reliable model swapping for any local OpenAI/Anthropic compatible server - llama.cpp, vllm, etc
This report presents the forensic synthetic code analysis of mostlygeek/llama-swap, a Go project with 4,996 GitHub stars. SynthScan v2.0 examined 56,325 lines of code across 400 source files, recording 86 pattern matches distributed across 10 syntactic categories. The overall adjusted score of 2.4 places this repository in the Likely human-written band.
The scanner applied 160+ deterministic lexical heuristics, multi-line block detectors, abstract syntax tree depth profilers, and a cross-file Jaccard similarity matrix to construct a statistically normalised synthetic code estimate. All matches are individually weighted by severity coefficient and contextual multiplier before summation, and the resulting headline score is temporally discounted to account for the repository's development history relative to the commercial emergence of large language model coding tooling (November 2022 onward).
This chart maps the temporal evolution of the adjusted synthetic code score across successive scan runs. An upward trajectory indicates ongoing incorporation of AI-generated code or expanding LLM-assisted scaffolding; a stable or declining trajectory may reflect active human refactoring, code removal, or the adoption of stricter authorship policies. The dashed secondary line (right axis) independently tracks total raw pattern hit count, which can diverge from the normalised score when codebase size changes significantly between scans.
Classifies detected patterns by their diagnostic confidence and structural impact. CRITICAL patterns (coefficient 10) represent definitive synthetic signatures — hallucinated imports, explicit LLM attribution metadata — virtually never produced by human authors. HIGH (5) indicates strong structural tells such as cross-file repetition or cross-linguistic idioms. MEDIUM (2) covers recognisable conversational padding and AI-specific vocabulary. LOW (1) captures subtle indicators like tautological comments and generic boilerplate that require density to carry independent signal.
This horizontal bar chart decomposes the repository's raw synthetic code score by top-level directory, allowing you to pinpoint precisely which modules or components carry the highest AI authorship density. Directories with disproportionately high scores relative to their size warrant targeted manual review: concentrated AI signatures often trace back to mass-generated configuration layers, auto-ported test suites, LLM-scaffolded boilerplate classes, or entire subsystems authored under heavy copilot assistance. Use this view to prioritise your human code-review effort.
The scanner identified 86 distinct pattern matches across 10 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a statistically significant AI authorship indicator. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.
Reading the findings table: The Severity column indicates the diagnostic confidence level (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — comment-context matches receive a ×1.5 weight because LLMs systematically over-annotate. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier as dense clusters constitute far stronger evidence of synthetic authorship than isolated hits.
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | config.example.yaml | 1 | # add this modeline for validation in vscode | COMMENT |
| LOW | config.example.yaml | 21 | # - minimum value is 15 seconds, anything less will be set to this value | COMMENT |
| LOW | config.example.yaml | 41 | # handling requests, etc. | COMMENT |
| LOW | config.example.yaml | 61 | # captureBuffer: how many MBs to allocate for storing request/response captures | COMMENT |
| LOW | config.example.yaml | 81 | # - it is automatically incremented for every model that uses it | COMMENT |
| LOW | config.example.yaml | 101 | globalTTL: 0 | COMMENT |
| LOW | config.example.yaml | 141 | # use environment variable macros to keep secrets out of the config | COMMENT |
| LOW | config.example.yaml | 161 | # - the model's ID is available in the ${MODEL_ID} macro, also available in macros defined above | COMMENT |
| LOW | config.example.yaml | 181 | ${latest-llama} | COMMENT |
| LOW | config.example.yaml | 201 | # - in the format: ENV_NAME=value | COMMENT |
| LOW | config.example.yaml | 221 | # - a ttl of -1 will use the global TTL value as the default | COMMENT |
| LOW | config.example.yaml | 241 | # - recommended to stick to sampling parameters | COMMENT |
| LOW | config.example.yaml | 301 | b: 2 | COMMENT |
| LOW | config.example.yaml | 321 | # - useful for models running on slower hardware that need longer timeouts | COMMENT |
| LOW | config.example.yaml | 361 | # context: the maximum token context length supported | COMMENT |
| LOW | config.example.yaml | 381 | docker run --name ${MODEL_ID} | COMMENT |
| LOW | config.example.yaml | 401 | # on_startup: a dictionary of actions to perform on startup | COMMENT |
| LOW | config.example.yaml | 421 | # - matrix: the newer engine. More involved to configure, but far more | COMMENT |
| LOW | config.example.yaml | 441 | # - behaviour is set per group with the `swap`, `exclusive` and | COMMENT |
| LOW | config.example.yaml | 501 | # costliest ones loaded. | COMMENT |
| LOW | config.example.yaml | 541 | # +ref inline the expression of another set | COMMENT |
| LOW | config.example.yaml | 621 | keepalive: 30 | COMMENT |
| LOW | docker/build-image.sh | 1 | #!/bin/bash | COMMENT |
| LOW | docker/unified/build-image.sh | 1 | #!/bin/bash | COMMENT |
| LOW | internal/server/log.go | 21 | // wiring each one's output per the logToStdout config value. The proxy and | COMMENT |
| LOW | internal/chain/chain.go | 1 | // Package chain composes http.Handler middleware into a single handler. | COMMENT |
| LOW | internal/perf/d3dkmt_windows.go | 141 | // sizeof(D3DKMT_QUERYSTATISTICS) == 0x328 (808 bytes) on x64. | COMMENT |
| LOW | internal/process/runtime_windows.go | 21 | // rooted at cmd.Process. Windows has no SIGTERM or process-group signalling, so | COMMENT |
| LOW | internal/process/process_command.go | 21 | COMMENT | |
| LOW | internal/process/process_command.go | 561 | // immediately, which force-kills the process WaitDelay after the signal | COMMENT |
| LOW | internal/process/process_command_test.go | 321 | } | COMMENT |
| LOW | internal/process/process_command_forking_test.go | 21 | // `"$@"`). After SIGTERM the wrapper dies but the grandchild inherits the | COMMENT |
| LOW | internal/router/base.go | 141 | } | COMMENT |
| LOW | internal/router/base.go | 361 | } | COMMENT |
| LOW | internal/router/scheduler/fifo.go | 81 | // | COMMENT |
| LOW | internal/router/scheduler/scheduler.go | 21 | "github.com/mostlygeek/llama-swap/internal/shared" | COMMENT |
| LOW | internal/router/scheduler/scheduler.go | 41 | // set EvictionFor was given for this decision. Planners may log their | COMMENT |
| LOW | internal/router/scheduler/scheduler.go | 61 | // OnUnload reconciles scheduler state for an unload, stops the targeted | COMMENT |
| LOW | docs/configuration.md | 101 | # copying this file into an LLM and asking it to explain or generate | COMMENT |
| LOW | docs/configuration.md | 121 | # - optional, default (disabled): "" | COMMENT |
| LOW | docs/configuration.md | 141 | # - useful for limiting memory usage when processing large volumes of metrics | COMMENT |
| LOW | docs/configuration.md | 161 | enable: true | COMMENT |
| LOW | docs/configuration.md | 181 | COMMENT | |
| LOW | docs/configuration.md | 201 | # - macro values can be numbers, bools, or strings | COMMENT |
| LOW | docs/configuration.md | 221 | COMMENT | |
| LOW | docs/configuration.md | 241 | models: | COMMENT |
| LOW | docs/configuration.md | 261 | --ctx-size ${default_ctx} | COMMENT |
| LOW | docs/configuration.md | 281 | - "CUDA_VISIBLE_DEVICES=0,1,2" | COMMENT |
| LOW | docs/configuration.md | 301 | # - a value of 0 disables automatic unloading of the model | COMMENT |
| LOW | docs/configuration.md | 321 | COMMENT | |
| LOW | docs/configuration.md | 381 | # becomes: c: [0.7, false, "model: llama"] | COMMENT |
| LOW | docs/configuration.md | 421 | COMMENT | |
| LOW | docs/configuration.md | 441 | # - processes have 5 seconds to shutdown until forceful termination is attempted | COMMENT |
| LOW | docs/configuration.md | 461 | # 4. For each candidate set, compute cost: sum of evict_costs for | COMMENT |
| LOW | docs/configuration.md | 481 | v: voxtral-model | COMMENT |
| LOW | docs/configuration.md | 501 | # "a | b" → [a], [b] | COMMENT |
| LOW | docs/configuration.md | 521 | COMMENT | |
| LOW | docs/configuration.md | 541 | # - peers can be any server that provides the /v1/ generative api endpoints supported by llama-swap | COMMENT |
| LOW | docs/configuration.md | 581 | # filters: a dictionary of filter settings for peer requests | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM⚡ | config.example.yaml | 5 | # ------------------------------------- | COMMENT |
| MEDIUM⚡ | config.example.yaml | 8 | # ==================================== | COMMENT |
| MEDIUM⚡ | config.example.yaml | 12 | # ==================================== | COMMENT |
| MEDIUM | …/src/components/playground/ConcurrencyInterface.svelte | 130 | // Detect and split the llama-swap loading block (wrapped in ━━━━━ markers, | COMMENT |
| MEDIUM⚡ | docs/configuration.md | 96 | # ------------------------------------- | COMMENT |
| MEDIUM⚡ | docs/configuration.md | 99 | # ==================================== | COMMENT |
| MEDIUM⚡ | docs/configuration.md | 103 | # ==================================== | COMMENT |
| MEDIUM | docs/configuration.md | 444 | # ============================================================================= | COMMENT |
| MEDIUM | docs/configuration.md | 446 | # ============================================================================= | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| HIGH | config-schema.json | 490 | "description": "Controls what is logged to stdout. 'proxy': logs generated by llama-swap, 'upstream': copy o | CODE |
| HIGH | config.example.yaml | 40 | # - "proxy": logs generated by llama-swap when swapping models, | COMMENT |
| HIGH | docs/configuration.md | 131 | # - "proxy": logs generated by llama-swap when swapping models, | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | internal/event/README.md | 3 | The original code uses a `time.Ticker` to process the event queue which caused a large increase in CPU usage ([#189](htt | CODE |
| MEDIUM | docs/newrouter-todo.md | 41 | ## Phase 4 — `internal/server` package scaffolding (ProxyManager replacement) -- Completed. | COMMENT |
| MEDIUM | docs/newrouter-todo.md | 68 | ### Phase 4a — package scaffolding -- Completed. | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | docker/build-container.sh | 32 | # Check if ARCH is in the allowed list | COMMENT |
| LOW | docker/build-container.sh | 38 | # Check if GITHUB_TOKEN is set and not empty | COMMENT |
| LOW | docker/build-container.sh | 97 | # Check if response is empty array (no more pages) | COMMENT |
| LOW | docker/build-image.sh | 227 | # Check if our custom builder exists with the right config, create/update if needed | COMMENT |
| LOW | .github/workflows/config-schema.yml | 28 | # Check if the file is valid JSON | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | docker/build-image.sh | 5 | # Usage: | COMMENT |
| LOW | docker/unified/build-image.sh | 5 | # Usage: | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | docker/build-image.sh | 237 | # Create the builder with the config | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | cmd/fake-model/main.go | 21 | "Lorem ipsum dolor sit amet consectetur adipiscing elit sed do eiusmod tempor " + | CODE |
| LOW | cmd/fake-model/main.go | 21 | "Lorem ipsum dolor sit amet consectetur adipiscing elit sed do eiusmod tempor " + | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | internal/router/loading_remarks.go | 85 | "The model saw \"As an AI language model\" and won't stop saying it now", | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | ui-svelte/src/lib/playgroundInterface.ts | 22 | export function createPlaygroundInterface( | CODE |