[PR #4050] [Engine] alias_sampling: request defaults per model alias #4890

Open
opened 2026-11-07 16:31:07 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/4050
Author: @furkangkhsn
Created: 10/25/2026
Status: 🔄 Open

Base: main ← Head: alias-sampling


📝 Commits (3)

  • 94fd5ff serve: alias_sampling - request defaults per model alias (request > shared settings > alias > config)
  • d755bf9 docs: defaults per model alias (alias_sampling)
  • e790d41 serve: alias_sampling - the request's own thinking budget and max_tokens 0 rank as for the shared settings

📊 Changes

3 files changed (+213 additions, -3 deletions)

View changed files

📝 docs/DETAILS.md (+1 -0)
📝 serve/server.py (+43 -3)
➕ serve/test_alias_sampling.py (+169 -0)

📄 Description

Problem and result

The only way to pick a server-side setting such as experimental_speed_projection per request is a custom request field, and many clients cannot send one. With "alias_sampling": {"<alias>": {<settings>}}, a request naming the alias gets those settings and a request naming the model gets the normal ones, from the same loaded engine.

Issue #4048. Scope not yet agreed: draft until you answer.

Approach

  • parse_alias_sampling() reuses clean_shared_defaults, so the allowed keys and their checks are those of POST /settings.
  • At start, each alias is added to the model's aliases.
  • Service.with_shared fills an alias field only where neither the request (directly or through an equivalent field) nor the shared settings set it. The order is therefore request > shared settings > alias > config sampling / reasoning_effort.
  • With no alias_sampling, with_shared returns the same object as before.

Validation

Passed:

  • python -m unittest discover -t . -s serve -p 'test_*.py' on main c62d5e3a (0.2.9) + this branch, Linux: 1312 tests, 1 failure: GpuChoice.test_hip_ordinal, which also fails on clean main c62d5e3a (1298 tests, 2 failures; the other, test_keepawake...early_close, is intermittent here). serve/test_alias_sampling.py has 14 tests:
    • parsing and refusals;
    • each precedence rule and equivalent field;
    • Anthropic effort mapping;
    • the request's own thinking budget;
    • max_tokens: 0;
    • a non-string model field;
    • HTTP: the alias is listed in /v1/models, and the engine command carries cvec=1 for the alias and cvec=0 for the model name.
  • Real hardware: Windows 11, RTX 3090, Strata 0.2.4.2 Terminal install (engine 0.1.48 CUDA 13). server.py was replaced by this branch's file and the launch config was given user_args with a refusal-direction vector, "sampling": {"experimental_speed_projection": false} and an -uncensored alias.
    • The server logged the alias defaults.
    • /v1/models listed both names.
    • The same greedy request under both names gave different answers, the vector being applied only to the alias.
    • strata launch kept alias_sampling and sampling across a restart.

Failed: none observed.

Not run: macOS, AMD and Intel engines; /v1/responses (not covered by design).

Limits

  • Applies on the OpenAI chat and Anthropic messages routes, not /v1/responses.
  • Alias names are matched exactly.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/4050 **Author:** [@furkangkhsn](https://github.com/furkangkhsn) **Created:** 10/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `alias-sampling` --- ### 📝 Commits (3) - [`94fd5ff`](https://github.com/Niko1221/Strata/commit/94fd5ff529393544818e928a7f0aa501b5436f8f) serve: alias_sampling - request defaults per model alias (request > shared settings > alias > config) - [`d755bf9`](https://github.com/Niko1221/Strata/commit/d755bf9a9e76919a598e99ff1c8eb0843f99552a) docs: defaults per model alias (alias_sampling) - [`e790d41`](https://github.com/Niko1221/Strata/commit/e790d411cf25db872997ea92e06c4069838b6cbd) serve: alias_sampling - the request's own thinking budget and max_tokens 0 rank as for the shared settings ### 📊 Changes **3 files changed** (+213 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `docs/DETAILS.md` (+1 -0) 📝 `serve/server.py` (+43 -3) ➕ `serve/test_alias_sampling.py` (+169 -0) </details> ### 📄 Description ### Problem and result The only way to pick a server-side setting such as `experimental_speed_projection` per request is a custom request field, and many clients cannot send one. With `"alias_sampling": {"<alias>": {<settings>}}`, a request naming the alias gets those settings and a request naming the model gets the normal ones, from the same loaded engine. ### Related discussion Issue #4048. Scope not yet agreed: draft until you answer. ### Approach - `parse_alias_sampling()` reuses `clean_shared_defaults`, so the allowed keys and their checks are those of POST /settings. - At start, each alias is added to the model's aliases. - `Service.with_shared` fills an alias field only where neither the request (directly or through an equivalent field) nor the shared settings set it. The order is therefore request > shared settings > alias > config `sampling` / `reasoning_effort`. - With no `alias_sampling`, `with_shared` returns the same object as before. ### Validation **Passed:** - `python -m unittest discover -t . -s serve -p 'test_*.py'` on main c62d5e3a (0.2.9) + this branch, Linux: 1312 tests, 1 failure: `GpuChoice.test_hip_ordinal`, which also fails on clean main c62d5e3a (1298 tests, 2 failures; the other, `test_keepawake...early_close`, is intermittent here). `serve/test_alias_sampling.py` has 14 tests: - parsing and refusals; - each precedence rule and equivalent field; - Anthropic effort mapping; - the request's own thinking budget; - `max_tokens: 0`; - a non-string `model` field; - HTTP: the alias is listed in `/v1/models`, and the engine command carries `cvec=1` for the alias and `cvec=0` for the model name. - Real hardware: Windows 11, RTX 3090, Strata 0.2.4.2 Terminal install (engine 0.1.48 CUDA 13). `server.py` was replaced by this branch's file and the launch config was given `user_args` with a refusal-direction vector, `"sampling": {"experimental_speed_projection": false}` and an `-uncensored` alias. - The server logged the alias defaults. - `/v1/models` listed both names. - The same greedy request under both names gave different answers, the vector being applied only to the alias. - `strata launch` kept `alias_sampling` and `sampling` across a restart. **Failed:** none observed. **Not run:** macOS, AMD and Intel engines; `/v1/responses` (not covered by design). ### Limits - Applies on the OpenAI chat and Anthropic messages routes, not `/v1/responses`. - Alias names are matched exactly. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#4890
No description provided.