How to Configure LLM Model Parameters (Temperature and Top_P) in the Hiring Agent Repository
You can configure temperature and top_p globally by editing the MODEL_PARAMETERS dictionary in prompt.py, or override them per-run by passing a model_params dict to the ResumeEvaluator constructor.
The interviewstreet/hiring-agent repository centralizes LLM configuration through a structured parameter system that controls text generation randomness. Understanding how to configure temperature and top_p values allows you to balance between deterministic outputs and creative variation when evaluating resumes. This guide covers the two primary methods for adjusting these LLM model parameters according to the source code implementation.
Where Configuration Lives in the Source Code
The codebase implements a two-tier configuration system for LLM parameters. You can modify defaults at the repository level or inject custom values during instantiation.
Global Defaults in prompt.py
The MODEL_PARAMETERS dictionary in prompt.py serves as the central registry for default LLM settings. This dictionary maps each supported model name (such as "gemma3:4b") to a dictionary of generation parameters, including temperature and top_p values. When you instantiate a ResumeEvaluator without specifying custom parameters, the code automatically retrieves defaults from this mapping.
Per-Run Overrides in evaluator.py
The ResumeEvaluator class defined in evaluator.py accepts an optional model_params argument in its __init__ method. When provided, this dictionary supersedes the global defaults from MODEL_PARAMETERS, enabling experimentation without modifying source files. This approach is ideal for CI pipelines or A/B testing different parameter configurations.
Configuring Temperature and Top_P Globally
To change the default behavior for all evaluations using a specific model, edit the MODEL_PARAMETERS dictionary in prompt.py.
# In prompt.py
MODEL_PARAMETERS = {
"gemma3:4b": {"temperature": 0.3, "top_p": 0.85},
"gemini-1.5-flash": {"temperature": 0.1, "top_p": 0.9},
# ... other models
}
After editing, any ResumeEvaluator instance that uses "gemma3:4b" will automatically inherit these new values. This method affects all runs across the repository unless explicitly overridden at instantiation.
Overriding Parameters at Runtime
For one-off evaluations or testing different randomness levels without committing changes to version control, pass a custom model_params dictionary when creating the evaluator:
from evaluator import ResumeEvaluator
# Custom parameters for a single evaluation run
custom_params = {"temperature": 0.7, "top_p": 0.92}
evaluator = ResumeEvaluator(
model_name="gemma3:4b", # or any supported model
model_params=custom_params # overrides MODEL_PARAMETERS defaults
)
# Proceed with evaluation
evaluation = evaluator.evaluate_resume(resume_text)
As implemented in evaluator.py, the model_params argument takes precedence over the global defaults, allowing you to fine-tune randomness for specific use cases while keeping the repository defaults intact.
How the Parameters Flow Through the System
Understanding the data flow ensures your configuration changes take effect. When you call ResumeEvaluator, the parameters travel through the following chain:
- The
ResumeEvaluator.__init__method merges yourmodel_params(if provided) with the defaults fromMODEL_PARAMETERS - The resulting options dictionary is passed to
llm_utils.initialize_llm_provider - This function forwards the exact
temperatureandtop_pvalues to the underlying provider (Ollama or Gemini) without transformation
The llm_utils.py module acts as a thin wrapper, ensuring that whichever configuration method you choose, the specific values reach the LLM provider's API.
Summary
- Global configuration: Edit
MODEL_PARAMETERSinprompt.pyto set defaulttemperatureandtop_pvalues for all runs using a specific model - Runtime override: Pass a
model_paramsdictionary toResumeEvaluatorfor per-instance customization without source code changes - Parameter flow: Values pass through
llm_utils.initialize_llm_providerdirectly to the selected LLM provider (Ollama or Gemini) - File locations: Key files include
prompt.py(defaults),evaluator.py(overrides), andllm_utils.py(provider forwarding)
Frequently Asked Questions
What is the difference between temperature and top_p in LLM configuration?
Temperature controls the overall randomness of the model's output by scaling the probability distribution of next tokens—lower values (e.g., 0.1) produce more deterministic, focused responses, while higher values (e.g., 0.9) increase creativity and variation. Top_p (also called nucleus sampling) controls diversity by restricting token selection to the smallest set whose cumulative probability exceeds the specified value—lower values (e.g., 0.85) limit options to high-probability tokens, while higher values (e.g., 0.95) allow more diverse selections.
How do I set different temperature values for different models in the hiring-agent repository?
Add separate entries to the MODEL_PARAMETERS dictionary in prompt.py for each model name. Each key in this dictionary represents a specific model (e.g., "gemma3:4b", "gemini-1.5-flash"), and you can assign unique temperature and top_p values to each entry. When ResumeEvaluator initializes with a specific model_name, it automatically retrieves the corresponding parameter set from this mapping.
Can I configure LLM parameters using environment variables instead of code changes?
The repository does not natively expose temperature or top_p through environment variables. However, you can set the DEFAULT_MODEL environment variable to switch between models that have different default parameters in MODEL_PARAMETERS. For full parameter control without editing source files, use the runtime override method by passing model_params when instantiating ResumeEvaluator.
Why are my temperature changes not affecting the LLM output?
Ensure you are editing the correct model entry in MODEL_PARAMETERS—verify that the model name in your ResumeEvaluator instantiation matches the key in the dictionary exactly. If using runtime overrides, confirm that you are passing the model_params argument to the constructor, not calling a method after instantiation. Finally, check that you are not inadvertently using a cached ResumeEvaluator instance that was created with previous parameters.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →